Exemple #1
0
        private void EnterKeyPressedInPromoCode(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                if (PromoCodeText2.TextLength == 0 && AddToCartButton.Text == "Add to Cart")
                {
                    DialogResult quick_question =
                        MessageBox.Show("Did you mean to not apply a promocode?", "Question",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                    if (quick_question == DialogResult.Yes)
                    {
                        AddToCartButton.PerformClick();
                    }
                    else
                    {
                        PromoCodeText2.Focus();
                    }
                }
                else
                {
                    AddToCartButton.PerformClick();
                }
            }
        }
Exemple #2
0
        protected override bool ProcessTabKey(bool forward)
        {
            if (Game[1].Focused || Game[3].Focused || AddToCartButton.Focused)
            {
                if (forward)
                {
                    if (Game[1].Focused)
                    {
                        return(base.ProcessTabKey(forward));
                    }

                    if (Game3.Focused && SubscriptionsGrouping.Visible)
                    {
                        Game[1].Focus();
                    }

                    if (Game[3].Focused)
                    {
                        PromoCodeText2.Focus();
                    }

                    if (AddToCartButton.Focused)
                    {
                        Game[1].Focus();
                    }
                }
                else
                {
                    if (Game[1].Focused || Game[3].Focused)
                    {
                        PromoCodeText2.Focus();
                    }
                    else
                    {
                        return(base.ProcessTabKey(forward));
                    }
                }

                return(true);
            }

            if (SubscriptionChoicesForGame[1].Focused || SubscriptionChoicesForGame[2].Focused || SubscriptionChoicesForGame[3].Focused)
            {
                if (forward)
                {
                    int key = 0;

                    foreach (ComboBox ComboBox in SubscriptionChoicesForGame.Values)
                    {
                        if (ComboBox.Focused)
                        {
                            key = SubscriptionChoicesForGame.Where(x => x.Value.Name == ComboBox.Name).First().Key;
                        }
                    }

                    if (key >= 3)
                    {
                        key = 0;
                    }

                    for (int i = key; i <= key; i++)
                    {
                        Game[i + 1].Focus();
                    }
                }
                else
                {
                    PromoCodeText2.Focus();
                }

                return(true);
            }

            return(base.ProcessTabKey(forward));
        }