Exemple #1
0
        private void OnButtonClicked(object sender, RoutedEventArgs e)
        {
            ButtonSelector buttonSelector = new ButtonSelector();

            buttonSelector.SetFreeButtons(this.crate.free_buttons);
            if (buttonSelector.ShowDialog() == false)
            {
                return;
            }

            Button button = (Button)sender;
            string text   = (string)button.Content;

            if (text.ToLower().IndexOf("none") >= 0 && buttonSelector.selectedButton == null)
            {
                return;
            }
            int pin;

            int.TryParse(button.Name.Substring(3), out pin);
            if (text.ToLower().IndexOf("none") < 0)
            {
                CrateButton crateBut = this.crate.used_buttons.Find(but => but.name.Equals(text));
                this.crate.FreeButton(crateBut);
            }
            if (buttonSelector.selectedButton != null)
            {
                this.crate.Usebutton(buttonSelector.selectedButton, pin);
                button.Content = buttonSelector.selectedButton.name;
            }
            this.RenderLayout();
        }
Exemple #2
0
        private void ButtonActivator_Click(object sender, RoutedEventArgs e)
        {
            ButtonSelector buttonSelector = new ButtonSelector();

            buttonSelector.SetFreeButtons(Crate.createCrateWithButtons().used_buttons);
            if (buttonSelector.ShowDialog() == false)
            {
                return;
            }
            CrateButton but = buttonSelector.selectedButton;

            if (but == null)
            {
                this.ButtonActivator.Content       = "None";
                this.current_Game_Config.activator = null;
                return;
            }
            this.ButtonActivator.Content       = but.name;
            this.current_Game_Config.activator = but;
        }