diff --git a/Toolkit.Foundation/ICollectionSynchronization.cs b/Toolkit.Foundation/ICollectionSynchronization.cs new file mode 100644 index 0000000..10d67c9 --- /dev/null +++ b/Toolkit.Foundation/ICollectionSynchronization.cs @@ -0,0 +1,3 @@ +namespace Toolkit.Foundation; + +public interface ICollectionSynchronization; \ No newline at end of file diff --git a/Toolkit.Foundation/ICollectionSynchronizationExtensions.cs b/Toolkit.Foundation/ICollectionSynchronizationExtensions.cs new file mode 100644 index 0000000..c368e40 --- /dev/null +++ b/Toolkit.Foundation/ICollectionSynchronizationExtensions.cs @@ -0,0 +1,7 @@ +namespace Toolkit.Foundation; + +public static class ICollectionSynchronizationExtensions +{ + public static int IndexOf(this ICollectionSynchronization synchronization, + TItem item) => synchronization is IList collection ? collection.IndexOf(item) : -1; +} diff --git a/Toolkit.Foundation/IIndexable.cs b/Toolkit.Foundation/IIndexed.cs similarity index 69% rename from Toolkit.Foundation/IIndexable.cs rename to Toolkit.Foundation/IIndexed.cs index dcf42af..43f70d3 100644 --- a/Toolkit.Foundation/IIndexable.cs +++ b/Toolkit.Foundation/IIndexed.cs @@ -1,6 +1,6 @@ namespace Toolkit.Foundation; -public interface IIndexable +public interface IIndexed { public int Index { get; } -} \ No newline at end of file +} diff --git a/Toolkit.Foundation/IKeyed.cs b/Toolkit.Foundation/IKeyed.cs new file mode 100644 index 0000000..dfaae3b --- /dev/null +++ b/Toolkit.Foundation/IKeyed.cs @@ -0,0 +1,6 @@ +namespace Toolkit.Foundation; + +public interface IKeyed +{ + public T Id { get; } +} \ No newline at end of file diff --git a/Toolkit.Foundation/ISynchronizationCollection.cs b/Toolkit.Foundation/ISynchronizationCollection.cs deleted file mode 100644 index 34ddd27..0000000 --- a/Toolkit.Foundation/ISynchronizationCollection.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Toolkit.Foundation; - -public interface ISynchronizationCollection -{ - int IndexOf(TItem item); -} diff --git a/Toolkit.Foundation/Observable.cs b/Toolkit.Foundation/Observable.cs index eb0055a..f3a7583 100644 --- a/Toolkit.Foundation/Observable.cs +++ b/Toolkit.Foundation/Observable.cs @@ -1,4 +1,5 @@ using CommunityToolkit.Mvvm.ComponentModel; +using System.ComponentModel; namespace Toolkit.Foundation; @@ -140,4 +141,11 @@ public partial class Observable : Observable Key = key; Value = value; } + + partial void OnValueChanged(TValue? value) => OnValueChanged(); + + protected virtual void OnValueChanged() + { + + } } \ No newline at end of file diff --git a/Toolkit.Foundation/ObservableCollection.cs b/Toolkit.Foundation/ObservableCollection.cs index 57b1f85..7c8d99a 100644 --- a/Toolkit.Foundation/ObservableCollection.cs +++ b/Toolkit.Foundation/ObservableCollection.cs @@ -18,7 +18,7 @@ public partial class ObservableCollection : IList, IReadOnlyList, INotifyCollectionChanged, - ISynchronizationCollection, + ICollectionSynchronization, IServiceProviderRequired, IServiceFactoryRequired, IMediatorRequired,