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); }; }
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); }
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(); } }
public void ButtonClick() { if (Enabled) { OnButtonClick?.Invoke(); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (OnButtonClick != null) { OnButtonClick.Invoke(this, new TextEventArgs(MessageTextBox.Text)); } }
//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); }
public static void ButtonClick() { if (!PlayerProfile.sounds) { return; } OnButtonClick.Invoke(); }
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; }
private void Cancel_OnClick(object sender, RoutedEventArgs e) { AcmeOptions.Dirty = false; WpfEventArgs args = new WpfEventArgs(); args.Button = "CANCEL"; args.OutputValue = ""; OnButtonClick?.Invoke(this, args); }
public void No() { if (onNo != null) { onNo.Invoke(); } Close(); }
public void Yes() { if (onYes != null) { onYes.Invoke(); } Close(); }
public virtual void OnPointerClick() { if (Time.time < touchStartTime + DisposeTouchTime) { OnButtonClick?.Invoke(); } touchStartTime = 0f; toolIcon.sprite = buttonSpriteSet.normal; }
private void Button_Click(object sender, EventArgs e) { var button = (Button)sender; var buttonInfo = (ButtonInfo)button.Tag; OnButtonClick?.Invoke(this, new ButtonPressedEventArgs() { ButtonInfo = buttonInfo }); }
private void ButtonClick(UIComponent component, UIMouseEventParameter eventParam) { if (component is UIButton button) { var index = Buttons.IndexOf(button); if (index != -1) { OnButtonClick?.Invoke(index); } } }
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); }
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); }
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); }
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(); } }
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 = ""; } }
/// <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; } } }
/// <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; }
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); } } }
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(); } }
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); } }
/// <summary> /// Raises the events. /// </summary> public override void RaiseEvents() { OnButtonClick?.Invoke(); }
public void Click() { OnButtonClick?.Invoke(); }
protected virtual void HandleButtonClick() { OnButtonClick?.Invoke(); }
/// <summary> /// Set current value. /// </summary> /// <param name="value">Value to set.</param> public void SetValue(string value) { SetValueWithoutNotify(value); OnButtonClick?.Invoke(); }