Ejemplo n.º 1
0
        static void testAnonimous()
        {
            Separate();
            Console.WriteLine("                      Test Anonimous methods");
            Separate();

            var root   = UINode.CreateRootNode(1000, 1000, "default style", "root");
            var button = new PushButton("pushButton1");

            root.Add(button);
            var counter = 0;

            button.OnClick += delegate(object sender, MouseEventArgs args)
            {
                Console.WriteLine("Pushed {0}", counter++);
            };
            button.OnRelease += delegate(object sender, MouseEventArgs args)
            {
                Console.WriteLine("Released {0}", counter++);
            };
            for (int i = 0; i < 3; i++)
            {
                button.Click();
                button.Release();
            }
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        static void testFunc()
        {
            Separate();
            Console.WriteLine("                      Test Func conditions");
            Separate();

            var root  = UINode.CreateRootNode(1000, 1000, "default style", "root");
            var input = new TextInput("input");

            root.Add(input);
            input.Validator = (args) => { return(args.isValid()); };
            input.onInput  += (object sender, InputEventArgs args) => { Console.WriteLine("Input: {0}", args); };
            input.input(new InputEventArgs("test_1", KeyboardKey.LALT | KeyboardKey.RALT | KeyboardKey.SPACE));
            input.input(new InputEventArgs("$test_2"));
        }
Ejemplo n.º 4
0
        static void testWidget()
        {
            Separate();
            Console.WriteLine("                  Test PushButton class");
            Separate();
            var root = UINode.CreateRootNode(1000, 600, null, "WINDOW");

            Console.WriteLine("\n                Create new widget and add it to root\n");
            Widget widget = new Widget(200, 300, 0, 0, null, "w1", "red circle", "orange square", "yellow triangle");

            root.Add(widget);
            Console.WriteLine("\n                Add new shape to widget\n");
            widget.addShape("green dot");

            Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++++++++++");
        }
Ejemplo n.º 5
0
        static void testForm()
        {
            Separate();
            Console.WriteLine("                      Test From");
            Separate();
            var root = UINode.CreateRootNode(1000, 1000, "default style", "root");
            var form = new Form("form");

            root.Add(form);
            form.Add(new CheckButton());
            form.Add(new TextInput());
            form.Add(new TextInput());
            form.Add(new TextInput());
            form.Add(new CheckButton());

            foreach (UINode node in form)
            {
                Console.WriteLine(node);
            }
        }
Ejemplo n.º 6
0
        static void testLambdaAction()
        {
            Separate();
            Console.WriteLine("                      Test Lambda conditions");
            Separate();

            var root   = UINode.CreateRootNode(1000, 1000, "default style", "root");
            var button = new CheckButton("checkButton1");

            root.Add(button);
            var counter = 0;

            button.OnClick += (object sender, MouseEventArgs args) =>
            {
                Console.WriteLine("Pushed {0}, {1}", counter++, args);
            };
            for (int i = 0; i < 3; i++)
            {
                button.Click(new MouseEventArgs(0, 0, MouseButton.LEFT, KeyboardKey.LALT | KeyboardKey.RALT | KeyboardKey.SPACE));
            }
        }