Example #1
0
        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;
        }
Example #2
0
        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;
        }
Example #3
0
        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;
        }
Example #4
0
        private static void TestPropertyPathBinding()
        {
            Console.WriteLine("test binding property 'A.B.C.Prop1' of source in Prop1DestDouble of destination");
            HierarchicalData  source = new HierarchicalData();
            DestinationOfData d      = new DestinationOfData();

            DataBinder.AddCompiledBinding(source, "A.B.C.Prop1", d, "Prop1Dest");


            Console.WriteLine("try to changed A");
            source.A.B.C.Prop1 = 777;
            HierarchicalDataA A = source.A;

            source.A = new HierarchicalDataA("pgo");
            Console.WriteLine("try to changed A.B.C.Prop1");
            source.A.B.C.Prop1 = 789;
            source.A           = null;
            A.B.C.Prop1        = 789;
        }
Example #5
0
        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;
        }
Example #6
0
 private static void Dump(DestinationOfData d)
 {
     Console.WriteLine("destination DestProp1 :" + d.Prop1Dest);
 }