Beispiel #1
0
        // TODO: checkSW
        private static Window CreateWindow9_4(string path)
        {
            var window = new Window("window9_4", Path.Combine(path, @"generic/bg.raw"));

            window.AddChild(new RawButton("window9_home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window1")
            });

            window.AddChild(new TextArea("window9_4_text1", null, 55, 150, 370)
            {
                Text = "Вы используете сертфицированную версию ПО", Size = 16, Color = new Color {
                    R = 1.0f, G = 1.0f, B = 1.0f
                }
            });
            window.AddChild(new TextArea("window9_4_text1", null, 55, 130, 370)
            {
                Text = "Хэш-код: 343543-3453453-34512", Size = 16, Color = new Color {
                    R = 1.0f, G = 1.0f, B = 1.0f
                }
            });
            window.AddChild(new ImageLabel("", Path.Combine(path, @"9/4/image_check.raw"), 15, 130));

            window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_back.raw"), Path.Combine(path, "9/2/bt_back_pr.raw"), 20, 5)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window9_1")
            });

            return(window);
        }
Beispiel #2
0
        void InitControls()
        {
            // Create a CheckBox
            CheckBox checkBox = new CheckBox();

            checkBox.Name = "CheckBox";

            // Create a Button
            Button button = new Button();

            button.Name      = "Button";
            button.MinHeight = 24;

            // Create a LineEdit
            LineEdit lineEdit = new LineEdit();

            lineEdit.Name      = "LineEdit";
            lineEdit.MinHeight = 24;

            // Add controls to Window
            window.AddChild(checkBox);
            window.AddChild(button);
            window.AddChild(lineEdit);

            // Apply previously set default style
            checkBox.SetStyleAuto(null);
            button.SetStyleAuto(null);
            lineEdit.SetStyleAuto(null);
        }
        private void Open()
        {
            for (int i = 0; i < _window.NumChildren; i++)
            {
                _window[i].Interactive = false;
            }

            _window.AddChild(_canvas);
            _window.AddChild(_msgBox);
            _window.Invalidate();

            GlideTouch.IgnoreAllEvents = true;

            IsOpen = true;
        }
Beispiel #4
0
        public void Start()
        {
            miniMapTexture = new Texture2D(2, 2);
            var finalMap = Properties.Resources.FinalFinalMap_Clipped;

            ImageConversion.LoadImage(miniMapTexture, finalMap);

            patchWindow          = new Window();
            patchWindow.Text     = "Patches";
            patchWindow.Size     = new Vector2(300, 300);
            patchWindow.Position = mainWindowRect.position + mainWindowRect.size;
            patchWindow.DragSize = patchWindow.Size;

            var layout = new LinearLayout();

            layout.SizeMode = Control.eSizeMode.Manual;
            layout.Position = new Vector2(4, 20);
            layout.Size     = patchWindow.Size - layout.Position;
            layout.AddChild(CreatePatchButton("NoShake", NoShake.Active, () => NoShake.Active, (v) => NoShake.Active                 = NoShake2.Active = NoShake3.Active = v));
            layout.AddChild(CreatePatchButton("NoStun", NoStun.Active, () => NoStun.Active, (v) => NoStun.Active                     = v));
            layout.AddChild(CreatePatchButton("NoRecoil", NoRecoil.Active, () => NoRecoil.Active, (v) => NoRecoil.Active             = v));
            layout.AddChild(CreatePatchButton("NoSpread", ShootPatch.NoSpread, () => ShootPatch.NoSpread, (v) => ShootPatch.NoSpread = v));
            layout.AddChild(CreatePatchButton("InfiniteAmmo", ShootPatch.InfiniteAmmo, () => ShootPatch.InfiniteAmmo, (v) => ShootPatch.InfiniteAmmo = v));
            layout.AddChild(CreatePatchButton("InstantFire", ShootPatch.InstantFire, () => ShootPatch.InstantFire, (v) => ShootPatch.InstantFire     = v));
            layout.AddChild(CreatePatchButton("FullAuto", ShootPatch.AutoFire, () => ShootPatch.AutoFire, (v) => ShootPatch.AutoFire  = v));
            layout.AddChild(CreatePatchButton("InstantMelee", AttackPatch.Active, () => AttackPatch.Active, (v) => AttackPatch.Active = v));
            layout.AddChild(CreatePatchButton("TazeArea", false, () => Loader.HaxInstance.TazeAllAroundMe, (v) => Loader.HaxInstance.TazeAllAroundMe          = v));
            layout.AddChild(CreatePatchButton("TazeLooking", false, () => Loader.HaxInstance.TazeAllLookingAtMe, (v) => Loader.HaxInstance.TazeAllLookingAtMe = v));
            patchWindow.AddChild(layout);
            layout.ReorderChildren();
        }
Beispiel #5
0
        /// <summary>
        /// Inits the game debug window.
        /// </summary>
        public void InitGameDebugWindow()
        {
            // Remove Focus or game will think pause menu is open
            UI.SetFocusElement(null);

            // Create the Window and add it to the UI's root node
            var window = new Window();

            UI.Root.AddChild(window);

            // Set Window size and layout settings
            window.SetPosition(-150, -50);
            window.SetAlignment(HorizontalAlignment.Right, VerticalAlignment.Center);
            window.SetSize(550, 150);
            window.SetColor(new Color(0.2f, 0.2f, 0.2f, 0.5f));
            window.Name = "WindowDebug";

            // Create the Window title Text
            backWheelSpeedText = new Text {
                Name          = "back_wheel_speed",
                Value         = "0.0",
                TextAlignment = HorizontalAlignment.Right
            };

            backWheelSpeedText.SetFont("Fonts/Anonymous Pro.ttf", 20);
            backWheelSpeedText.SetColor(Color.Green);
            backWheelSpeedText.SetAlignment(HorizontalAlignment.Right, VerticalAlignment.Center);

            // Add the title bar to the Window
            window.AddChild(backWheelSpeedText);

            // Apply styles
            window.SetStyleAuto(null);
            backWheelSpeedText.SetStyleAuto(null);
        }
        public Window CreateWindow(string type, string name, Window parent)
        {
            // 如果窗口类没有注册则抛出异常
            if (!registedWindowTypes.ContainsKey(type))
            {
                throw new UnknownObjectException("Window type '{0}' is not currently loaded.", type);
            }

            // 如果窗口已经存在
            if (IsWindowPresent(name))
            {
                throw new BaseGUIException("A window with the name '{0}' already exists.", name);
            }

            // grab the assembly which hosts this type
            Assembly assembly = registedWindowTypes[type];

            // create an instance of the window and initialize it
            Window window = (Window)assembly.CreateInstance(type, true, 0, null, new object[] { name }, null, null);

            if (parent != null)
            {
                parent.AddChild(window);
            }

            // return the newly created window
            return(window);
        }
Beispiel #7
0
        public bool OpenWindow(WindowName windowName)
        {
            UIMedia createCommand = GetCreateCommand(windowName.Key);

            if (createCommand != null)
            {
                GComponent component = createCommand.Inject();

                if (component != null)
                {
                    if (lastWindow != null && lastWindowContent != null && lastDispose != null)
                    {
                        if (lastDispose.Disposable)
                        {
                            lastWindowContent.Dispose();
                        }
                    }

                    if (lastWindow == null)
                    {
                        lastWindow       = new Window();
                        lastWindow.name  = "ModalWindow";
                        lastWindow.modal = true;
                    }

                    lastDispose = component as UIMdeiaDispose;

                    lastWindowContent = component;
                    lastWindow.AddChild(component);
                    lastWindow.Show();
                    return(true);
                }
            }
            return(false);
        }
Beispiel #8
0
        // Экран с настройками
        private static Window CreateWindow9_1(string path)
        {
            var window = new Window("window9_1", Path.Combine(path, @"generic/bg.raw"));

            window.AddChild(new RawButton("window9_home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window1")
            });


            window.AddChild(new RawButton("", Path.Combine(path, @"9/1/bt_datetime.raw"), Path.Combine(path, @"9/1/bt_datetime_pr.raw"), 146, 160)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window9_3")
            });


            window.AddChild(new RawButton("", Path.Combine(path, @"9/1/bt_checkSW.raw"), Path.Combine(path, @"9/1/bt_checkSW_pr.raw"), 146 /*20*/, 5)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window9_4")
            });

            /*
             * window.AddChild(new RawButton("", Path.Combine(path, @"RawButtons/bt_editor.raw"), Path.Combine(path, @"RawButtons/bt_editor_pr.raw"), 146, 83)
             * {
             *  OnRelease = () =>
             *                  {
             *                      mKeyboardWindow.ReturnWindow = "window9_1";
             *                      mKeyboardWindow.OnEnter = returnText =>
             *                      {
             *                          if (!string.IsNullOrWhiteSpace(returnText))
             *                          {
             *                              mKeyboardWindow.ReturnWindow = null;
             *                              mApplication.SetFocusedWindow(returnText == "1234" ? "window_loading" : "window1");
             *                              mMeasureController.LoadEditor();
             *                          }
             *                      };
             *
             *                      mApplication.SetFocusedWindow("keyboard_window");
             *                  }
             * });
             */

            return(window);
        }
Beispiel #9
0
        private static Window CreateWindow1(string path)
        {
            var window = new Window("window1", Path.Combine(path, @"generic/bg.raw"));

            window.AddChild(new RawButton("window1_RawButton_setting", Path.Combine(path, @"1/btn_settings.raw"),
                                          Path.Combine(path, @"1/btn_settings_press.raw"), 25, ToVgY(220))
            {
                OnRelease = () => mApplication.SetFocusedWindow("window9_1")
            });
            window.AddChild(new RawButton("window1_RawButton_analys", Path.Combine(path, @"1/btn_analys.raw"), Path.Combine(path, @"1/btn_analys_press.raw"),
                                          215, ToVgY(138))
            {
                OnRelease = () =>
                {
                    var rv = mApplication.GetWindows().First(w => w.Name == "window2") as Window;

                    if (rv == null)
                    {
                        return;
                    }

                    rv.OnShow();
                    mApplication.SetFocusedWindow(rv);
                }
            });
            window.AddChild(new RawButton("window1_RawButton_setting", Path.Combine(path, @"1/btn_archive.raw"), Path.Combine(path, @"1/btn_archive_press.raw"),
                                          215, ToVgY(250))
            {
                OnRelease = () =>
                {
                    var rv = mApplication.GetWindows().First(w => w.Name == "window10_1") as Window;
                    if (rv == null)
                    {
                        return;
                    }

                    rv.OnShow();
                    mApplication.SetFocusedWindow(rv);
                }
            });

            return(window);
        }
        protected void NGUIRenderControl_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            try
            {
                Point     pt             = this.PointToClient(new Point(e.X, e.Y));
                Vector2   DropPosition   = new Vector2(pt.X, pt.Y);
                GUISystem guiSystem      = GUISystem.Instance;
                Vector2   screenPosition = guiSystem.ClientToScreen(new Vector2(pt.X, pt.Y));

                if (e.Data.GetDataPresent(typeof(NFileEntity)))
                {
                    NFileEntity entity = (NFileEntity)e.Data.GetData(typeof(NFileEntity));
                    m_owner.CreateStyleWindow(entity, screenPosition);
                }
                else
                {
                    //获得进行"Drag"操作中拖动的字符串
                    string controlType = e.Data.GetData(typeof(string)) as string;

                    // 在拖放的位置创建窗口
                    if (!WindowManager.Instance.IsTypeRegedited(controlType))
                    {
                        return;
                    }

                    Window parentWnd = guiSystem.GetTargetWindow(screenPosition);
                    if (parentWnd == null)
                    {
                        parentWnd = guiSystem.RootWindow;
                    }

                    Window wnd = WindowManager.Instance.CreateWindow(controlType, parentWnd);
                    wnd.AbsolutePosition = screenPosition;
                    if (wnd.AbsoluteSize.Length() == 0)
                    {
                        wnd.Width  = new UIDim(0, 150);
                        wnd.Height = new UIDim(0, 100);
                    }
                    parentWnd.AddChild(wnd);

                    // 发送响应事件
                    if (WindowCreated != null)
                    {
                        UIECreateWindowEventArg createEvent = new UIECreateWindowEventArg(wnd);
                        WindowCreated(this, createEvent);
                    }
                }
            }
            catch (System.Exception ex)
            {
                NexusEditor.Program.ShowException(ex, "Drag drop failed!");
            }
        }
        private void InitMenu(ResourceCache cache)
        {
            windowMenu = new Window();
            windowMenu.SetMinSize(Application.Graphics.Width / 2, Application.Graphics.Height / 4);
            windowMenu.SetLayout(LayoutMode.Vertical, 6, new IntRect(6, 6, 6, 6));
            windowMenu.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Bottom);
            XmlFile defaultUIStyle = cache.GetXmlFile(Assets.UI.DefaultStyle);

            windowMenu.SetStyleAuto(null);
            // Set the loaded style as default style
            windowMenu.SetDefaultStyle(defaultUIStyle);

            var buttonStart = new Button();

            textBlock       = new Text();
            textBlock.Value = "Start";
            textBlock.SetFont(cache.GetFont(Assets.Fonts.Font), Application.Graphics.Width / 15);

            textBlock.HorizontalAlignment = HorizontalAlignment.Center;
            textBlock.VerticalAlignment   = VerticalAlignment.Center;
            buttonStart.AddChild(textBlock);
            buttonStart.SubscribeToReleased(_ => Start());

            //settings
            var buttonSettings    = new Button();
            var textBlockSettings = new Text();

            textBlockSettings.Value = "Settings";
            textBlockSettings.SetFont(cache.GetFont(Assets.Fonts.Font), Application.Graphics.Width / 15);
            textBlockSettings.HorizontalAlignment = HorizontalAlignment.Center;
            textBlockSettings.VerticalAlignment   = VerticalAlignment.Center;
            buttonSettings.AddChild(textBlockSettings);
            buttonSettings.SubscribeToReleased(_ => ShowSettings());

            windowMenu.AddChild(buttonStart);
            windowMenu.AddChild(buttonSettings);
            buttonStart.SetStyleAuto(null);
            buttonSettings.SetStyleAuto(null);
            Application.UI.Root.AddChild(windowMenu);
        }
Beispiel #12
0
        protected override void LoadContent()
        {
            // TODO: use this.Content to load your game content here eg.

            w = new DecoratedWindow();
            //w.Size=new Vector2<float>(600,200);
            w.LocalPosition = new Vector2 <float> (50, 50);
            //w.Insets = defaultWindowState.Insets;
            Label l = new Label("BigFont", "Drag Me", new Vector3 <byte>(255, 0, 255));

            l.LocalPosition = new Vector2 <float> (0, 0);
            w.AddChild(l);
            l.MouseDragListeners += delegate(GuiComponent c, Vector2 <float> mouseDelta) {
                Console.WriteLine("Mouse drag: " + mouseDelta);
                c.LocalPosition += mouseDelta;
            };
            w2               = new Window();
            w2.Size          = new Vector2 <float>(200, 200);
            w2.LocalPosition = new Vector2 <float>(200, 200);
            ButtonBar buttonBar = new ButtonBar(new string[] { "Show Window", "PopUp" },
                                                new Action <string>[] { DoShow, ShowPopUp });

            w2.AddChild(buttonBar);
            w2.AllLoaded += delegate(GuiComponent obj) {
                w2.Pack();
            };
            popup = new Window();
            ButtonBar popupButtons = new ButtonBar(new String[] { "A button", "Another button", "Close" }
                                                   , new Action <string>[] { DoPop, DoPop, DoPop });

            popupButtons.Vertical = true;
            popup.AddChild(popupButtons);
            popup.AllLoaded += delegate(GuiComponent obj) {
                popup.Pack();
                popup.Enabled = false;                 // hide
            };
            scrollWindow        = new DecoratedWindow();
            scrollWindow.Layout = new GridLayoutManager(1, 1);
            ScrollPanel scrollpanel = new ScrollPanel();

            scrollWindow.AddChild(scrollpanel);
            scrollpanel.Layout = new HorizontalLayout();
            ImagePanel imgPanel = new ImagePanel("Thumbnails", 0, 7);

            scrollpanel.AddChild(imgPanel);
            scrollWindow.AllLoaded += delegate(GuiComponent obj) {
                scrollWindow.Pack();
                scrollWindow.Size = new Vector2 <float>(250, scrollWindow.Size.Y);
            };
            scrollpanel.ContentContainerDrag = new Vector3 <float>(1.0f, float.MaxValue, float.MaxValue);
        }
Beispiel #13
0
        /// <summary>
        /// Loads a Window from XML bytes.
        /// </summary>
        /// <param name="xmlBytes">XML bytes.</param>
        /// <returns>Window object.</returns>
        public static Window LoadWindow(byte[] xmlBytes)
        {
            XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();

            xmlReaderSettings.IgnoreComments = true;
            xmlReaderSettings.IgnoreProcessingInstructions = true;
            xmlReaderSettings.IgnoreWhitespace             = true;

            MemoryStream stream = new MemoryStream(xmlBytes);

            XmlReader reader = XmlReader.Create(stream, xmlReaderSettings);


            if (!reader.ReadToDescendant("Glide"))
            {
                throw new ArgumentException("Glide not detected.");
            }

            stream.Seek(0, SeekOrigin.Begin);
            reader = XmlReader.Create(stream, xmlReaderSettings);

            if (!reader.ReadToDescendant("Window"))
            {
                throw new ArgumentException("XML does not contain a Window element.");
            }

            _window = ParseWindow(reader);

            DisplayObject component;

            while (reader.Read() && !(reader.NodeType == XmlNodeType.EndElement && reader.Name == "Window"))
            {
                component = GetComponent(reader);

                if (component != null)
                {
                    _window.AddChild(component);
                }
                else
                {
                    throw new Exception(reader.Name + " is not a valid UI component.");
                }
            }

            reader.Close();

            _window.Render();

            return(_window);
        }
Beispiel #14
0
        private static IWidget CreateWindow3(string path)
        {
            var window = new Window("window3", Path.Combine(path, @"generic/bg.raw"));

            window.AddChild(new TextArea("", null, 60, 170, 450)
            {
                Text = "             Нанесите гель на электроды,", Size = 16, Color = new Color {
                    R = 1.0f, B = 1.0f, G = 1.0f
                }
            });
            window.AddChild(new TextArea("", null, 60, 150, 450)
            {
                Text = "             нажмите \"Далее\", после чего", Size = 16, Color = new Color {
                    R = 1.0f, B = 1.0f, G = 1.0f
                }
            });
            window.AddChild(new TextArea("", null, 60, 130, 450)
            {
                Text = "приложите электроды с гелем к коже пациента.", Size = 16, Color = new Color {
                    R = 1.0f, B = 1.0f, G = 1.0f
                }
            });


            window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_back.raw"), Path.Combine(path, "RawButtons/bt_back_pr.raw"), 5, 5)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window2")
            });

            window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_onwards.raw"), Path.Combine(path, "RawButtons/bt_onwards_pr.raw"), 350, 5)
            {
                OnRelease = () => mMeasureController.StartSampleMeasure()
            });

            return(window);
        }
Beispiel #15
0
        // DateTime
        private static Window CreateWindow9_3(string path)
        {
            var window = new Window("window9_3", Path.Combine(path, @"generic/bg.raw"));

            window.AddChild(new RawButton("window9_home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window1")
            });

            window.AddChild(new TextArea("window9_3_text1", null, 75, 205, 330)
            {
                Text = "Настройка времени и даты", Size = 26, Color = new Color {
                    R = 1.0f, G = 1.0f, B = 1.0f
                }
            });

            var clockset = new ClockSet("", path, 0, 120);

            window.AddChild(clockset);

            window.AddChild(new RawButton("", Path.Combine(path, "9/3/bt_back.raw"), Path.Combine(path, "9/3/bt_back_pr.raw"), 20, 5)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window9_1")
            });

            window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_accept.raw"), Path.Combine(path, "RawButtons/bt_accept_pr.raw"), 350, 5)
            {
                OnRelease = () =>
                {
                    clockset.SetSystemTime();
                    mApplication.SetFocusedWindow("window9_1");
                }
            });

            return(window);
        }
        void InitMainContainer()
        {
            var screenRect = canvas.WinRect;

            canvas.OffsetMin.X = -300;
            canvas.OffsetMin.Y = -100;
            canvas.OffsetMax.X = 300;
            canvas.OffsetMax.Y = 150;

            int   x     = 120;
            int   y     = 110;
            int   w     = 200;
            int   w2    = 320;
            int   h     = 34;
            int   g     = 4;
            var   items = 13;
            int   h1    = h * items + g * (items - 1);
            float scale = 0.6f;

            var container = new Window(null, x, y, w + 1 + w2, h1)
            {
                Name = "mainContainer"
            };

            container.Colors = Window.TransparentColorProfile;
            canvas.AddChild(container);

            Window  win;
            TextBox tbox;

            x          = y = 0;
            win        = tbox = new TextBox("Vehicle:", x, y, w, h, scale);
            win.Colors = Colors.LabelColors;
            container.AddChild(win);
            win        = tbox = new TextBox("Some Car", x + w + 1, y, w2, h, scale);
            win.Colors = Colors.ButtonColors;
            container.AddChild(win);
            y += h + g;

            win        = tbox = new TextBox("Type:", x, y, w, h, scale);
            win.Colors = Colors.LabelColors;
            container.AddChild(win);
            win        = tbox = new TextBox("Some Type", x + w + 1, y, w2, h, scale);
            win.Colors = Colors.ButtonColors;
            container.AddChild(win);
            y += h + g;

            win        = tbox = new TextBox("Etc:", x, y, w, h, scale);
            win.Colors = Colors.LabelColors;
            container.AddChild(win);
            win        = tbox = new TextBox("Etc", x + w + 1, y, w2, h, scale);
            win.Colors = Colors.ButtonColors;
            container.AddChild(win);
            y += h + g;
        }
Beispiel #17
0
        public static Button AddButton(this Window Wnd, Vector2 Pos, Vector2 Size, string Text, OnButtonClickFunc OnClick = null)
        {
            Button Btn = new Button(Wnd.GUI);

            Btn.Position = Pos;
            Btn.Size     = Size;
            Btn.Text     = Text;

            if (OnClick != null)
            {
                Btn.OnClick += OnClick;
            }

            Wnd.AddChild(Btn);
            return(Btn);
        }
Beispiel #18
0
        void InitWindow()
        {
            // Create the Window and add it to the UI's root node
            window = new Window();
            uiRoot.AddChild(window);

            // Set Window size and layout settings
            window.SetMinSize(384, 192);
            window.SetLayout(LayoutMode.Vertical, 6, new IntRect(6, 6, 6, 6));
            window.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center);
            window.Name = "Window";

            // Create Window 'titlebar' container
            UIElement titleBar = new UIElement();

            titleBar.SetMinSize(0, 24);
            titleBar.VerticalAlignment = VerticalAlignment.Top;
            titleBar.LayoutMode        = LayoutMode.Horizontal;

            // Create the Window title Text
            var windowTitle = new Text();

            windowTitle.Name  = "WindowTitle";
            windowTitle.Value = "Hello GUI!";

            // Create the Window's close button
            Button buttonClose = new Button();

            buttonClose.Name = "CloseButton";

            // Add the controls to the title bar
            titleBar.AddChild(windowTitle);
            titleBar.AddChild(buttonClose);

            // Add the title bar to the Window
            window.AddChild(titleBar);

            // Apply styles
            window.SetStyleAuto(null);
            windowTitle.SetStyleAuto(null);
            buttonClose.SetStyle("CloseButton", null);

            buttonClose.SubscribeToReleased(_ => Engine.Exit());

            // Subscribe also to all UI mouse clicks just to see where we have clicked
            UI.SubscribeToUIMouseClick(HandleControlClicked);
        }
        void InitWindow()
        {
            // Create the Window and add it to the UI's root node
            window = new Window();
            this.AddChild(window);

            // Set Window size and layout settings
            window.SetMinSize(application.Graphics.Width - 30, application.Graphics.Height / 2);
            window.SetLayout(LayoutMode.Vertical, 6, new IntRect(6, 6, 6, 6));
            window.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center);
            window.Name = "Window";

            // Create Window 'titlebar' container
            UIElement titleBar = new UIElement();

            titleBar.SetMinSize(0, 24);
            titleBar.VerticalAlignment = VerticalAlignment.Top;
            titleBar.LayoutMode        = LayoutMode.Horizontal;

            // Create the Window title Text
            var windowTitle = new Text();

            windowTitle.Name  = "WindowTitle";
            windowTitle.Value = "Ethereum Settings";

            // Create the Window's close button
            Button buttonClose = new Button();

            buttonClose.Name = "CloseButton";

            // Add the controls to the title bar
            titleBar.AddChild(windowTitle);
            titleBar.AddChild(buttonClose);

            // Add the title bar to the Window
            window.AddChild(titleBar);

            // Apply styles
            window.SetStyleAuto(null);
            windowTitle.SetStyleAuto(null);
            buttonClose.SetStyle("CloseButton", null);

            windowTitle.SetFont(application.ResourceCache.GetFont(Assets.Fonts.Font), application.Graphics.Width / 30);

            buttonClose.SubscribeToReleased(_ => this.Visible = false);
        }
Beispiel #20
0
        /// <summary>
        /// Creates an email setup window.
        /// </summary>
        /// <param name="_emailDevice">A device with email capabiilities.</param>
        public EmailWindow(ConnectOneDevice _emailDevice)
        {
            Glide.FitToScreen = true;
            // Tell Glide to use our custom keyboard.
            Glide.Keyboard = InitKeyboard();

            //load the window graphics
            this.emailWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.wndEmail));

            TextBox txtBoxEmailSetup = (TextBox)emailWindow.GetChildByName("txtBoxEmailSetup");

            txtBoxEmailSetup.TapEvent += new OnTap(Glide.OpenKeyboard);

            Button btnEnter = (Button)emailWindow.GetChildByName("btnEnter");

            btnEnter.TapEvent += new OnTap(btnEnter_TapEvent);

            Button btnExit = (Button)emailWindow.GetChildByName("btnExit");

            btnExit.TapEvent += new OnTap(btnExit_TapEvent);

            emailDevice = _emailDevice;

            #region Mailbox Datagrid Initialize

            // Setup the dataGrid reference.
            dGridMailbox = (DataGrid)emailWindow.GetChildByName("dGridMailbox");

            // Listen for tap cell events.
            dGridMailbox.TapCellEvent += new OnTapCell(dGridMailbox_TapCellEvent);

            // Create columns in data grid.
            dGridMailbox.AddColumn(new DataGridColumn("        MAILBOX", 125));
            dGridMailbox.AddColumn(new DataGridColumn("SETUP", 185));

            // Populate the data grid with data.
            PopulateMailbox(false);

            // Add the data grid to the window before rendering it.
            emailWindow.AddChild(dGridMailbox);
            dGridMailbox.Render();

            #endregion
        }
Beispiel #21
0
        private void treeViewControls_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                TreeNode SrcNode;
                if (e.Data.GetDataPresent(typeof(TreeNode)))
                {
                    SrcNode = e.Data.GetData("System.Windows.Forms.TreeNode") as TreeNode;
                    Window SrcWnd = SrcNode.Tag as Window;
                    // 根窗口不允许移动
                    if (SrcWnd.Parent == null)
                    {
                        return;
                    }

                    Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));

                    TreeNode DestNode = ((TreeView)sender).GetNodeAt(pt);
                    Window   DestWnd  = DestNode.Tag as Window;

                    if (SrcWnd == DestWnd)
                    {
                        return;
                    }

                    // 修改窗口的父窗口
                    SrcWnd.Parent.RemoveChild(SrcWnd);
                    DestWnd.AddChild(SrcWnd);

                    DestNode.Nodes.Add((TreeNode)SrcNode.Clone());

                    DestNode.Expand();

                    //删除已经移动的节点
                    SrcNode.Remove();
                }
            }
            catch (System.Exception ex)
            {
                NexusEditor.Program.ShowException(ex, "Controls tree drag drop faild !");
            }
        }
Beispiel #22
0
        void InitWindow()
        {
            // Create the Window and add it to the UI's root node
            window = new Window();
            uiRoot.AddChild(window);
            // Set Window size and layout settings
            window.SetPosition(184, 68);
            window.SetSize(78, 40);
            window.SetColor(Color.Transparent);
            //window.SetLayout(LayoutMode.Horizontal, 0, new IntRect(3, 3, 3, 3));
            window.SetAlignment(HorizontalAlignment.Left, VerticalAlignment.Top);
            window.Name = "Window";

            // Create Window 'titlebar' container
            UIElement titleBar = new UIElement();

            titleBar.SetAlignment(HorizontalAlignment.Right, VerticalAlignment.Center);
            //titleBar.SetLayout(LayoutMode.Horizontal, 0, new IntRect(0, 0, 0, 0));

            // Create the Window title Text
            var windowTitle = new Text {
                Name          = "WindowCoins",
                Value         = "9999",
                TextAlignment = HorizontalAlignment.Right
            };

            windowTitle.SetFont("Fonts/Anonymous Pro.ttf", 20);
            windowTitle.SetAlignment(HorizontalAlignment.Right, VerticalAlignment.Center);

            // Add the controls to the title bar
            titleBar.AddChild(windowTitle);

            // Add the title bar to the Window
            window.AddChild(titleBar);

            // Apply styles
            window.SetStyleAuto(null);
            windowTitle.SetStyleAuto(null);

            /////////
            CreateUserControls();
        }
        /// <summary>
        /// Create an instance of this widget component adding it as a child to
        /// the given Window.
        /// </summary>
        /// <param name="parent"></param>
        public void Create(Window parent)
        {
            Window widget = WindowManager.GetSingleton().CreateWindow(_baseType, _name);

            widget.SetAutoWindow(_autoWindow);

            // set the window renderer
            if (!String.IsNullOrEmpty(_rendererType))
            {
                widget.SetWindowRenderer(_rendererType);
            }

            // set the widget look
            if (!String.IsNullOrEmpty(_imageryName))
            {
                widget.SetLookNFeel(_imageryName);
            }

            // add the new widget to its parent
            parent.AddChild(widget);

            // set alignment options
            widget.SetVerticalAlignment(_vertAlign);
            widget.SetHorizontalAlignment(_horzAlign);

            // TODO: We still need code to specify position and size.  Due to the advanced
            // TODO: possibilities, this is better handled via a 'layout' method instead of
            // TODO: setting this once and forgetting about it.

            // initialise properties.  This is done last so that these properties can
            // override properties specified in the look assigned to the created widget.
            foreach (var property in _properties)
            {
                property.Apply(widget);
            }

            // link up the event actions
            foreach (var eventAction in _eventActions)
            {
                eventAction.InitialiseWidget(widget);
            }
        }
Beispiel #24
0
        public bool AddMainMenu(WindowName windowName)
        {
            UIMedia createCommand = GetCreateCommand(windowName.Key);

            if (createCommand != null)
            {
                GComponent component = createCommand.Inject();
                if (component != null)
                {
                    if (MainMenuWindow == null)
                    {
                        MainMenuWindow      = new Window();
                        MainMenuWindow.name = "MainMenuWindow";
                    }
                    MainMenuWindow.AddChild(component);
                    MainMenuWindow.Show();
                    return(true);
                }
            }
            return(false);
        }
Beispiel #25
0
        private void startcamera(Window w) //初始化相机动画
        {
            w.Width  = 300;
            w.Height = 100;
            w.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            w.ResizeMode            = ResizeMode.NoResize;
            w.WindowStyle           = WindowStyle.None;
            var bc = new BrushConverter();

            w.Background = (Brush)bc.ConvertFrom("#8B5F65");
            System.Windows.Controls.Label BT = new System.Windows.Controls.Label();
            BT.Content    = "正在初始化相机,请稍后.......................";
            BT.Foreground = Brushes.White;
            BT.FontSize   = 15; BT.FontWeight = FontWeights.Bold;
            BT.Margin     = new Thickness(0, 30, 0, 0);

            System.Windows.Controls.Grid    panel     = new System.Windows.Controls.Grid();
            System.Windows.Markup.IAddChild container = panel;
            container.AddChild(BT);
            container = w;
            container.AddChild(panel);
            w.Show();
        }
Beispiel #26
0
        // Executors
        private static Window GetLoadingWindow(string path)
        {
            var window = new Window("window_loading", Path.Combine(path, @"generic/bg.raw"));

            var progressBar = new ProgressBarImages("bar", path, 80, 100)
            {
                Percent   = 0,
                Text      = "Идет загрузка редактора методик",
                TextColor = { B = 1, R = 1, G = 1 }
            };

            window.AddChild(progressBar);

            mMeasureController.SetProgresbarData = (percent, message) =>
            {
                progressBar.Percent = (uint)percent;

                progressBar.Text = message;

                window.Invalidate();
            };

            return(window);
        }
Beispiel #27
0
        // Initializes main window buttons
        static void initMainWindow(Window window)
        {
            //Image imgLogo = (Image)window.GetChildByName("imgLogo");
            //imgLogo.Bitmap = Resources.GetBitmap(Resources.BitmapResources.Stinkmeaner_Thumb);

            // Create a Canvas
            GHI.Glide.UI.Canvas canvas = new GHI.Glide.UI.Canvas();
            window.AddChild(canvas);

            // Draw a separator line.
            //canvas.DrawLine(GHI.Glide.Colors.White, 1, 30, 50, window.Width - 30, 50);

            // Draw a fieldset around our "Login" text block.
            _txtTitle           = (TextBlock)window.GetChildByName("txtTitle");
            _txtTitle.FontColor = GHI.Glide.Colors.White;
            canvas.DrawFieldset(_txtTitle, 30, 100, 220, GHI.Glide.Colors.White, 1);

            _pBarConnected       = (ProgressBar)_mainWindow.GetChildByName("pBarConnected");
            _pBarConnected.Value = 0;

            _txtCntrlBattery         = (TextBlock)_mainWindow.GetChildByName("txtCntrlBattery");
            _txtCntrlBattery.Text    = "Battery: ";
            _txtCntrlBatteryOut      = (TextBlock)_mainWindow.GetChildByName("txtCntrlBatteryOut");
            _txtCntrlBatteryOut.Text = "---%";

            _txtRoverBattery         = (TextBlock)_mainWindow.GetChildByName("txtRoverBattery");
            _txtRoverBattery.Text    = "Rover: ";
            _txtRoverBatteryOut      = (TextBlock)_mainWindow.GetChildByName("txtRoverBatteryOut");
            _txtRoverBatteryOut.Text = "---%";

            _txtRoverRange         = (TextBlock)_mainWindow.GetChildByName("txtRoverRange");
            _txtRoverRange.Text    = "Range: ";
            _txtRoverRangeOut      = (TextBlock)_mainWindow.GetChildByName("txtRoverRangeOut");
            _txtRoverRangeOut.Text = "---in.";

            _txtRoverHeading         = (TextBlock)_mainWindow.GetChildByName("txtRoverHeading");
            _txtRoverHeading.Text    = "Head: ";
            _txtRoverHeadingOut      = (TextBlock)_mainWindow.GetChildByName("txtRoverHeadingOut");
            _txtRoverHeadingOut.Text = "---deg";

            _txtRoverTemp         = (TextBlock)_mainWindow.GetChildByName("txtRoverTemp");
            _txtRoverTemp.Text    = "Temp: ";
            _txtRoverTempOut      = (TextBlock)_mainWindow.GetChildByName("txtRoverTempOut");
            _txtRoverTempOut.Text = "---F";

            _txtRoverPress         = (TextBlock)_mainWindow.GetChildByName("txtRoverPress");
            _txtRoverPress.Text    = "Press: ";
            _txtRoverPressOut      = (TextBlock)_mainWindow.GetChildByName("txtRoverPressOut");
            _txtRoverPressOut.Text = "---psi";

            _txtRoverLat         = (TextBlock)_mainWindow.GetChildByName("txtRoverLat");
            _txtRoverLat.Text    = "Lat: ";
            _txtRoverLatOut      = (TextBlock)_mainWindow.GetChildByName("txtRoverLatOut");
            _txtRoverLatOut.Text = "---";

            _txtRoverLon         = (TextBlock)_mainWindow.GetChildByName("txtRoverLon");
            _txtRoverLon.Text    = "Lon: ";
            _txtRoverLonOut      = (TextBlock)_mainWindow.GetChildByName("txtRoverLonOut");
            _txtRoverLonOut.Text = "---";

            _txtWpDist         = (TextBlock)_mainWindow.GetChildByName("txtWpDist");
            _txtWpDist.Text    = "WpDist: ";
            _txtWpDistOut      = (TextBlock)_mainWindow.GetChildByName("txtWpDistOut");
            _txtWpDistOut.Text = "-m";

            _txtTargetHead         = (TextBlock)_mainWindow.GetChildByName("txtTargetHead");
            _txtTargetHead.Text    = "TarHd: ";
            _txtTargetHeadOut      = (TextBlock)_mainWindow.GetChildByName("txtTargetHeadOut");
            _txtTargetHeadOut.Text = "-deg";

            _txtWpSpeedDir         = (TextBlock)_mainWindow.GetChildByName("txtWpSpeedDir");
            _txtWpSpeedDir.Text    = "Spd_Dir:";
            _txtWpSpeedDirOut      = (TextBlock)_mainWindow.GetChildByName("txtWpSpeedDirOut");
            _txtWpSpeedDirOut.Text = "0_0";

            _txtTargetWpNum         = (TextBlock)_mainWindow.GetChildByName("txtTargetWpNum");
            _txtTargetWpNum.Text    = "TarWP: ";
            _txtTargetWpNumOut      = (TextBlock)_mainWindow.GetChildByName("txtTargetWpNumOut");
            _txtTargetWpNumOut.Text = "0";

            _txtRovMode         = (TextBlock)_mainWindow.GetChildByName("txtRovMode");
            _txtRovMode.Text    = "Mode: ";
            _txtRovModeOut      = (TextBlock)_mainWindow.GetChildByName("txtRovModeOut");
            _txtRovModeOut.Text = "-";

            _btnSettings           = (GHI.Glide.UI.Button)_mainWindow.GetChildByName("btnSettings");
            _btnSettings.TapEvent += new OnTap(btnSettings_TapEvent);

            _btnOutputs           = (GHI.Glide.UI.Button)_mainWindow.GetChildByName("btnOutputs");
            _btnOutputs.TapEvent += new OnTap(btnOutputs_TapEvent);

            _btnMode           = (GHI.Glide.UI.Button)_mainWindow.GetChildByName("btnMode");
            _btnMode.TapEvent += new OnTap(btnMode_TapEvent);

            _btnInputs           = (GHI.Glide.UI.Button)_mainWindow.GetChildByName("btnInputs");
            _btnInputs.TapEvent += new OnTap(btnInputs_TapEvent);
        }
        void CreateProfileBar()
        {
            var generic_bts = cache.GetTexture2D("Textures/Generic/generic_btn.png");
            var cont_base   = cache.GetTexture2D("Textures/Garage/cont_base.png");
            var profiles    = cache.GetTexture2D("Textures/Generic/profiles.png");
            var garage_bts  = cache.GetTexture2D("Textures/Garage/garage_bts.png");

            // Buttons container (root element)
            cont_profile         = root.CreateSprite();
            cont_profile.Texture = cont_base;
            cont_profile.SetSize((int)(dim.XScreenRatio * 1200), (int)(dim.YScreenRatio * 600));
            cont_profile.SetPosition((int)(dim.XScreenRatio * 10), (int)(dim.YScreenRatio * 160));
            cont_profile.ImageRect = new IntRect(0, 0, 56, 56);

            // Continue
            var continueBtn = new Button();

            root.AddChild(continueBtn);
            continueBtn.SetStyleAuto(null);
            continueBtn.SetPosition(dim.SetX(0), dim.SetY(-30));
            continueBtn.HorizontalAlignment = HorizontalAlignment.Center;
            continueBtn.VerticalAlignment   = VerticalAlignment.Bottom;
            continueBtn.SetSize(dim.SetX(300), dim.SetY(100));
            continueBtn.Texture   = generic_bts;
            continueBtn.ImageRect = new IntRect(260, 0, 520, 110);

            Text continueText = new Text();

            continueBtn.AddChild(continueText);
            continueText.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center);
            continueText.SetPosition(0, 0);
            continueText.SetFont(font, dim.XScreenRatio * 35);
            continueText.Value = "Continue";

            continueBtn.Pressed += (PressedEventArgs args) => {
                System.Diagnostics.Debug.WriteLine("Pressed");
                if (CharacterManager.Instance.User == null)
                {
                    // Creating new user
                    System.Diagnostics.Debug.WriteLine("Creating new user");
                    CharacterManager.Instance.User = new UserInfo {
                        Experience = 0,
                        PortraitId = counter,
                        Username   = _nameText,
                        Wallet     = 0
                    };
                }
                else
                {
                    // Update user data
                    System.Diagnostics.Debug.WriteLine("Updating user");
                    var user = CharacterManager.Instance.User;
                    user.PortraitId = counter;
                    user.Username   = _nameText;
                    CharacterManager.Instance.User = user;
                }
                if (_isUserProfile)
                {
                    GameInstance.LaunchScene(GameScenesEnumeration.USER_PROFILE);
                }
                else
                {
                    GameInstance.LaunchScene(GameScenesEnumeration.MENU);
                }
            };

            Window nameContainer = new Window();

            cont_profile.AddChild(nameContainer);
            nameContainer.SetStyleAuto(null);
            nameContainer.SetPosition((int)(dim.XScreenRatio * 100), (int)(dim.YScreenRatio * 50));
            nameContainer.SetSize((int)(dim.XScreenRatio * 650), (int)(dim.YScreenRatio * 100));
            nameContainer.Texture   = generic_bts;
            nameContainer.ImageRect = new IntRect(0, 288, 1012, 402);
            continueBtn.Visible     = !string.IsNullOrEmpty(_nameText);

            var enterTextString = "Rudy Reckless";

            if (_isUserProfile)
            {
                enterTextString = CharacterManager.Instance.User.Username;
            }

            lineEdit = new LineEdit {
                Name                = "nameEdit",
                Position            = new IntVector2(dim.SetX(0), dim.SetY(0)),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Size                = new IntVector2(dim.SetX(640), dim.SetY(90))
            };
            lineEdit.SetColor(Color.Transparent);
            lineEdit.Text = enterTextString;
            lineEdit.TextElement.SetFont(font, dim.SetX(35));
            lineEdit.TextElement.VerticalAlignment   = VerticalAlignment.Center;
            lineEdit.TextElement.HorizontalAlignment = HorizontalAlignment.Center;
            nameContainer.AddChild(lineEdit);

            continueBtn.Visible = true;
            lineEdit.Focused   += (FocusedEventArgs args) => {
                _nameText = enterTextString;
                System.Diagnostics.Debug.WriteLine("Focused line edit");
            };

            /*
             * lineEdit.TextChanged += (TextChangedEventArgs args) => {
             *  if(args.Text.Equals(enterTextString) || args.Text.Contains("Enter n")) {
             *      lineEdit.Text = string.Empty;
             *      _nameText = string.Empty;
             *      continueBtn.Visible = false;
             *      return;
             *  }
             *  if(args.Text.Length < 3) {
             *      continueBtn.Visible = false;
             *      return;
             *  }
             *  continueBtn.Visible = true;
             *  _nameText = args.Text;
             * };
             */

            //male
            male = new Button();
            cont_profile.AddChild(male);
            male.SetStyleAuto(null);
            male.SetPosition((int)(dim.XScreenRatio * 800), (int)(dim.YScreenRatio * 50));
            male.SetSize((int)(dim.XScreenRatio * 300), (int)(dim.YScreenRatio * 100));
            male.Texture   = generic_bts;
            male.ImageRect = new IntRect(0, 0, 260, 110);
            Text buttonmale = new Text();

            male.AddChild(buttonmale);
            buttonmale.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center);
            buttonmale.SetPosition(0, 0);
            buttonmale.SetFont(font, dim.XScreenRatio * 30);
            buttonmale.Value = "MALE";
            male.Pressed    += args => {
                counter = 0;
                ScrollImage();
            };

            //female
            female = new Button();
            cont_profile.AddChild(female);
            female.SetStyleAuto(null);
            female.SetPosition((int)(dim.XScreenRatio * 1120), (int)(dim.YScreenRatio * 50));
            female.SetSize((int)(dim.XScreenRatio * 300), (int)(dim.YScreenRatio * 100));
            female.Texture   = generic_bts;
            female.ImageRect = new IntRect(0, 0, 260, 110);
            Text buttonfemale = new Text();

            female.AddChild(buttonfemale);
            buttonfemale.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center);
            buttonfemale.SetPosition(0, 0);
            buttonfemale.SetFont(font, dim.XScreenRatio * 30);
            buttonfemale.Value = "FEMALE";
            female.Pressed    += args => {
                counter = 12;
                ScrollImage();
            };

            //other
            other = new Button();
            cont_profile.AddChild(other);
            other.SetStyleAuto(null);
            other.SetPosition((int)(dim.XScreenRatio * 1440), (int)(dim.YScreenRatio * 50));
            other.SetSize((int)(dim.XScreenRatio * 300), (int)(dim.YScreenRatio * 100));
            other.Texture   = generic_bts;
            other.ImageRect = new IntRect(0, 0, 260, 110);
            Text buttonother = new Text();

            other.AddChild(buttonother);
            buttonother.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center);
            buttonother.SetPosition(0, 0);
            buttonother.SetFont(font, dim.XScreenRatio * 30);
            buttonother.Value = "OTHER";
            other.Pressed    += args => {
                counter = 24;
                ScrollImage();
            };

            // Buttons container (root element)
            cont_img         = root.CreateSprite();
            cont_img.Texture = cont_base;
            cont_img.SetSize((int)(dim.XScreenRatio * 1200), (int)(dim.YScreenRatio * 800));
            cont_img.SetPosition((int)(dim.XScreenRatio * 10), (int)(dim.YScreenRatio * 250));
            cont_img.ImageRect = new IntRect(0, 0, 56, 56);

            p_prev_img = new Button();
            cont_profile.AddChild(p_prev_img);
            p_prev_img.SetStyleAuto(null);
            p_prev_img.Opacity = 0.25f;
            p_prev_img.SetPosition((int)(dim.XScreenRatio * -400), (int)(dim.YScreenRatio * 300));
            p_prev_img.SetSize((int)(dim.XScreenRatio * 450), (int)(dim.YScreenRatio * 450));
            p_prev_img.Texture   = profiles;
            p_prev_img.ImageRect = new IntRect(0, 0, 250, 250);

            prev_img = new Button();
            cont_profile.AddChild(prev_img);
            prev_img.SetStyleAuto(null);
            prev_img.Opacity = 0.5f;
            prev_img.SetPosition((int)(dim.XScreenRatio * 100), (int)(dim.YScreenRatio * 250));
            prev_img.SetSize((int)(dim.XScreenRatio * 500), (int)(dim.YScreenRatio * 500));
            prev_img.Texture   = profiles;
            prev_img.ImageRect = new IntRect(0, 0, 250, 250);
            prev_img.Pressed  += args => {
                if (counter <= 0)
                {
                    counter = 44;
                }
                else
                {
                    counter = counter - 1;
                }
                ScrollImage();
            };

            sel_img = new Button();
            cont_profile.AddChild(sel_img);
            sel_img.SetStyleAuto(null);
            sel_img.SetPosition((int)(dim.XScreenRatio * 650), (int)(dim.YScreenRatio * 220));
            sel_img.SetSize((int)(dim.XScreenRatio * 550), (int)(dim.YScreenRatio * 550));
            sel_img.Texture   = profiles;
            sel_img.ImageRect = new IntRect(250, 0, 500, 250);

            next_img = new Button();
            cont_profile.AddChild(next_img);
            next_img.Opacity = 0.5f;
            next_img.SetStyleAuto(null);
            next_img.SetPosition((int)(dim.XScreenRatio * 1250), (int)(dim.YScreenRatio * 250));
            next_img.SetSize((int)(dim.XScreenRatio * 500), (int)(dim.YScreenRatio * 500));
            next_img.Texture   = profiles;
            next_img.ImageRect = new IntRect(500, 0, 750, 250);
            next_img.Pressed  += args => {
                if (counter == 44)
                {
                    //next_img.Enabled = false;
                    counter = 0;
                }
                else
                {
                    next_img.Enabled = true;
                    counter          = counter + 1;
                }
                ScrollImage();
            };

            n_next_img = new Button();
            cont_profile.AddChild(n_next_img);
            n_next_img.SetStyleAuto(null);
            n_next_img.Opacity = 0.25f;
            n_next_img.SetPosition((int)(dim.XScreenRatio * 1800), (int)(dim.YScreenRatio * 300));
            n_next_img.SetSize((int)(dim.XScreenRatio * 450), (int)(dim.YScreenRatio * 450));
            n_next_img.Texture   = profiles;
            n_next_img.ImageRect = new IntRect(0, 0, 250, 250);


            //slider
            imageSlider = new Slider();
            cont_profile.AddChild(imageSlider);
            imageSlider.SetStyleAuto(null);
            imageSlider.SetPosition(GameInstance.ScreenInfo.SetX(400), GameInstance.ScreenInfo.SetY(160));
            imageSlider.SetSize(GameInstance.ScreenInfo.SetX(1100), GameInstance.ScreenInfo.SetY(55));
            imageSlider.Texture   = GameInstance.ResourceCache.GetTexture2D(AssetsCoordinates.Generic.Boxes.ResourcePath);
            imageSlider.ImageRect = AssetsCoordinates.Generic.Boxes.VolumeBarWhite;
            imageSlider.Opacity   = 0.2f;
            imageSlider.Range     = 44;

            var knobM = imageSlider.Knob;

            knobM.SetFixedSize(GameInstance.ScreenInfo.SetX(100), GameInstance.ScreenInfo.SetY(55));
            knobM.Texture           = GameInstance.ResourceCache.GetTexture2D(AssetsCoordinates.Generic.Boxes.ResourcePath);
            knobM.ImageRect         = AssetsCoordinates.Generic.Boxes.VolumeBarWhite;
            knobM.UseDerivedOpacity = false;
            imageSlider.Value       = counter;

            imageSlider.SliderChanged += (SliderChangedEventArgs args) => {
                counter = (int)args.Value;
                ScrollImage();
                System.Diagnostics.Debug.WriteLine("VALORE = " + (int)args.Value);
            };
        }
        protected void SetupGui()
        {
            guiRenderer = new Renderer(window, RenderQueueGroupID.Overlay, false);
            // set the scene manager
            guiRenderer.SetSceneManager(scene);

            // init the subsystem singleton
            new GuiSystem(guiRenderer);

            // configure the default mouse cursor
            GuiSystem.Instance.DefaultCursor = null;
            GuiSystem.Instance.CurrentCursor = null;

            // max window size, based on the size of the Axiom window
            SizeF maxSize = new SizeF(window.Width, window.Height);

            rootWindow = new Window("Window/RootWindow");
            // rootWindow.MetricsMode = MetricsMode.Absolute;
            rootWindow.MaximumSize = maxSize;
            rootWindow.Size = maxSize;
            rootWindow.Visible = true;

            // set the main window as the primary GUI sheet
            GuiSystem.Instance.SetRootWindow(rootWindow);

            // Load the default imageset
            try
            {
                AtlasManager.Instance.CreateAtlas(MultiverseImagesetFile);
            }
            catch (AxiomException e)
            {
                throw new PrettyClientException("bad_media.htm", "Invalid media repository", e);
            }

            xmlUiWindow = new Window("XmlUiWindow");
            // xmlUiWindow.MetricsMode = MetricsMode.Absolute;
            xmlUiWindow.MaximumSize = rootWindow.MaximumSize;
            xmlUiWindow.Size = rootWindow.Size;
            xmlUiWindow.Visible = false;

            rootWindow.AddChild(xmlUiWindow);

            // Set up the gui elements
            SetupGuiElements();

            FontManager.SetupFonts();

            rootWindow.Activate();
            xmlUiWindow.Activate();
        }
        void InitWindow()
        {
            // Create the Window and add it to the UI's root node
            window = new Window();
            uiRoot.AddChild(window);

            // Set Window size and layout settings
            window.SetMinSize(384, 192);
            window.SetLayout(LayoutMode.Vertical, 6, new IntRect(6, 6, 6, 6));
            window.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center);
            window.Name = "Window";

            // Create Window 'titlebar' container
            UIElement titleBar = new UIElement();
            titleBar.SetMinSize(0, 24);
            titleBar.VerticalAlignment = VerticalAlignment.Top;
            titleBar.LayoutMode = LayoutMode.Horizontal;

            // Create the Window title Text
            var windowTitle = new Text();
            windowTitle.Name = "WindowTitle";
            windowTitle.Value = "Hello GUI!";

            // Create the Window's close button
            Button buttonClose = new Button();
            buttonClose.Name = "CloseButton";

            // Add the controls to the title bar
            titleBar.AddChild(windowTitle);
            titleBar.AddChild(buttonClose);

            // Add the title bar to the Window
            window.AddChild(titleBar);

            // Apply styles
            window.SetStyleAuto(null);
            windowTitle.SetStyleAuto(null);
            buttonClose.SetStyle("CloseButton", null);

            buttonClose.SubscribeToReleased(_ => Engine.Exit());

            // Subscribe also to all UI mouse clicks just to see where we have clicked
            UI.SubscribeToUIMouseClick(HandleControlClicked);
        }
Beispiel #31
0
        // Executors
        private static Window CreateWindow9_2(string path)
        {
            var window = new Window("window9_2", Path.Combine(path, @"generic/bg.raw"));

            window.AddChild(new RawButton("window9_home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window1")
            });


            var list = new ListWidget("list", 10, 75, new[] { 300 }, TextTable.CreateOffset(6, 25));

            window.OnShow = () =>
            {
                var executors = mDeviceControl.SettingsStorage.Load().Executors;

                list.Items = executors.ConvertAll(e => new ListWidget.Item {
                    Column1 = e, Id = e
                }).ToArray();
            };
            window.AddChild(list);


            window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_up.raw"), Path.Combine(path, "9/2/bt_up_pr.raw"), 340, 175)
            {
                OnRelease = list.Up
            });


            window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_choose.raw"), Path.Combine(path, "9/2/bt_choose_pr.raw"), 340, 135)
            {
                OnRelease = () =>
                {
                    var settings = mDeviceControl.SettingsStorage.Load();

                    settings.Executors = list.Items.ToList().ConvertAll(i => i.Column1);

                    settings.LastUsedExecutor = (string)list.CurrentSelection;

                    mDeviceControl.SettingsStorage.Save(settings);

                    var rv = mApplication.GetWindows().First(w => w.Name == "window2") as Window;

                    if (rv == null)
                    {
                        return;
                    }

                    rv.OnShow();
                    mApplication.SetFocusedWindow(rv);
                }
            });

            window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_down.raw"), Path.Combine(path, "9/2/bt_down_pr.raw"), 340, 65)
            {
                OnRelease = list.Down
            });

            window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_add.raw"), Path.Combine(path, "9/2/bt_add_pr.raw"), 320, 5)//340, 5)
            {
                OnRelease = () =>
                {
                    mKeyboardWindow.OnEnter = returnText =>
                    {
                        if (!string.IsNullOrWhiteSpace(returnText))
                        {
                            var newItems =
                                new ListWidget.Item[list.Items.Length + 1];

                            Array.Copy(list.Items, newItems, list.Items.Length);

                            newItems[list.Items.Length] =
                                new ListWidget.Item
                            {
                                Column1 = returnText, Id = returnText
                            };

                            list.Items = newItems;
                        }
                    };

                    mKeyboardWindow.ReturnWindow = "window9_2";

                    mApplication.SetFocusedWindow("keyboard_window");
                }
            });

            window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_delete.raw"), Path.Combine(path, "9/2/bt_delete_pr.raw"), 185, 5)//205, 5)
            {
                OnRelease = () =>
                {
                    var newItems = list.Items.ToList();

                    newItems.RemoveAll(i => i.Id == list.CurrentSelection);

                    list.Items = newItems.ToArray();
                }
            });

            window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_back.raw"), Path.Combine(path, "9/2/bt_back_pr.raw"), 20, 5)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window2")
            });

            return(window);
        }
Beispiel #32
0
        private static IWidget CreateWindow7(string path)
        {
            var window = new Window("window7", Path.Combine(path, @"generic/bg.raw"));

            window.AddChild(new RawButton("window7_home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window1")
            });

            window.AddChild(new TextArea("", null, 30, 210, 350)
            {
                Text = "Отчёт о проведенном измерении", Size = 16, Color = new Color {
                    R = 1.0f, G = 1.0f, B = 1.0f
                }
            });

            var table = new TextTable("window7.table", 15, 70, new[] { 180, 130 }, TextTable.CreateOffset(5, 22), new[] { 2, 4 }, null, 16);

            table.Cells[0, 0].Text = "Проба:";
            table.Cells[0, 1].Text = "Результат АОА:";
            table.Cells[0, 2].Text = "Результат ОА:";
            table.Cells[0, 3].Text = "Исполнитель:";
            table.Cells[0, 4].Text = "Дата:";
            window.AddChild(table);

            window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_next_measurement.raw"), Path.Combine(path, "RawButtons/bt_next_measurement_pr.raw"), 350, 5)
            {
                OnRelease = () => mApplication.SetFocusedWindow("window2")
            });

            window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_repeat_measurement.raw"), Path.Combine(path, "RawButtons/bt_repeat_measurement_pr.raw"), 350, 165)
            {
                OnRelease = () =>
                {
                    mMeasureController.Reset();
                    mApplication.SetFocusedWindow("window3");
                }
            });

            const int popupX = 40;
            const int popupY = 30;

            var additionalWindow = new ModalWindow("", path)
            {
                HeaderLine = "       Дополнительные сведения:"
            };
            const int offset = 120;

            for (var i = 2; i < 7; i++)
            {
                additionalWindow.Cells[1, i].X     -= offset;
                additionalWindow.Cells[0, i].Width -= offset;
                additionalWindow.Cells[1, i].Width  = offset;
            }

            additionalWindow.AddChild(new RawButton("", Path.Combine(path, "generic/modals/RawButtons/bt_ok.raw"), Path.Combine(path, "generic/modals/RawButtons/bt_ok_pr.raw"), popupX + 151, popupY)
            {
                OnRelease = () =>
                {
                    additionalWindow.IsVisible = false;
                    window.Invalidate();
                }
            });

            window.AddPopup(additionalWindow);

            window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_additional_info.raw"), Path.Combine(path, "RawButtons/bt_additional_info_pr.raw"), 350, 105)
            {
                OnRelease = () =>
                {
                    additionalWindow.IsVisible = true;
                    window.Invalidate();
                }
            });

            mMeasureController.Window7DataAction = (sample, aoa, oa, executor, date, startTime, endTime, totalTime, stability, Ebase, Esample, Emax, t) =>
            {
                table.Cells[1, 0].Text = sample;
                table.Cells[1, 1].Text = aoa;
                table.Cells[1, 2].Text = oa;
                table.Cells[1, 3].Text = executor;
                table.Cells[1, 4].Text = date;

                additionalWindow.Cells[0, 2].Text = "Затраченное время:";
                additionalWindow.Cells[1, 2].Text = totalTime;

                additionalWindow.Cells[0, 3].Text = "Начальный потенциал:";
                if (Ebase.HasValue)
                {
                    additionalWindow.Cells[1, 3].Text = Ebase.Value.ToString("F2") + " мВ";
                }
                else
                {
                    additionalWindow.Cells[1, 3].Text = "-";
                }


                additionalWindow.Cells[0, 4].Text = "Потенциал пробы:";
                if (Esample.HasValue)
                {
                    additionalWindow.Cells[1, 4].Text = Esample.Value.ToString("F2") + " мВ";
                }
                else
                {
                    additionalWindow.Cells[1, 4].Text = "-";
                }


                additionalWindow.Cells[0, 5].Text = "Макс. потенциал:";
                if (Emax.HasValue)
                {
                    additionalWindow.Cells[1, 5].Text = Emax.Value.ToString("F2") + " мВ";
                }
                else
                {
                    additionalWindow.Cells[1, 5].Text = "-";
                }
            };

            return(window);
        }