示例#1
0
        public void Initialize()
        {
            widgets.Clear();
            menu.AddBackground(this.widgets);
            menu.AddCaption(this, "Connect to IP");

            widgets.Add(new Widget()
            {
                BackgroundImage         = null,
                BackgroundImageSelected = null,
                Rect     = new RectangleF(200, 300, 400, 90),
                Text     = "Hash/Url: ",
                Click    = delegate { },
                FontSize = 20,
            });
            hashTextboxWidget = new Widget()
            {
                BackgroundImage         = menu.button4,
                BackgroundImageSelected = menu.button4sel,
                Rect      = new RectangleF(500, 300, 650, 90),
                Text      = gethashurl(),
                Click     = delegate { },
                FontSize  = 20,
                IsTextbox = true,
            };

            widgets.Add(hashTextboxWidget);

            /*
             * widgets.Add(new Widget()
             * {
             *  BackgroundImage = null,
             *  BackgroundImageSelected = null,
             *  Rect = new RectangleF(200, 450, 400, 90),
             *  Text = "Or",
             *  Click = delegate { },
             *  FontSize = 20,
             * });
             */
            widgets.Add(new Widget()
            {
                BackgroundImage         = null,
                BackgroundImageSelected = null,
                Rect     = new RectangleF(200, 600, 400, 90),
                Text     = "IP: ",
                Click    = delegate { },
                FontSize = 20,
            });
            ipTextboxWidget = new Widget()
            {
                BackgroundImage         = menu.button4,
                BackgroundImageSelected = menu.button4sel,
                Rect      = new RectangleF(500, 600, 600, 90),
                Text      = getip(),
                Click     = delegate { },
                FontSize  = 20,
                IsTextbox = true,
            };
            widgets.Add(ipTextboxWidget);
            widgets.Add(new Widget()
            {
                BackgroundImage         = null,
                BackgroundImageSelected = null,
                Rect     = new RectangleF(200, 700, 400, 90),
                Text     = "Port: ",
                Click    = delegate { },
                FontSize = 20,
            });
            portTextboxWidget = new Widget()
            {
                BackgroundImage         = menu.button4,
                BackgroundImageSelected = menu.button4sel,
                Rect      = new RectangleF(500, 700, 600, 90),
                Text      = getport(),
                Click     = delegate { },
                FontSize  = 20,
                IsTextbox = true,
                IsNumeric = true,
            };
            widgets.Add(portTextboxWidget);
            invalidHashWidget = new Widget()
            {
                BackgroundImage         = null,
                BackgroundImageSelected = null,
                Rect      = new RectangleF(1200, 300, 400, 90),
                Text      = "Invalid address.",
                Click     = delegate { },
                FontSize  = 20,
                TextColor = Color.Red,
            };
            widgets.Add(invalidHashWidget);
            invalidHostWidget = new Widget()
            {
                BackgroundImage         = null,
                BackgroundImageSelected = null,
                Rect      = new RectangleF(1200, 600, 400, 90),
                Text      = "Invalid address.",
                Click     = delegate { },
                FontSize  = 20,
                TextColor = Color.Red,
            };
            widgets.Add(invalidHostWidget);

            menu.AddOkCancel(this, delegate { Connect(); }, delegate { menu.currentForm = menu.d_FormJoinMultiplayer; });
        }