Fix exclusive for action keyword

This commit is contained in:
bao-qian
2015-11-07 03:50:26 +00:00
parent 8662e963ac
commit 7d52b0cc96
4 changed files with 86 additions and 25 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using Wox.Plugin;
namespace Wox.Helper
{
class ListBoxItems : ObservableCollection<Result>
{
public void RemoveAll(Predicate<Result> predicate)
{
CheckReentrancy();
List<Result> itemsToRemove = Items.Where(x => predicate(x)).ToList();
if (itemsToRemove.Count > 0)
{
itemsToRemove.ForEach(item => Items.Remove(item));
OnPropertyChanged(new PropertyChangedEventArgs("Count"));
OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
// fuck ms http://blogs.msdn.com/b/nathannesbit/archive/2009/04/20/addrange-and-observablecollection.aspx
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
}
}
}