Esempio n. 1
0
        /// <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();
        }
Esempio n. 2
0
            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));
            }
Esempio n. 3
0
 private void swarmReviewsToolWindowControl1_ReviewsLV_DoubleClick(object sender, EventArgs e)
 {
     if (SelectedReview != null)
     {
         AcceptButton.PerformClick();
     }
 }
Esempio n. 4
0
 private void workspaceToolWindowControl1_TreeListViewDoubleClicked(object sender, MouseEventArgs e)
 {
     if (SelectedWorkspace != null)
     {
         AcceptButton.PerformClick();
     }
 }
Esempio n. 5
0
 private void submittedChangelistsToolWindowControl1_TreeListViewDoubleClicked(object sender, MouseEventArgs e)
 {
     if (SelectedChangelist != null)
     {
         AcceptButton.PerformClick();
     }
 }
Esempio n. 6
0
        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();
            }
        }
Esempio n. 7
0
 private void keyDataGridView_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         AcceptButton.PerformClick();
         e.Handled = true;
     }
 }
Esempio n. 8
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (keyData == Keys.Enter && AcceptButton != null)
     {
         AcceptButton.PerformClick();
     }
     return(base.ProcessCmdKey(ref msg, keyData));
 }
Esempio n. 9
0
        private void customTreeViewEx_NodeMouseDoubleClick(object sender,
                                                           TreeNodeMouseClickEventArgs e)
        {
            var entry = e.Node.Tag as PwEntry;

            if (entry != null)
            {
                AcceptButton.PerformClick();
            }
        }
        private void closeCountDownTimer_Tick(object sender, EventArgs e)
        {
            updateVisualCountDownTimer.Stop();
            closeCountDownTimer.Stop();

            if (AcceptButton != null)
            {
                AcceptButton.PerformClick();
            }
        }
Esempio n. 11
0
 void ListViewControl_DoubleClick(object sender, EventArgs e)
 {
     if (e is MouseEventArgs)
     {
         MouseEventArgs mouseArgs = (MouseEventArgs)e;
         if (mouseArgs.Button == MouseButtons.Left)
         {
             AcceptButton.PerformClick();
         }
     }
 }
Esempio n. 12
0
        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();
            }
        }
Esempio n. 13
0
 private void cbxLicenseType_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbxLicenseType.Items.Count != 2)
     {
         lblCompanyUserName.Text = "Name";
     }
     else
     {
         lblCompanyUserName.Text = companyUserName[cbxLicenseType.SelectedIndex];
     }
     AcceptButton.PerformClick();
 }
Esempio n. 14
0
        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();
        }
Esempio n. 15
0
        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();
            }
        }
Esempio n. 16
0
        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();
        }
Esempio n. 17
0
        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);
        }
Esempio n. 18
0
 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));
 }
Esempio n. 19
0
        private void cbxProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            KeygenBase    platform = (KeygenBase)cbxPlatform.SelectedItem;
            KeygenProduct product  = (KeygenProduct)cbxProduct.SelectedItem;

            cbxLicenseType.Enabled = false;
            cbxLicenseType.Items.Clear();
            var LicenceTypes = platform.GenerateLicencetypes(product);

            foreach (string type in LicenceTypes)
            {
                cbxLicenseType.Items.Add(type);
            }
            cbxLicenseType.Enabled       = true;
            cbxLicenseType.SelectedIndex = 0;
            AcceptButton.PerformClick();
        }
        /// <summary>
        /// Handle key presses on the <see cref="FindReplaceDialog"/> and raise the <see cref="Control.KeyDown"/> event.
        /// </summary>
        /// <param name="e">The key info about the key(s) pressed.</param>
        protected override void OnKeyDown(KeyEventArgs e)
        {
            // Raise KeyPressed event so it can be handled externally
            KeyPressed?.Invoke(this, e);

            // Handle dialog-specific keys
            if (e.KeyCode == Keys.Escape)
            {
                Hide();
            }
            // Workaround because AcceptButton property does not properly handle this in all external containers
            else if (e.KeyCode == Keys.Enter)
            {
                AcceptButton.PerformClick();
            }

            base.OnKeyDown(e);
        }
Esempio n. 21
0
        /// <summary>
        /// Handles the Click event of the connectButton 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 connectButton_Click(object sender, EventArgs e)
        {
            if (AcceptButton == connectButton)
            {
                return;
            }

            if (tabControl.SelectedIndex == 1)
            {
                m_returnRecord          = XMLRecords.Instance;
                XMLRecords.FileLocation = xmlFileLocationBox.Text;
                if (XMLRecords.UseValidation)
                {
                    XMLRecords.SchemaLocation = schemaLocationBox.Text;
                }
            }
            else
            {
                DBRecord.ConnectionString = String.Format("Server={0};Database={1};User ID={2};Password={3};",
                                                          serverLocationBox.Text,
                                                          databaseNameBox.Text,
                                                          usernameBox.Text,
                                                          passwordBox.Text);

                m_returnRecord = DBRecord.Instance;
            }
            Exception exc = null;

            if (!m_returnRecord.Test(out exc))
            {
                MessageBox.Show(exc.Message,
                                "ERROR!",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            else
            {
                AcceptButton = connectButton;
                AcceptButton.DialogResult = DialogResult.OK;
                AcceptButton.PerformClick();
            }
        }
Esempio n. 22
0
            private void NameKeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    SelectedIndex++;
                    if (SelectedIndex != -1)
                    {
                        e.Handled          = true;
                        e.SuppressKeyPress = true;
                        NameBox.SelectAll();
                    }
                    else
                    {
                        AcceptButton.PerformClick();
                    }
                }
                else if (e.KeyCode == Keys.Down)
                {
                    SelectedIndex++;
                    if (SelectedIndex == -1 && listViewChain.Items.Count > 0)
                    {
                        SelectedIndex = 0;
                    }

                    e.Handled          = true;
                    e.SuppressKeyPress = true;
                    NameBox.SelectAll();
                }
                else if (e.KeyCode == Keys.Up)
                {
                    SelectedIndex--;
                    if (SelectedIndex == -1)
                    {
                        SelectedIndex = listViewChain.Items.Count - 1;
                    }

                    e.Handled          = true;
                    e.SuppressKeyPress = true;
                    NameBox.SelectAll();
                }
            }
Esempio n. 23
0
 private void IssueListView_DoubleClick(object sender, EventArgs e)
 {
     AcceptButton.PerformClick();
 }
Esempio n. 24
0
 private void frmMain_Shown(object sender, EventArgs e)
 {
     AcceptButton.PerformClick();
 }
Esempio n. 25
0
 private void lbxRefs_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     AcceptButton.PerformClick();
 }
Esempio n. 26
0
 void t_Close_Tick(object sender, EventArgs e)
 {
     AcceptButton.PerformClick();
 }
Esempio n. 27
0
 private void keyDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     keyDataGridView.Rows[e.RowIndex].Selected = true;
     AcceptButton.PerformClick();
 }
Esempio n. 28
0
 private void mapLocationListView_DoubleClick(object sender, EventArgs e)
 {
     AcceptButton.PerformClick();
 }
Esempio n. 29
0
        private void completeShipmentButton_Click(object sender, EventArgs e)
        {
            if (AcceptButton != null)
            {
                return;
            }

            var cashValue = 0;

            foreach (Product p in m_products)
            {
                cashValue += p.Quantity * p.Cost.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;
            }

            Money unlim = new Money(new TwentyDollarBills(100),
                                    new TenDollarBills(100),
                                    new FiveDollarBills(100),
                                    new OneDollarBills(100),
                                    new Quarters(100),
                                    new Dimes(100),
                                    new Nickels(100),
                                    new Pennies(100));

            MoneySelectorUI moneySelector = new MoneySelectorUI(ref m_register, total, false, true);
            DialogResult    tempDR        = moneySelector.ShowDialog();

            if (tempDR != DialogResult.OK)
            {
                return;
            }

            var payment = moneySelector.Cash;

            var change = unlim.Credit(total, payment);

            m_register.Cash.Debit(payment);

            if (change.GetCashValue().Value != 0)
            {
                ChangeForm cf = new ChangeForm(change);
                cf.ShowDialog();
            }

            m_register.Cash.Credit(change);

            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 = completeShipmentButton;
            AcceptButton.DialogResult = DialogResult.OK;
            AcceptButton.PerformClick();
        }
 private void processDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     AcceptButton.PerformClick();
 }