Fixed issue when locking and unlocking the same wallet
This commit is contained in:
@@ -144,13 +144,22 @@ public partial class ObservableCollection<TItem> :
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSource(IList<TItem> source)
|
||||
private Func<TItem> defaultSelectionFactory;
|
||||
|
||||
public void SetSource(IList<TItem> source,
|
||||
Func<TItem>? defaultSelectionFactory)
|
||||
{
|
||||
foreach (TItem item in source)
|
||||
{
|
||||
Add(item);
|
||||
}
|
||||
|
||||
if (defaultSelectionFactory is not null)
|
||||
{
|
||||
this.defaultSelectionFactory = defaultSelectionFactory;
|
||||
SelectedItem = defaultSelectionFactory.Invoke();
|
||||
}
|
||||
|
||||
if (source is INotifyCollectionChanged observableSource)
|
||||
{
|
||||
observableSource.CollectionChanged -= SourceCollectionChanged;
|
||||
@@ -193,6 +202,11 @@ public partial class ObservableCollection<TItem> :
|
||||
{
|
||||
Add(item);
|
||||
}
|
||||
|
||||
if (defaultSelectionFactory is not null)
|
||||
{
|
||||
SelectedItem = defaultSelectionFactory.Invoke();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -266,6 +280,8 @@ public partial class ObservableCollection<TItem> :
|
||||
|
||||
public void Reset(Action<ObservableCollection<TItem>> factory, bool disposeItems = true)
|
||||
{
|
||||
SelectedItem = default;
|
||||
|
||||
Clear(disposeItems);
|
||||
factory.Invoke(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user