public static void Main (string[] args) { ObservableArrayList arr = new ObservableArrayList(); ObservableFilterList filter = new ObservableFilterList (arr); filter.IsVisibleInFilter += new IsVisibleInFilterEvent(infilter); /* delegate(object aObject) { if (aObject is Named == false) return (false); return (((Named) aObject).Age > 15); };*/ filter.ElementAdded += delegate(object aList, int[] aIdx) { System.Console.WriteLine("Added({2}): {0} - {1}", aIdx.PathToString(), 0, 0);//filter.Count); }; filter.ElementChanged += delegate(object aList, int[] aIdx) { System.Console.WriteLine("Changed({2}): {0} - {1}", aIdx.PathToString(), 0, 0);//filter[aIdx], filter.Count); }; filter.ElementRemoved += delegate(object aList, int[] aIdx, object aObject) { System.Console.WriteLine("Removed({2}): {0} - {1}", aIdx.PathToString(), 0, 0);//filter[aIdx], filter.Count); }; filter.Add (new Named ("A", 13)); filter.Add (new Named ("B", 16)); filter.Add (new Named ("C", 12)); // System.Console.WriteLine("ItemCount={0}", arr.Count); System.Console.WriteLine("{0}:{1}",filter.Count, arr.Count); if (arr[0] is Named) System.Console.WriteLine("NAMED"); (arr[0] as Named).Age = 33; return; Application.Init (); MainWindow win = new MainWindow (); win.Show (); Application.Run (); }
public static void Main(string[] args) { ObservableArrayList arr = new ObservableArrayList(); ObservableFilterList filter = new ObservableFilterList(arr); filter.IsVisibleInFilter += new IsVisibleInFilterEvent(infilter); /* delegate(object aObject) { * if (aObject is Named == false) * return (false); * return (((Named) aObject).Age > 15); * };*/ filter.ElementAdded += delegate(object aList, int[] aIdx) { System.Console.WriteLine("Added({2}): {0} - {1}", aIdx.PathToString(), 0, 0); //filter.Count); }; filter.ElementChanged += delegate(object aList, int[] aIdx) { System.Console.WriteLine("Changed({2}): {0} - {1}", aIdx.PathToString(), 0, 0); //filter[aIdx], filter.Count); }; filter.ElementRemoved += delegate(object aList, int[] aIdx, object aObject) { System.Console.WriteLine("Removed({2}): {0} - {1}", aIdx.PathToString(), 0, 0); //filter[aIdx], filter.Count); }; filter.Add(new Named("A", 13)); filter.Add(new Named("B", 16)); filter.Add(new Named("C", 12)); // System.Console.WriteLine("ItemCount={0}", arr.Count); System.Console.WriteLine("{0}:{1}", filter.Count, arr.Count); if (arr[0] is Named) { System.Console.WriteLine("NAMED"); } (arr[0] as Named).Age = 33; return; Application.Init(); MainWindow win = new MainWindow(); win.Show(); Application.Run(); }