private static void TestSimplebinding() { Console.WriteLine("Test simple binding"); DestinationOfData d = new DestinationOfData(); SourceOfData s = new SourceOfData(); DataBinder.AddCompiledBinding(s, "Prop1", d, "Prop1Dest"); Console.WriteLine("-> try set 123 on source"); s.Prop1 = 123; }
private static void TestSimplebindingWithconverter() { Console.WriteLine("test TestSimple binding with converter"); DestinationOfData d = new DestinationOfData(); SourceOfData s = new SourceOfData(); DataBinder.AddCompiledBinding(s, "Prop1", d, "Prop1DestDouble", new MyConverter()); DataBinder.AddCompiledBinding(s, "Prop1", d, "PropPoint", new MyConverter()); s.Prop1 = 1234; }
private static void TestBidirectionnelbinding() { Console.WriteLine("TestBidirectionnelbinding"); DestinationOfData d = new DestinationOfData(); SourceOfData s = new SourceOfData(); DataBinder.AddCompiledBinding(s, "Prop1", d, "Prop1Dest"); DataBinder.AddCompiledBinding(d, "Prop1Dest", s, "Prop1"); Console.WriteLine("-> try set 123 on source"); s.Prop1 = 123; Console.WriteLine("-> try set 456 on dest"); d.Prop1Dest = 456; }
private static void TestBidirectinnelbindingAndunreferenced() { GC.Collect(); GC.WaitForPendingFinalizers(); Console.WriteLine("TestBidirectinnelbindingAndunreferenced"); DestinationOfData d = new DestinationOfData(); SourceOfData s = new SourceOfData(); DataBinder.AddCompiledBinding(s, "Prop1", d, "Prop1Dest"); DataBinder.AddCompiledBinding(d, "Prop1Dest", s, "Prop1"); Console.WriteLine("-> try set 123 on source"); s.Prop1 = 123; Console.WriteLine("-> try set 456 on dest"); d.Prop1Dest = 456; Console.WriteLine("set destination to null"); d = null; GC.Collect(); GC.WaitForPendingFinalizers(); Console.WriteLine("-> now, try set 123 on source"); s.Prop1 = 123; }
private static void Dump(SourceOfData s) { Console.WriteLine("source Prop1 :" + s.Prop1); }