static void TestCreate() { Console.WriteLine("-"); Console.WriteLine(new StackFrame().GetMethod().Name); Console.WriteLine("-"); var root1 = UINode.CreateRoot("TestWindow", new UI.Entities.Rectangle()); var label = new Label("label text"); root1.AddChild(label); root1.Update(); }
static void TestCreate() { Console.WriteLine("-"); Console.WriteLine(new StackFrame().GetMethod().Name); Console.WriteLine("-"); var root1 = UINode.CreateRoot("TestWindow", new UI.Entities.Rectangle()); var button = new PushButton("click me"); root1.AddChild(button); root1.Update(); }
static void TestUpdate() { Console.WriteLine("-"); Console.WriteLine(new StackFrame().GetMethod().Name); Console.WriteLine("-"); var root = UINode.CreateRoot("TestWindow", new UI.Entities.Rectangle()); var node = new UINode(); var node1 = new UINode(); var node2 = new UINode(); root.AddChild(node); root.AddChild(node1); node1.AddChild(node2); node2.Update(); }
static void TestAddToRoot() { Console.WriteLine("-"); Console.WriteLine(new StackFrame().GetMethod().Name); Console.WriteLine("-"); var root = UINode.CreateRoot("TestWindow", new UI.Entities.Rectangle()); var node = new UINode(); var node1 = new UINode(); root.AddChild(node); root.AddChild(node1); root.AddChild(node); Console.WriteLine("Contains: {0}", root.Contains(node)); }
static void TestWithoutCallGC() { Console.WriteLine("-"); Console.WriteLine(new StackFrame().GetMethod().Name); Console.WriteLine("-"); var root = UINode.CreateRoot("New Root", new Rectangle(100, 100)); for (int i = 0; i < 10; i++) { root.AddChild(new UINode("node" + i)); } root = UINode.CreateRoot("New Root 2", new Rectangle(100, 100)); GC.Collect(); GC.WaitForPendingFinalizers(); }
static void TestNameConflicts() { Console.WriteLine("-"); Console.WriteLine(new StackFrame().GetMethod().Name); Console.WriteLine("-"); var root1 = UINode.CreateRoot("TestWindow", new UI.Entities.Rectangle()); var node = new UINode("n1"); var node1 = new UINode("n1"); var node2 = new UINode("n2"); root1.AddChild(node); root1.AddChild(node1); root1.AddChild(node2); Console.WriteLine("Nodes 'n1': {0}", String.Join(", ", root1["n1"])); Console.WriteLine("Nodes 'n2': {0}", String.Join(", ", root1["n2"])); }
static void TestSetParent() { Console.WriteLine("-"); Console.WriteLine(new StackFrame().GetMethod().Name); Console.WriteLine("-"); var root1 = UINode.CreateRoot("TestWindow", new UI.Entities.Rectangle()); var root2 = UINode.CreateRoot("TestWindow2", new UI.Entities.Rectangle()); var node = new UINode(); var node1 = new UINode(); var node2 = new UINode(); root1.AddChild(node); root1.AddChild(node1); node1.AddChild(node2); root2.AddChild(node1); node2.Update(); Console.WriteLine("Root 1 contains: {0}", root1.Contains(node1)); Console.WriteLine("Root 2 contains: {0}", root2.Contains(node1)); }