MapHub TransportSendTimeout, WebSockets.CloseTimeout fix; etc...
This commit is contained in:
parent
d2d4ea56c5
commit
a43c7e6858
|
|
@ -1,12 +1,11 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace FruitBank.Common
|
||||
{
|
||||
public interface IFastObservableCollection
|
||||
public interface IMgFastObservableCollection
|
||||
{
|
||||
public void AddRange(IEnumerable other);
|
||||
public void Replace(IEnumerable other);
|
||||
|
|
@ -14,20 +13,20 @@ namespace FruitBank.Common
|
|||
public void Synchronize(NotifyCollectionChangedEventArgs args);
|
||||
}
|
||||
|
||||
public interface IFastObservableCollection<T>: IFastObservableCollection
|
||||
public interface IMgFastObservableCollection<T> : IMgFastObservableCollection
|
||||
{
|
||||
public void Replace(IEnumerable<T> other);
|
||||
public void Sort(IComparer<T> comparer);
|
||||
public void SortAndReplace(IEnumerable<T> other, IComparer<T> comparer);
|
||||
}
|
||||
|
||||
public class FastObservableCollection<T> : ObservableCollection<T>, IFastObservableCollection<T>
|
||||
public class MgObservableCollection<T> : ObservableCollection<T>, IMgFastObservableCollection<T>
|
||||
{
|
||||
private bool suppressChangedEvent = false;
|
||||
private bool _suppressChangedEvent;
|
||||
|
||||
public void Replace(IEnumerable<T> other)
|
||||
{
|
||||
suppressChangedEvent = true;
|
||||
_suppressChangedEvent = true;
|
||||
|
||||
Clear();
|
||||
AddRange(other);
|
||||
|
|
@ -35,45 +34,45 @@ namespace FruitBank.Common
|
|||
|
||||
public void Replace(IEnumerable other)
|
||||
{
|
||||
suppressChangedEvent = true;
|
||||
_suppressChangedEvent = true;
|
||||
|
||||
Clear();
|
||||
foreach (T item in other) Add(item);
|
||||
|
||||
suppressChangedEvent = false;
|
||||
_suppressChangedEvent = false;
|
||||
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
OnPropertyChanged(new(nameof(Count)));
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Count)));
|
||||
}
|
||||
|
||||
public void AddRange(IEnumerable other)
|
||||
{
|
||||
suppressChangedEvent = true;
|
||||
_suppressChangedEvent = true;
|
||||
|
||||
foreach (object item in other)
|
||||
foreach (var item in other)
|
||||
{
|
||||
if (item is T tItem) Add(tItem);
|
||||
}
|
||||
|
||||
suppressChangedEvent = false;
|
||||
_suppressChangedEvent = false;
|
||||
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
OnPropertyChanged(new(nameof(Count)));
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Count)));
|
||||
}
|
||||
|
||||
public void RemoveRange(IEnumerable other)
|
||||
{
|
||||
suppressChangedEvent = true;
|
||||
_suppressChangedEvent = true;
|
||||
|
||||
foreach (object item in other)
|
||||
foreach (var item in other)
|
||||
{
|
||||
if (item is T tItem) Remove(tItem);
|
||||
}
|
||||
|
||||
suppressChangedEvent = false;
|
||||
_suppressChangedEvent = false;
|
||||
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
OnPropertyChanged(new(nameof(Count)));
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Count)));
|
||||
}
|
||||
|
||||
public void SortAndReplace(IEnumerable<T> other, IComparer<T> comparer)
|
||||
|
|
@ -94,23 +93,28 @@ namespace FruitBank.Common
|
|||
|
||||
public void Synchronize(NotifyCollectionChangedEventArgs args)
|
||||
{
|
||||
if (args.Action == NotifyCollectionChangedAction.Add && args.NewItems != null)
|
||||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add when args.NewItems != null:
|
||||
AddRange(args.NewItems);
|
||||
}
|
||||
else if (args.Action == NotifyCollectionChangedAction.Remove && args.OldItems != null)
|
||||
{
|
||||
break;
|
||||
case NotifyCollectionChangedAction.Remove when args.OldItems != null:
|
||||
RemoveRange(args.OldItems);
|
||||
}
|
||||
else if (args.Action == NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
break;
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
Clear();
|
||||
break;
|
||||
case NotifyCollectionChangedAction.Replace:
|
||||
case NotifyCollectionChangedAction.Move:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
if (suppressChangedEvent)
|
||||
if (_suppressChangedEvent)
|
||||
return;
|
||||
|
||||
base.OnPropertyChanged(e);
|
||||
|
|
@ -118,10 +122,31 @@ namespace FruitBank.Common
|
|||
|
||||
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (suppressChangedEvent)
|
||||
if (_suppressChangedEvent)
|
||||
return;
|
||||
|
||||
base.OnCollectionChanged(e);
|
||||
}
|
||||
|
||||
//protected override void ClearItems()
|
||||
//{
|
||||
// base.ClearItems();
|
||||
//}
|
||||
|
||||
//protected override void InsertItem(int index, T item)
|
||||
//{
|
||||
// base.InsertItem(index, item);
|
||||
//}
|
||||
|
||||
//protected override void MoveItem(int oldIndex, int newIndex)
|
||||
//{
|
||||
// base.MoveItem(oldIndex, newIndex);
|
||||
//}
|
||||
|
||||
//public override event NotifyCollectionChangedEventHandler? CollectionChanged
|
||||
//{
|
||||
// add => base.CollectionChanged += value;
|
||||
// remove => base.CollectionChanged -= value;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
@ -48,5 +48,6 @@ public class LoggedInModel
|
|||
{
|
||||
CustomerDto = null;
|
||||
CustomerRoles.Clear();
|
||||
//MeasuringUsers.Clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -87,6 +87,7 @@
|
|||
public GridProductDto Grid { get; set; }
|
||||
|
||||
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
||||
|
||||
[Parameter] public IEnumerable<ProductDto>? ProductDtos { get; set; }
|
||||
//[Parameter] public List<OrderDto>? OrderDtos { get; set; }
|
||||
//[Parameter] public List<OrderItemDto>? OrderItemDtos { get; set; }
|
||||
|
|
@ -129,7 +130,7 @@
|
|||
|
||||
private async Task<List<OrderDto>> GetOrderDtosFromDbAsync(int productId)
|
||||
{
|
||||
using(await _lockOrderDtosByProductId.UseWaitAsync())
|
||||
using (await _lockOrderDtosByProductId.UseWaitAsync())
|
||||
{
|
||||
if (_orderDtosByProductId.TryGetValue(productId, out var orderDtos)) return orderDtos;
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class ShippingItemTable : SignalRDataSourceList<ShippingItemTableItem>
|
|||
}
|
||||
}
|
||||
|
||||
public class ProductDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : FastObservableCollection<ProductDtoTableItem>
|
||||
public class ProductDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : MgObservableCollection<ProductDtoTableItem>
|
||||
{
|
||||
private readonly SemaphoreSlim _semaphoreSlim = new(1);
|
||||
public async Task<ProductDtoTable> LoadDataAsync(bool onlyIfEmpty = true)
|
||||
|
|
@ -80,7 +80,7 @@ public class ProductDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : Fa
|
|||
return this;
|
||||
}
|
||||
}
|
||||
public class OrderDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : FastObservableCollection<OrderDtoTableItem>
|
||||
public class OrderDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : MgObservableCollection<OrderDtoTableItem>
|
||||
{
|
||||
private readonly SemaphoreSlim _semaphoreSlim = new(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
@page "/Login"
|
||||
@using FruitBank.Common.Models
|
||||
@using Mango.Nop.Core.Dtos
|
||||
|
||||
<h3>Bejelentkezés</h3>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using AyCode.Core.Loggers;
|
||||
using AyCode.Utils.Extensions;
|
||||
using FruitBank.Common.Models;
|
||||
using FruitBankHybrid.Shared.Databases;
|
||||
using FruitBankHybrid.Shared.Services.Loggers;
|
||||
using FruitBankHybrid.Shared.Services.SignalRs;
|
||||
using Mango.Nop.Core.Dtos;
|
||||
|
|
@ -34,10 +35,16 @@ public partial class Login : ComponentBase
|
|||
_logger.Info("OnInitializedAsync");
|
||||
|
||||
if (!LoggedInModel.IsLoggedIn)
|
||||
{
|
||||
using (await ObjectLock.GetSemaphore<CustomerDto>().UseWaitAsync())
|
||||
{
|
||||
if (LoggedInModel.MeasuringUsers.Count == 0)
|
||||
{
|
||||
LoggedInModel.MeasuringUsers = await FruitBankSignalRClient.GetMeasuringUsers() ?? [];
|
||||
SelectedUser = LoggedInModel.MeasuringUsers.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
else _rolesText = string.Join("; ", LoggedInModel.CustomerRoles.Select(x => x.Name));
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using FruitBankHybrid.Shared.Services.Loggers;
|
|||
using Mango.Nop.Core.Dtos;
|
||||
using Mango.Nop.Core.Models;
|
||||
using MessagePack.Resolvers;
|
||||
using Microsoft.AspNetCore.SignalR.Client;
|
||||
using Nop.Core.Domain.Customers;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ServiceModel.Channels;
|
||||
|
|
@ -25,6 +26,13 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
|
|||
{
|
||||
public FruitBankSignalRClient( /*IServiceProvider serviceProvider, */ IEnumerable<IAcLogWriterClientBase> logWriters) : base($"{FruitBankConstClient.BaseUrl}/{FruitBankConstClient.DefaultHubName}", new LoggerClient(nameof(FruitBankSignalRClient), logWriters.ToArray()))
|
||||
{
|
||||
//var hubConnection = new HubConnectionBuilder()
|
||||
// .WithUrl("fullHubName")
|
||||
// .WithAutomaticReconnect()
|
||||
// .WithStatefulReconnect()
|
||||
// .WithKeepAliveInterval(TimeSpan.FromSeconds(60))
|
||||
// .WithServerTimeout(TimeSpan.FromSeconds(120))
|
||||
|
||||
ConstHelper.NameByValue<SignalRTags>(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue