protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); if (e.KeyCode == Keys.Enter && AcceptButton != null && lastAcceptForm == null) { lastAcceptForm = this; // Start timer that will reset the last form with the accept button. if (lastAcceptFormTimer != null) { lastAcceptFormTimer.Dispose(); } lastAcceptFormTimer = new Timer(); lastAcceptFormTimer.Interval = 1000; // Interval between the accepting forms. lastAcceptFormTimer.Tick += (sender, args) => { lastAcceptForm = null; lastAcceptFormTimer.Dispose(); lastAcceptFormTimer = null; }; lastAcceptFormTimer.Start(); AcceptButton.PerformClick(); } if (e.KeyCode == Keys.Escape && CancelButton != null) { CancelButton.PerformClick(); } }
private void workspaceToolWindowControl1_TreeListViewDoubleClicked(object sender, MouseEventArgs e) { if (SelectedWorkspace != null) { AcceptButton.PerformClick(); } }
public ChangePasswordForm(UserModel user, IMessageInject message) { InitializeComponent(); User = user; this.message = message; BackColor = FormBrushes.WindowBackGroundColor; ForeColor = FormBrushes.WindowForegroundColor; Font = FormBrushes.DefaultRegularFont; OldPassPanel.BackColor = FormBrushes.WindowBackGroundColor; OldPassPanel.ForeColor = FormBrushes.WindowForegroundColor; OldPassPanel.Font = FormBrushes.DefaultRegularFont; NewPassPanel.BackColor = FormBrushes.WindowBackGroundColor; NewPassPanel.ForeColor = FormBrushes.WindowForegroundColor; NewPassPanel.Font = FormBrushes.DefaultRegularFont; ConfPassPanel.BackColor = FormBrushes.WindowBackGroundColor; ConfPassPanel.ForeColor = FormBrushes.WindowForegroundColor; ConfPassPanel.Font = FormBrushes.DefaultRegularFont; OldPassPanel.SetDefaultColorForChildren(); NewPassPanel.SetDefaultColorForChildren(); ConfPassPanel.SetDefaultColorForChildren(); AcceptButton.SetDefaultColor(); DeclineButton.SetDefaultColor(); AcceptButton.Click += AcceptButtonClick; DeclineButton.Click += DeclineButtonClick; }
/// <summary> /// Handles the Click event of the updateButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void updateButton_Click(object sender, EventArgs e) { if (AcceptButton != null) { return; } CashValue cost; CashValue price; if (!CashValue.TryParse((double)costNum.Value, out cost)) { MessageBox.Show("Failed to parse Cash Value for cost!", "Notice!"); return; } if (!CashValue.TryParse((double)priceNum.Value, out price)) { MessageBox.Show("Failed to parse Price Value for cost!", "Notice!"); return; } m_product.Cost = cost; m_product.Price = price; m_product.ItemName = itemNameBox.Text; m_product.Quantity = (int)quantityNum.Value; m_inventory.UpdateInventory(); m_register.Save(); AcceptButton = updateButton; AcceptButton.DialogResult = DialogResult.OK; AcceptButton.PerformClick(); }
private void TextBox_EnterClears_OnKeyDownHandler(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { AcceptButton.Focus(); } }
public void AddInmate(string name, string birthd, string sex, string alias) { LastNameTextBox.Click(); Delay.Seconds(1); LastNameTextBox.PressKeys(name); LastNameTextBox.PressKeys("{enter}"); Delay.Seconds(2); BirthdTextBox.Click(); Delay.Seconds(1); BirthdTextBox.PressKeys(birthd); BirthdTextBox.PressKeys("{enter}"); Delay.Seconds(2); SexTextBox.Click(); Delay.Seconds(2); SexTextBox.PressKeys(sex); SexTextBox.PressKeys("{enter}"); Delay.Seconds(2); AliasTextBox.Click(); Delay.Seconds(2); AliasTextBox.PressKeys(alias); AliasTextBox.PressKeys("{enter}"); Delay.Seconds(2); AcceptButton.Click(); ConfirmYesNoRequest(); Delay.Seconds(2); AcceptButton.Click(); }
private void submittedChangelistsToolWindowControl1_TreeListViewDoubleClicked(object sender, MouseEventArgs e) { if (SelectedChangelist != null) { AcceptButton.PerformClick(); } }
private void ReArrangeButtonPosition() { if (AcceptButton.Visibility == Visibility.Visible && CancelButton.Visibility == Visibility.Collapsed) { AcceptButton.SetValue(Grid.ColumnProperty, 2); } }
protected override bool ProcessDialogChar(char charCode) { // Shortcut keys, kinda like mnemonics, except you don't have to press Alt if ((charCode == 'N' || charCode == 'n') && (CancelButton != null && (CancelButton as Button).Text == "No")) { CancelButton.PerformClick(); } else if ((charCode == 'Y' || charCode == 'y') && (AcceptButton as Button).Text == "Yes") { AcceptButton.PerformClick(); } else if ((charCode == 'A' || charCode == 'a') && (CancelButton != null && (CancelButton as Button).Text == "Abort")) { CancelButton.PerformClick(); } else if ((charCode == 'R' || charCode == 'r') && (AcceptButton as Button).Text == "Retry") { AcceptButton.PerformClick(); } else if ((charCode == 'I' || charCode == 'i') && buttons.Length >= 3 && buttons[2].Text == "Ignore") { buttons[2].PerformClick(); } return(base.ProcessDialogChar(charCode)); }
private void btnAccept_Click(object sender, EventArgs e) { Reset(); // Trigger event AcceptButton?.Invoke(sender, e); }
private void ValueTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { AcceptButton.Focus(); } }
private void swarmReviewsToolWindowControl1_ReviewsLV_DoubleClick(object sender, EventArgs e) { if (SelectedReview != null) { AcceptButton.PerformClick(); } }
void ReleaseDesignerOutlets() { if (AcceptButton != null) { AcceptButton.Dispose(); AcceptButton = null; } if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (TextView != null) { TextView.Dispose(); TextView = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } }
private void keyDataGridView_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { AcceptButton.PerformClick(); e.Handled = true; } }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.Enter && AcceptButton != null) { AcceptButton.PerformClick(); } return(base.ProcessCmdKey(ref msg, keyData)); }
private void btnOpen_Click(object sender, EventArgs e) { Reset(); Process.Start("explorer.exe", _folder); // Trigger event AcceptButton?.Invoke(sender, e); }
private void PrepareOk(GfycatPreset preset) { TitleTextBox.Text = preset.DefaultTitle; DescriptionTextBox.Text = preset.DefaultDescription; TagsTextBox.Text = preset.DefaultTags; IsPrivateCheckBox.IsChecked = preset.DefaultIsPrivate; CancelButton.Visibility = Visibility.Collapsed; AcceptButton.Focus(); }
private void closeCountDownTimer_Tick(object sender, EventArgs e) { updateVisualCountDownTimer.Stop(); closeCountDownTimer.Stop(); if (AcceptButton != null) { AcceptButton.PerformClick(); } }
private void customTreeViewEx_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { var entry = e.Node.Tag as PwEntry; if (entry != null) { AcceptButton.PerformClick(); } }
private void Timer_Tick(object sender, EventArgs e) { m_Counter++; UpdateLabel(); // ReSharper disable once PossibleLossOfFraction if (Duration > 0 && m_Counter * m_Timer.Interval / 1000 > Duration) { AcceptButton?.PerformClick(); } }
void ListViewControl_DoubleClick(object sender, EventArgs e) { if (e is MouseEventArgs) { MouseEventArgs mouseArgs = (MouseEventArgs)e; if (mouseArgs.Button == MouseButtons.Left) { AcceptButton.PerformClick(); } } }
private void cbxLicenseType_SelectedIndexChanged(object sender, EventArgs e) { if (cbxLicenseType.Items.Count != 2) { lblCompanyUserName.Text = "Name"; } else { lblCompanyUserName.Text = companyUserName[cbxLicenseType.SelectedIndex]; } AcceptButton.PerformClick(); }
public void AddInmate(string name) { LastNameTextBox.Click(); Delay.Seconds(2); LastNameTextBox.PressKeys(name); LastNameTextBox.PressKeys("{enter}"); Delay.Seconds(2); AcceptButton.Click(); ConfirmYesNoRequest(); Delay.Seconds(2); AcceptButton.Click(); }
private void completeReturnButton_click(object sender, EventArgs e) { if (AcceptButton != null) { return; } var cashValue = 0; foreach (Product p in m_products) { cashValue += p.Quantity * p.Price.Value; } CashValue total = new CashValue(cashValue); if (m_register.Cash.GetCashValue().Value < total.Value) { MessageBox.Show("You need more money to pay for all this than you have", "Notice!"); return; } MoneySelectorUI moneySelector = new MoneySelectorUI(ref m_register, total, true, true); DialogResult tempDR = moneySelector.ShowDialog(); if (tempDR != DialogResult.OK) { return; } var payment = moneySelector.Cash; m_register.Cash.Debit(payment.GetCashValue()); foreach (Product p in m_register.Products) { var product = m_products.SingleOrDefault(pro => pro.SN.Equals(p.SN)); if (product == null) { continue; } p.Quantity += product.Quantity; } m_register.Save(); m_inventory.UpdateInventory(); m_report.UpdateReport(); AcceptButton = completeReturn; AcceptButton.DialogResult = DialogResult.OK; AcceptButton.PerformClick(); }
public async Task <bool> WaitUntilClosedAsync() { var isAccepted = await Observable.Merge( AcceptButton.Events() .Click .Select(_ => true), CancelButton.Events() .Click .Select(_ => false)).FirstAsync(); return(isAccepted); }
protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); if (e.KeyCode == Keys.Enter && AcceptButton != null) { AcceptButton.PerformClick(); } if (e.KeyCode == Keys.Escape && CancelButton != null) { CancelButton.PerformClick(); } }
internal override void KeyUp(KeyEventArgs e) { base.KeyUp(e); if ((e.KeyCode == Keys.Enter) && (AcceptButton != null)) { AcceptButton.DoClick(); } if ((e.KeyCode == Keys.Escape) && (CancelButton != null)) { CancelButton.DoClick(); } }
private void disconButton_Click(object sender, EventArgs e) { if (AcceptButton != null) { return; } try { m_product = listOfProducts.Items[listOfProducts.SelectedIndex] as Product; } catch { return; } DialogResult tempDR; tempDR = MessageBox.Show("Are you sure you want to discontinue " + m_product + ".", "Confirm", MessageBoxButtons.YesNo); if (tempDR == DialogResult.Yes) { if (m_product.Quantity > 0) { CashValue returnCash = new CashValue(m_product.Cost.Value * m_product.Quantity); MessageBox.Show("Please chose how you will get your money back.", "Notice"); MoneySelectorUI selector = new MoneySelectorUI(ref m_register, returnCash, true, false); tempDR = selector.ShowDialog(); if (tempDR != DialogResult.OK) { return; } m_register.Cash.Credit(selector.Cash); MessageBox.Show(selector.Cash.GetCashValue() + " was added to your register", "Notice"); } m_product.Discontinued = true; m_product.Quantity = 0; m_report.UpdateReport(); m_inventory.UpdateInventory(); } m_register.Save(); AcceptButton = disconButton; AcceptButton.DialogResult = DialogResult.OK; AcceptButton.PerformClick(); }
protected override void OnKeyDown(KeyEventArgs e) { if (e is null) { throw new ArgumentNullException(nameof(e)); } if (e.KeyCode == Keys.Enter) { AcceptButton.PerformClick(); e.Handled = true; } base.OnKeyDown(e); }
protected override bool ProcessKeyPreview(ref Message m) { if (m.Msg == WM_KEYDOWN) { switch ((ConsoleKey)m.WParam.ToInt32()) { case ConsoleKey.Enter: if (AcceptButton != null) { AcceptButton.PerformClick(); } break; } } return(base.ProcessKeyPreview(ref m)); }