From a724fce2f687b9d23a6180251326997905d3ecd1 Mon Sep 17 00:00:00 2001 From: Loretta Date: Fri, 21 Nov 2025 07:20:35 +0100 Subject: [PATCH] improvements --- ...ableCollection.cs => AcObservableCollection.cs} | 14 +++++++++++--- .../SignalRs/AcSignalRDataSource.cs | 6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) rename AyCode.Core/Helpers/{AcFastObservableCollection.cs => AcObservableCollection.cs} (90%) diff --git a/AyCode.Core/Helpers/AcFastObservableCollection.cs b/AyCode.Core/Helpers/AcObservableCollection.cs similarity index 90% rename from AyCode.Core/Helpers/AcFastObservableCollection.cs rename to AyCode.Core/Helpers/AcObservableCollection.cs index 0d5be2c..eea1e1f 100644 --- a/AyCode.Core/Helpers/AcFastObservableCollection.cs +++ b/AyCode.Core/Helpers/AcObservableCollection.cs @@ -5,7 +5,7 @@ using System.ComponentModel; namespace AyCode.Core.Helpers { - public interface IAcFastObservableCollection + public interface IAcObservableCollection { public void AddRange(IEnumerable other); public void Replace(IEnumerable other); @@ -13,17 +13,25 @@ namespace AyCode.Core.Helpers public void Synchronize(NotifyCollectionChangedEventArgs args); } - public interface IAcFastObservableCollection : IAcFastObservableCollection + public interface IAcObservableCollection : IAcObservableCollection { public void Replace(IEnumerable other); public void Sort(IComparer comparer); public void SortAndReplace(IEnumerable other, IComparer comparer); } - public class AcFastObservableCollection : ObservableCollection, IAcFastObservableCollection + public class AcObservableCollection : ObservableCollection, IAcObservableCollection { private bool _suppressChangedEvent; + public AcObservableCollection() : base() + { } + public AcObservableCollection(List list) : base(list) + { } + + public AcObservableCollection(IEnumerable collection) : base(collection) + { } + public void Replace(IEnumerable other) { _suppressChangedEvent = true; diff --git a/AyCode.Services.Server/SignalRs/AcSignalRDataSource.cs b/AyCode.Services.Server/SignalRs/AcSignalRDataSource.cs index 255cc9e..f170d8d 100644 --- a/AyCode.Services.Server/SignalRs/AcSignalRDataSource.cs +++ b/AyCode.Services.Server/SignalRs/AcSignalRDataSource.cs @@ -204,9 +204,9 @@ namespace AyCode.Services.Server.SignalRs public bool HasWorkingReferenceList { get; private set; } - public void SetWorkingReferenceList(TIList workingIList) + public void SetWorkingReferenceList(TIList? workingIList) { - if (workingIList == null!) return; //throw new ArgumentNullException(nameof(workingList)); + if (workingIList == null) return; //throw new ArgumentNullException(nameof(workingList)); Monitor.Enter(_syncRoot); @@ -267,7 +267,7 @@ namespace AyCode.Services.Server.SignalRs { switch (destination) { - case IAcFastObservableCollection dest: + case IAcObservableCollection dest: dest.AddRange(source); break; case List dest: