Exemplo n.º 1
0
        protected override void AdditionalInitialize()
        {
            Text             = null;
            TextColor        = Color.Black;
            FontName         = null;
            TriggerOnRelease = true;

            OnMouseClicked += (b, x, y) => {
                if (TriggerOnRelease)
                {
                    return;
                }

                OnButtonClick?.Invoke(this);
            };

            OnMouseReleased += (b, x, y) => {
                if (!TriggerOnRelease)
                {
                    return;
                }

                OnButtonClick?.Invoke(this);
            };
        }
Exemplo n.º 2
0
        private void Save_OnClick(object sender, RoutedEventArgs e)
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

            // Copy current model values to options before saving
            AcmeOptions.BondLength           = (int)SettingsModel.CurrentBondLength;
            AcmeOptions.ShowMoleculeGrouping = SettingsModel.ShowMoleculeGroups;
            AcmeOptions.ShowHydrogens        = SettingsModel.ShowImplicitHydrogens;
            AcmeOptions.ColouredAtoms        = SettingsModel.ShowAtomsInColour;
            AcmeOptions.ShowCarbons          = SettingsModel.ShowAllCarbonAtoms;

            AcmeOptions.Save();
            if (AcmeOptions.Errors.Any())
            {
                Telemetry.Write(module, "Exception", string.Join(Environment.NewLine, AcmeOptions.Errors));
                AcmeOptions.Errors = new List <string>();
            }
            AcmeOptions.Dirty = false;

            WpfEventArgs args = new WpfEventArgs();

            args.Button      = "SAVE";
            args.OutputValue = "";
            OnButtonClick?.Invoke(this, args);
        }
Exemplo n.º 3
0
 public override void OnPointerClick()
 {
     if (transform.parent == Container)
     {
         OnButtonClick?.Invoke();
     }
 }
 public void Update()
 {
     if (Mod.Instance.Config.EnableHexColorInput && Menu && Menu.currentMenuLayer_ == CustomizeCarColorsMenuLogic.MenuLayer.ColorPicker && G.Sys.InputManager_.GetKeyUp(InternalResources.Constants.INPUT_EDIT_COLOR))
     {
         OnButtonClick?.Invoke();
     }
 }
Exemplo n.º 5
0
 public void ButtonClick()
 {
     if (Enabled)
     {
         OnButtonClick?.Invoke();
     }
 }
Exemplo n.º 6
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (OnButtonClick != null)
     {
         OnButtonClick.Invoke(this, new TextEventArgs(MessageTextBox.Text));
     }
 }
Exemplo n.º 7
0
        //sự kiện khi nhấn vào button
        public void Clicked()
        {
            Random random = new Random();
            int    x      = random.Next(1, 100);
            int    y      = random.Next(1, 20);

            OnButtonClick?.Invoke(this, x, y);
        }
Exemplo n.º 8
0
 public static void ButtonClick()
 {
     if (!PlayerProfile.sounds)
     {
         return;
     }
     OnButtonClick.Invoke();
 }
Exemplo n.º 9
0
    private void Start()
    {
        Button.onClick.AddListener(() => OnButtonClick?.Invoke(Weapon));
        Button.onClick.AddListener(() => CheckWeaponState());

        Label.text  = Weapon.Label;
        Price.text  = Weapon.Price.ToString();
        Icon.sprite = Weapon.Icon;
    }
Exemplo n.º 10
0
        private void Cancel_OnClick(object sender, RoutedEventArgs e)
        {
            AcmeOptions.Dirty = false;
            WpfEventArgs args = new WpfEventArgs();

            args.Button      = "CANCEL";
            args.OutputValue = "";
            OnButtonClick?.Invoke(this, args);
        }
Exemplo n.º 11
0
        public void No()
        {
            if (onNo != null)
            {
                onNo.Invoke();
            }

            Close();
        }
Exemplo n.º 12
0
        public void Yes()
        {
            if (onYes != null)
            {
                onYes.Invoke();
            }

            Close();
        }
Exemplo n.º 13
0
        public virtual void OnPointerClick()
        {
            if (Time.time < touchStartTime + DisposeTouchTime)
            {
                OnButtonClick?.Invoke();
            }

            touchStartTime  = 0f;
            toolIcon.sprite = buttonSpriteSet.normal;
        }
Exemplo n.º 14
0
        private void Button_Click(object sender, EventArgs e)
        {
            var button     = (Button)sender;
            var buttonInfo = (ButtonInfo)button.Tag;

            OnButtonClick?.Invoke(this, new ButtonPressedEventArgs()
            {
                ButtonInfo = buttonInfo
            });
        }
Exemplo n.º 15
0
 private void ButtonClick(UIComponent component, UIMouseEventParameter eventParam)
 {
     if (component is UIButton button)
     {
         var index = Buttons.IndexOf(button);
         if (index != -1)
         {
             OnButtonClick?.Invoke(index);
         }
     }
 }
Exemplo n.º 16
0
    private void ButtonClick(int position)
    {
        selectedButton.Image.color = Color.white;
        selectedButton             = ConfigButtons[position];
        selectedButton.Image.color = selectedColor;

        if (OnButtonClick != null)
        {
            OnButtonClick.Invoke(position);
        }
    }
        private void CancelButton_OnClick(object sender, RoutedEventArgs e)
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

            Globals.Chem4WordV3.Telemetry.Write(module, "Action", "Triggered");

            WpfEventArgs args = new WpfEventArgs();

            args.Button      = "Cancel";
            args.OutputValue = "";

            OnButtonClick?.Invoke(this, args);
        }
Exemplo n.º 18
0
        private void Save_OnClick(object sender, RoutedEventArgs e)
        {
            // Copy current model values to options before saving
            Options.BondLength         = (int)SettingsModel.CurrentBondLength;
            Options.ShowMoleculeGroups = SettingsModel.ShowMoleculeGroups;
            FileUtils.SaveAcmeSettings(Options, Telemetry, TopLeft);
            Options.Dirty = false;

            WpfEventArgs args = new WpfEventArgs();

            args.Button      = "SAVE";
            args.OutputValue = "";
            OnButtonClick?.Invoke(this, args);
        }
Exemplo n.º 19
0
        private void ButtonClicked(object sender, RoutedEventArgs e)
        {
            var retvals = new MyControlEventArgs(true,
                                                 txtName.Text,
                                                 txtAddress.Text,
                                                 txtCity.Text,
                                                 txtState.Text,
                                                 txtZip.Text);

            if (sender == btnCancel)
            {
                retvals.IsOk = false;
            }
            OnButtonClick?.Invoke(this, retvals);
        }
Exemplo n.º 20
0
        private void Cancel_OnClick(object sender, RoutedEventArgs e)
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

            try
            {
                WpfEventArgs args = new WpfEventArgs();
                args.OutputValue = "";
                args.Button      = "Cancel";

                OnButtonClick?.Invoke(this, args);
            }
            catch (Exception ex)
            {
                new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
            }
        }
Exemplo n.º 21
0
        private int _levelIndex;                        //индекс уровня на который указывает кнопка

        /// <summary>
        /// Установка информации об уровне на кнопку
        /// </summary>
        /// <param name="index">Номер уровня</param>
        /// <param name="label">Сообщение к уровню</param>
        /// <param name="score">колличество очков</param>
        public void SetLevelButton(int index, string label, int score)
        {
            //Установка названия
            _levelName.text = "LEVEL " + (index + 1).ToString();
            //Создание анонимного метода при нажатии кнопки на вызов делегата с передачей индекса уровня
            _levelIndex = index;
            _button.onClick.AddListener(delegate { onButtonClickEvent?.Invoke(_levelIndex); });

            //Установка данных об уровне
            _levelLabel.text = label;
            if (score >= 0)
            {
                _levelScoreLabel.text = "SCORE: " + score;
            }
            else
            {
                _levelScoreLabel.text = "";
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Updates the status of the button: either away, hovered, or clicked
        /// </summary>
        private void UpdateButtonStatus()
        {
            if (status != ButtonStatus.Clicked)
            {
                MouseState state = Mouse.GetState();
                if (state.X >= rect.X && state.X <= rect.X + rect.Width &&
                    state.Y >= rect.Y && state.Y <= rect.Y + rect.Height)
                {
                    status = state.LeftButton == ButtonState.Pressed ? ButtonStatus.Clicked : ButtonStatus.Hovered;

                    if (state.LeftButton == ButtonState.Pressed)
                    {
                        OnButtonClick?.Invoke(this);
                    }
                }
                else
                {
                    status = ButtonStatus.Away;
                }
            }
        }
Exemplo n.º 23
0
 /// <summary>
 /// Encapsulates what happens when a button get effectively clicked. It is for example called from OnPointerClick.
 /// </summary>
 protected virtual void ButtonClicked()
 {
     if (doubleclicktimer > 0)
     {
         if (OnDoubleButtonClick != null)
         {
             OnDoubleButtonClick.Invoke();
         }
     }
     else
     {
         if (togglable)
         {
             OnTogglableButtonValueChanged(!IsOn);
         }
         if (OnButtonClick != null)
         {
             OnButtonClick.Invoke();
         }
     }
     doubleclicktimer = GameManager.Instance.doubleClickMaxTime;
 }
Exemplo n.º 24
0
 private void CreateButtons(string[] buttons)
 {
     if (buttonsPanel != null)
     {
         foreach (string name in buttons)
         {
             var btn = new Project1UIButton();
             btn.Content = name;
             btn.Margin  = new Thickness(10, 0, 0, 0);
             btn.Click  += (e, c) =>
             {
                 IsButtonClicked = true;
                 OnButtonClick?.Invoke(name, this);
             };
             if ((buttons.Last() != name))
             {
                 btn.Style = (Style)this.FindResource("basic");
             }
             buttonsPanel.Children.Add(btn);
         }
     }
 }
Exemplo n.º 25
0
        private void Ok_OnClick(object sender, RoutedEventArgs e)
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

            try
            {
                if (!_loading)
                {
                    if (_saveSettings)
                    {
                        SaveSettings();
                    }

                    WpfEventArgs args = new WpfEventArgs();

                    // Set defaults if fetch fails
                    args.OutputValue = "";
                    args.Button      = "Cancel";

                    object obj = ExecuteJavaScript("GetJSON");
                    if (obj != null)
                    {
                        string mol = obj.ToString();
                        if (!string.IsNullOrEmpty(mol))
                        {
                            args.OutputValue = mol;
                            args.Button      = "OK";

                            OnButtonClick?.Invoke(this, args);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
            }
        }
Exemplo n.º 26
0
        public void OnClick(object sender, ClickChecker checker)
        {
            if (IsActive == false)
            {
                return;
            }

            if (checker.IsEndCheck == true)
            {
                if (IsAllowDuplicateClick == false)
                {
                    return;
                }
            }

            bool isMouseInside =
                rectCollider.IsMouseOver(Vector3.TransformCoordinate(-ButtonTexture.Center, GetWorldMatrix()));

            if (isMouseInside)
            {
                checker.IsEndCheck = true;
                OnButtonClick?.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 27
0
 /// <summary>
 /// Raises the events.
 /// </summary>
 public override void RaiseEvents()
 {
     OnButtonClick?.Invoke();
 }
Exemplo n.º 28
0
 public void Click()
 {
     OnButtonClick?.Invoke();
 }
Exemplo n.º 29
0
 protected virtual void HandleButtonClick()
 {
     OnButtonClick?.Invoke();
 }
Exemplo n.º 30
0
 /// <summary>
 /// Set current value.
 /// </summary>
 /// <param name="value">Value to set.</param>
 public void SetValue(string value)
 {
     SetValueWithoutNotify(value);
     OnButtonClick?.Invoke();
 }