duplicate view model at confirmation fix
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -332,23 +332,29 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
private void Coins_CollectionGlobalChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ Dispatcher.UIThread.Post(() =>
{
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
- foreach (var c in e.NewItems.Cast<SmartCoin>())
+ foreach (var c in e.NewItems.Cast<SmartCoin>().Where(sc => sc.Unspent))
_rootlist.Add(new CoinViewModel(c));
break;
case NotifyCollectionChangedAction.Remove:
foreach (var c in e.OldItems.Cast<SmartCoin>())
- _rootlist.Remove(new CoinViewModel(c));
+ {
+ var toRemove = _rootlist.Items.First(cvm => cvm.Model == c);
+ _rootlist.Remove(toRemove);
+ }
break;
case NotifyCollectionChangedAction.Reset:
_rootlist.Clear();
break;
}
+ });
}
private void SetSelections()

duplicate view model at confirmation fix