コード例 #1
0
        static void testSerialize()
        {
            Separate();
            Console.WriteLine("                      Test Serialize");
            Separate();
            var root    = UINode.CreateRootNode(1000, 1000, "default style", "root");
            var subroot = new UINode("form");

            root.Add(subroot);
            subroot.Add(new UINode("1"));
            subroot.Add(new UINode("2"));
            Separate();
            Console.WriteLine("                      Start bin");
            Separate();
            root.Update();
            Separate();

            SerializeBin(root);
            DeserializeBin();
            Separate();
            Console.WriteLine("                      Start xml");
            Separate();
            SerializeXML(root);
            DeserializeXML();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: danylkaaa/OOPLabs
        static void testExceptions()
        {
            Separate();
            Console.WriteLine("                      Test Exceptions");
            Separate();

            Console.WriteLine("\n                Create new node and don't add it to root\n");
            UINode node1 = new UINode(10, 20, 0, 4, "Metalic", "node1");

            //UINode.UIRoot.Add(node1);
            Console.WriteLine("\n                 Create new node and render it\n");
            try
            {
                UINode node2 = new UINode(null, "node2");
                Console.WriteLine("\n                 Add node to another node\n");

                node1.Add(node2);
                node1.Update();
            }catch (NodeNotAddedToRootException e)
            {
                Console.WriteLine(e);
                if (e.CurrRoot != null && e.CurrNode != null)
                {
                    e.CurrRoot.Add(e.CurrNode);
                    e.CurrNode.Update();
                }
            }
            Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
        }
コード例 #3
0
        static void testUINode()
        {
            Separate();
            Console.WriteLine("                  Test UINode class");
            Separate();

            UINode node1 = new UINode(10, 20, 0, 4, "Metalic", "node1");

            Console.WriteLine("\n                Create new node and add it to root\n");
            UINode.UIRoot.Add(node1);
            Console.WriteLine("\n                 Create new node and render it\n");
            UINode node2 = new UINode(null, "node2");

            Console.WriteLine("\n                 Add node to another node\n");
            node1.Add(node2);
            Console.WriteLine("\n                 Add node to child\n");
            node2.Add(node1);
            Console.WriteLine("\n                 Add node to root\n");
            UINode.UIRoot.Add(node2);
            Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
        }