private void Start()
    {
        _play = _buttonList.Add("Play") as UIMenuButton;
        _quit = _buttonList.Add("Quit") as UIMenuButton;

        _play.Pressed += Play_Pressed;
        _quit.Pressed += Quit_Pressed;
    }
Ejemplo n.º 2
0
 public MapListRoom(Game1 game, Room parent, bool useEditor) : base(game, parent)
 {
     //find all of the maps
     string[] directories = Directory.GetDirectories("maps");
     for (int i = 0; i < directories.Length; i++)
     {
         string  dir       = directories[i];
         string  json      = File.ReadAllText(dir + "/map.json");
         JObject mapObject = JObject.Parse(json);
         string  name      = (string)mapObject.GetValue("name").ToObject(typeof(string));
         ButtonList.Add(new KeyValuePair <string, Action>(name, () =>
         {
             MapRoom room;
             if (useEditor)
             {
                 room = new EditorRoom(Game, this);
             }
             else
             {
                 room = new MapRoom(Game, this);
             }
             Uri uri = new Uri(dir, UriKind.Relative);
             room.LoadMap(uri);
             room.Randomized  = false;
             Game.CurrentRoom = room;
         }));
     }
 }
Ejemplo n.º 3
0
 public void Attach(Button NewButton)
 {
     if (!ButtonList.ContainsValue(NewButton))
     {
         ButtonList.Add(NewButton.Name, NewButton);
     }
 }
        /// <summary>
        /// Add a button to the current toast.
        /// </summary>
        /// <param name="button">An instance of class that implement <see cref="IToastButton"/> for the button that will be used on the toast.</param>
        /// <returns>The current instance of <see cref="ToastContentBuilder"/></returns>
        public ToastContentBuilder AddButton(IToastButton button)
        {
            if (button is ToastButton toastButton && toastButton.Content == null)
            {
                throw new InvalidOperationException("Content is required on button.");
            }

            // List has max 5 buttons
            if (ButtonList.Count == 5)
            {
                throw new InvalidOperationException("A toast can't have more than 5 buttons");
            }

            if (button is ToastButton b && b.CanAddArguments())
            {
                foreach (var arg in _genericArguments)
                {
                    if (!b.ContainsArgument(arg.Key))
                    {
                        b.AddArgument(arg.Key, arg.Value);
                    }
                }
            }

            ButtonList.Add(button);

            return(this);
        }
Ejemplo n.º 5
0
        private void InitializeButtons()
        {
            Sys_Button sys_Button = ButtonList.Find(b => b.Button_Name.EndsWith("Extra"));

            if (sys_Button != null)
            {
                DataTable             dt    = BaseService.Open("SystemConnection_All", null);
                List <Sys_Connection> Conns = EntityHelper.GetEntities <Sys_Connection>(dt);
                foreach (Sys_Connection conn in Conns)
                {
                    if (!string.IsNullOrEmpty(conn.Connection_Id))
                    {
                        Sys_Button nButton = new Sys_Button();
                        nButton.Button_Id      = conn.Connection_Id;
                        nButton.Button_Name    = conn.Connection_Name;
                        nButton.Button_Nick    = conn.Connection_Name;
                        nButton.Button_Sub     = "SwitchConn";
                        nButton.Button_Parent  = sys_Button.Button_Id;
                        nButton.Button_Assign  = 0;
                        nButton.Button_Visible = true;
                        nButton.Button_Enabled = true;
                        ButtonList.Add(nButton);
                    }
                }
                RefreshTool();
            }
        }
Ejemplo n.º 6
0
 public void RegisterButton(Button button)
 {
     if (!ButtonList.ContainsKey(button))
     {
         ButtonList.Add(button, null);
         button.Click += Button_Click;
     }
 }
        public void AddButton(String NameAndCaption)
        {
            EditorButton Button = new EditorButton();

            Button.Kind    = ButtonPredefines.Glyph;
            Button.Caption = NameAndCaption;
            Button.Tag     = NameAndCaption;
            Button.Width   = TextRenderer.MeasureText(NameAndCaption, DefaultFont).Width;
            ButtonList.Add(Button);
            CalcButtonInfo();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Add a button to the current toast.
        /// </summary>
        /// <param name="button">An instance of class that implement <see cref="IToastButton"/> for the button that will be used on the toast.</param>
        /// <returns>The current instance of <see cref="ToastContentBuilder"/></returns>
        public ToastContentBuilder AddButton(IToastButton button)
        {
            // List has max 5 buttons
            if (ButtonList.Count == 5)
            {
                throw new InvalidOperationException("A toast can't have more than 5 buttons");
            }

            ButtonList.Add(button);

            return(this);
        }
Ejemplo n.º 9
0
 protected override void InitializeButtons()
 {
     base.InitializeButtons();
     ShootButtons[0]  = ShootButton;
     ReloadButtons[0] = ReloadButton;
     ShootButtons[1]  = SecondaryShootButton;
     ButtonList.Add(ReloadButtons[1] = new MMInput.IMButton(PlayerID, "Reload2"));
     for (var i = 2; i < MaximumNumberOfWeapons; i++)
     {
         ButtonList.Add(ShootButtons[i]  = new MMInput.IMButton(PlayerID, "Shoot" + (i + 1)));
         ButtonList.Add(ReloadButtons[i] = new MMInput.IMButton(PlayerID, "Reload" + (i + 1)));
     }
 }
Ejemplo n.º 10
0
 public MenuRoom(Game1 game, Room parent) : base(game, parent)
 {
     ButtonList.Add(new KeyValuePair <string, Action>("Maps", () =>
     {
         Game.CurrentRoom = new MapListRoom(Game, this, false);
     }));
     ButtonList.Add(new KeyValuePair <string, Action>("Editor", () =>
     {
         Game.CurrentRoom = new MapListRoom(Game, this, true);
     }));
     ButtonList.Add(new KeyValuePair <string, Action>("Quit", () =>
     {
         Game.Exit();
     }));
 }
Ejemplo n.º 11
0
        public CategorySelectViewModel(INavigationService navigationService, IRzeszowiak RzeszowiakRepository)
        {
            _rzeszowiakRepository = RzeszowiakRepository ?? throw new NullReferenceException("ListViewModel => IRzeszowiakRepository RzeszowiakRepository == null !");
            _navigationService    = navigationService ?? throw new NullReferenceException("INavigationService navigationService == null !");

            for (int i = 1; i < 4; i++)
            {
                ButtonList.Add(new CatButtonDisplay((byte)i)
                {
                    Title = "", IsVisible = false, Image = CatSelectImage.none
                });
            }
            CategoryTappet     = new Command <CatDisplay>(ItemTapedAsync);
            ButtonTappped      = new Command <CatButtonDisplay>(ButtonTappedAsync);
            ButtonCloseTappped = new Command(async() => { await _navigationService.GoBackAsync(); });
        }
        public void AddButton(string Name, Image image)
        {
            EditorButton Button = new EditorButton();

            Button.Kind  = ButtonPredefines.Glyph;
            Button.Image = image;
            Button.Tag   = Name;
            if (image.HorizontalResolution > 60)
            {
                Button.Width = 60;
            }
            else
            {
                Button.Width = (int)image.HorizontalResolution;
            }
            ButtonList.Add(Button);
            CalcButtonInfo();
        }
Ejemplo n.º 13
0
        protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
        {
            base.OnItemsChanged(e);

            if (DesignerProperties.IsInDesignTool)
            {
                return;
            }

            ButtonList.Clear();
            WrappedObject.Buttons.Clear();
            MenuItemList.Clear();
            WrappedObject.MenuItems.Clear();
            foreach (object item in Items)
            {
                if (item is AppBarIconButton)
                {
                    AppBarIconButton button = (AppBarIconButton)item;
                    button.Owner = this;
                    if (button.Visiable)
                    {
                        WrappedObject.Buttons.Add(button.WrappedObject);
                    }
                    ButtonList.Add(button);
                }
                else if (item is AppBarMenuItem)
                {
                    WrappedObject.MenuItems.Add(((AppBarMenuItem)item).WrappedObject);
                    MenuItemList.Add((AppBarMenuItem)item);
                }
                else
                {
                    throw new InvalidCastException();
                }
            }
        }
Ejemplo n.º 14
0
        protected virtual void OnButtonLoaded(object sender, RoutedEventArgs e)
        {
            FrameworkElement ElementSender = sender as FrameworkElement;

            ButtonList.Add(ElementSender);
        }
Ejemplo n.º 15
0
        //displays selected entity info



        internal override void Display()
        {
            ImGui.SetNextWindowSize(new Vector2(150, 200), ImGuiCond.Once);
            if (ImGui.Begin("Actions", _flags))
            {
                //check if ANY entity has been clicked
                //if true, display all possible toolbar menu icons for it
                if (_state.LastClickedEntity != null)
                {
                    //Gets the last clicked entity
                    var _entityState = _state.LastClickedEntity;

                    ToolbuttonData btn;

                    void NewButton(Type T, string PictureString, string TooltipText, List <ToolbuttonData> ButtonList)
                    {
                        //Creates a buttton if it is usuable in this situation
                        if (EntityUIWindows.checkIfCanOpenWindow(T, _entityState))
                        {
                            btn = new ToolbuttonData()
                            {
                                Picture     = _state.SDLImageDictionary[PictureString],
                                TooltipText = TooltipText,
                                ClickType   = T
                                              //Opens up the componet design menu
                            };
                            ButtonList.Add(btn);
                        }
                    }

                    void NewCondtionalButton(Type T, string PictureString, string TooltipText)
                    {
                        NewButton(T, PictureString, TooltipText, CondtionalButtons);
                    }

                    void NewStandardButton(Type T, string PictureString, string TooltipText)
                    {
                        NewButton(T, PictureString, TooltipText, StandardButtons);
                    }

                    //Populates Buttons

                    NewStandardButton(typeof(SelectPrimaryBlankMenuHelper), "Select", "Selects the entity");
                    NewStandardButton(typeof(PinCameraBlankMenuHelper), "Pin", "Focuses camera");
                    NewStandardButton(typeof(RenameWindow), "Rename", "Renames the entity");

                    NewCondtionalButton(typeof(PowerGen), "Power", "Shows power stats");
                    NewCondtionalButton(typeof(CargoTransfer), "Cargo", "Shows cargo");
                    NewCondtionalButton(typeof(ColonyPanel), "Industry", "Opens Industry menu");
                    NewCondtionalButton(typeof(WeaponTargetingControl), "Firecon", "Opens firecontrol menu");

                    //Displays all buttons in a list
                    void PrintButtonList(ref List <ToolbuttonData> PrintButtons)
                    {
                        uint iterations = 0;

                        foreach (var button in PrintButtons)
                        {
                            ImGui.SameLine();
                            ImGui.PushID(iterations.ToString());
                            if (ImGui.ImageButton(button.Picture, BtnSizes))
                            {
                                EntityUIWindows.openUIWindow(button.ClickType, _entityState, _state);
                            }
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip(button.TooltipText);
                            }

                            ImGui.PopID();
                            iterations++;
                        }
                        ImGui.NewLine();
                        PrintButtons = new List <ToolbuttonData>();
                    }

                    //Prints both button lists
                    PrintButtonList(ref StandardButtons);
                    PrintButtonList(ref CondtionalButtons);

                    void ActionButton(Type T)
                    {
                        //Makes a small button if it is usable in this situation
                        if (EntityUIWindows.checkIfCanOpenWindow(T, _entityState))
                        {
                            bool buttonresult = ImGui.SmallButton(GlobalUIState.namesForMenus[T]);
                            EntityUIWindows.openUIWindow(T, _entityState, _state, buttonresult);
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip(GlobalUIState.namesForMenus[T]);
                            }
                        }
                    }

                    //Makes all small buttons
                    ActionButton(typeof(PlanetaryWindow));
                    ActionButton(typeof(GotoSystemBlankMenuHelper));
                    ActionButton(typeof(OrbitOrderWindow));
                    ActionButton(typeof(ChangeCurrentOrbitWindow));
                }
                ImGui.End();
            }
        }
Ejemplo n.º 16
0
        public HomeViewModel()
        {
            Series   = new List <SeriesData>();
            Errors   = new ObservableCollection <TestClass>();
            Warnings = new ObservableCollection <TestClass>();

            Errors.Add(new TestClass()
            {
                Category = "全球化", Number = 66
            });
            Errors.Add(new TestClass()
            {
                Category = "特征", Number = 23
            });
            Errors.Add(new TestClass()
            {
                Category = "内容类型", Number = 12
            });
            Errors.Add(new TestClass()
            {
                Category = "正确性", Number = 94
            });
            Errors.Add(new TestClass()
            {
                Category = "命名", Number = 45
            });
            Errors.Add(new TestClass()
            {
                Category = "最佳实践", Number = 29
            });

            //Warnings.Add(new TestClass() { Category = "全球化", Number = 34 });
            //Warnings.Add(new TestClass() { Category = "特征", Number = 23 });
            //Warnings.Add(new TestClass() { Category = "内容类型", Number = 15 });
            //Warnings.Add(new TestClass() { Category = "正确性", Number = 66 });
            //Warnings.Add(new TestClass() { Category = "命名", Number = 56 });
            //Warnings.Add(new TestClass() { Category = "最佳实践", Number = 34 });

            Series.Add(new SeriesData()
            {
                DisplayName = "错误", Items = Errors
            });
            //Series.Add(new SeriesData() { DisplayName = "警告", Items = Warnings });


            var btnLeft = new ButtonModel()
            {
                Name = "Refresh", Content = "刷新", Icon = WebUtility.HtmlDecode("&#xe675;"), BorderThickness = new Thickness(1, 1, 0, 1), ButtonStyle = Application.Current.FindResource("ButtonGroupLeftStyle") as Style, Width = 66, Height = 25
            };
            var btnCenterOne = new ButtonModel()
            {
                Name = "add", Content = "新增", Icon = WebUtility.HtmlDecode("&#xe6c7;"), BorderThickness = new Thickness(1, 1, 0, 1), ButtonStyle = Application.Current.FindResource("ButtonGroupCenterStyle") as Style, Width = 66, Height = 25
            };
            var btnCenterTwo = new ButtonModel()
            {
                Name = "edit", Content = "编辑", Icon = WebUtility.HtmlDecode("&#xe662;"), BorderThickness = new Thickness(1, 1, 0, 1), ButtonStyle = Application.Current.FindResource("ButtonGroupCenterStyle") as Style, Width = 66, Height = 25
            };
            var btnRight = new ButtonModel()
            {
                Name = "delete", Content = "删除", Icon = WebUtility.HtmlDecode("&#xe60d;"), BorderThickness = new Thickness(1, 1, 0, 1), ButtonStyle = Application.Current.FindResource("ButtonGroupRightStyle") as Style, Width = 66, Height = 25
            };

            ButtonList.Add(btnLeft);
            ButtonList.Add(btnCenterOne);
            ButtonList.Add(btnCenterTwo);
            ButtonList.Add(btnRight);
        }
Ejemplo n.º 17
0
 protected override void InitializeButtons()
 {
     base.InitializeButtons();
     ButtonList.Add(ProneButton = new MMInput.IMButton(PlayerID, "Prone"));
 }