Example #1
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (keyData == Keys.Enter)
     {
         if (!(this.current_focused_control is Button))
         {
             if (this.current_focused_control.Name == this.mskNewSernum.Name)
             {
                 if (ValidateSN.Check(this.mskNewSernum.Text))
                 {
                     SendKeys.Send("{TAB}");
                     return(true);
                 }
             }
             else
             {
                 SendKeys.Send("{TAB}");
                 return(true);
             }
         }
     }
     if (keyData == Keys.Escape)
     {
         this.DialogResult = DialogResult.Cancel;
         this.Close();
         return(true);
     }
     return(base.ProcessCmdKey(ref msg, keyData));
 }
Example #2
0
        public GenerateSNForm(SnWindow parent_window)
        {
            InitializeComponent();
            this.parent_window = parent_window;
            this.G             = this.parent_window.G;
            this.BackColor     = ColorResource.BACKGROUND_COLOR_BEIGE;
            //this.chkCDTraining.CheckState = CheckState.Checked;

            this.mskSernum.Enter  += new EventHandler(this.onControlEnterHandler);
            this.numQty.Enter     += new EventHandler(this.onControlEnterHandler);
            this.txtVersion.Enter += new EventHandler(this.onControlEnterHandler);
            this.txtDealer.Enter  += new EventHandler(this.onControlEnterHandler);

            this.txtVersion.Leave += new EventHandler(this.onControlLeaveHandler);
            this.numQty.Leave     += new EventHandler(this.onControlLeaveHandler);
            this.mskSernum.Leave  += new EventHandler(this.onControlLeaveHandler);
            this.txtDealer.Leave  += new EventHandler(this.onControlLeaveHandler);

            this.mskSernum.GotFocus     += new EventHandler(this.onControlFocusedHandler);
            this.numQty.GotFocus        += new EventHandler(this.onControlFocusedHandler);
            this.txtVersion.GotFocus    += new EventHandler(this.onControlFocusedHandler);
            this.txtDealer.GotFocus     += new EventHandler(this.onControlFocusedHandler);
            this.chkCDTraining.GotFocus += new EventHandler(this.onControlFocusedHandler);
            this.chkNewRwt.GotFocus     += new EventHandler(this.onControlFocusedHandler);
            this.chkNewRwtJob.GotFocus  += new EventHandler(this.onControlFocusedHandler);
            this.btnOK.GotFocus         += new EventHandler(this.onControlFocusedHandler);;
            this.btnCancel.GotFocus     += new EventHandler(this.onControlFocusedHandler);

            this.mskSernum.Leave += new EventHandler(this.validateSernumFieldLeave);
            this.txtDealer.Leave += new EventHandler(this.validateDealerFieldLeave);

            this.chkNewRwt.CheckedChanged    += new EventHandler(this.onCheckBoxStateChange);
            this.chkNewRwtJob.CheckedChanged += new EventHandler(this.onCheckBoxStateChange);

            this.getDealer();

            this.numQty.Leave += delegate
            {
                if (this.numQty.Text.Length == 0)
                {
                    this.numQty.Text = "1";
                }
            };
            this.txtVersion.Leave += delegate
            {
                if (this.txtVersion.Text.Length == 0)
                {
                    if (ValidateSN.Check(this.mskSernum.Text))
                    {
                        this.txtVersion.Text = this.mskSernum.Text.Substring(2, 1) + "." + this.mskSernum.Text.Substring(3, 1);
                    }
                }
            };

            this.form_mode = FORM_MODE.EDIT;
        }
Example #3
0
 private void validateSernumFieldLeave(object sender, EventArgs e)
 {
     if (!ValidateSN.Check(((MaskedTextBox)sender).Text))
     {
         ((MaskedTextBox)sender).Focus();
         this.txtVersion.Text = "";
     }
     else
     {
         this.txtVersion.Text = ((MaskedTextBox)sender).Text.Substring(2, 1) + "." + ((MaskedTextBox)sender).Text.Substring(3, 1);
     }
 }
Example #4
0
 private void validateSernum(object sender, EventArgs e)
 {
     if (ValidateSN.Check(((MaskedTextBox)sender).Text))
     {
         string version = this.mskNewSernum.Text.Substring(2, 1) + "." + this.mskNewSernum.Text.Substring(3, 1);
         this.txtVersion.Text = version;
         this.btnOK.Enabled   = true;
     }
     else
     {
         this.btnOK.Enabled = false;
         ((MaskedTextBox)sender).Focus();
     }
 }
        private void UpgradeProgramForm_Load(object sender, EventArgs e)
        {
            this.BackColor          = ColorResource.BACKGROUND_COLOR_BEIGE;
            this.mskSernumFrom.Text = this.parent_window.serial.sernum;
            //this.chkCDTraining.CheckState = (this.parent_window.serial.expdat.tryParseToDateTime() ? CheckState.Unchecked : CheckState.Checked);

            this.mskSernumFrom.Enter += new EventHandler(this.onControlEnterHandler);
            this.mskSernumTo.Enter   += new EventHandler(this.onControlEnterHandler);
            this.txtVersion.Enter    += new EventHandler(this.onControlEnterHandler);

            this.mskSernumFrom.Leave += new EventHandler(this.onControlLeaveHandler);
            this.mskSernumTo.Leave   += new EventHandler(this.onControlLeaveHandler);
            this.txtVersion.Leave    += new EventHandler(this.onControlLeaveHandler);

            this.mskSernumTo.Leave += new EventHandler(this.validateSernumFieldLeave);

            this.mskSernumFrom.GotFocus += new EventHandler(this.onControlFocusedHandler);
            this.mskSernumTo.GotFocus   += new EventHandler(this.onControlFocusedHandler);
            this.txtVersion.GotFocus    += new EventHandler(this.onControlFocusedHandler);

            this.mskSernumFrom.GotFocus += new EventHandler(this.keepCurrentControlFocused);
            this.mskSernumTo.GotFocus   += new EventHandler(this.keepCurrentControlFocused);
            this.txtVersion.GotFocus    += new EventHandler(this.keepCurrentControlFocused);
            this.chkNewRwt.GotFocus     += new EventHandler(this.keepCurrentControlFocused);
            this.chkNewRwtJob.GotFocus  += new EventHandler(this.keepCurrentControlFocused);
            this.chkCDTraining.GotFocus += new EventHandler(this.keepCurrentControlFocused);
            this.btnOK.GotFocus         += new EventHandler(this.keepCurrentControlFocused);
            this.btnCancel.GotFocus     += new EventHandler(this.keepCurrentControlFocused);

            this.chkNewRwt.CheckStateChanged    += new EventHandler(this.onCheckBoxStateChange);
            this.chkNewRwtJob.CheckStateChanged += new EventHandler(this.onCheckBoxStateChange);

            this.txtVersion.Leave += delegate
            {
                if (this.txtVersion.Text.Length == 0)
                {
                    if (ValidateSN.Check(this.mskSernumTo.Text))
                    {
                        this.txtVersion.Text = this.mskSernumTo.Text.Substring(2, 1) + "." + this.mskSernumTo.Text.Substring(3, 1);
                    }
                    else
                    {
                        this.txtVersion.Text = "";
                    }
                }
            };
        }
Example #6
0
        private void SellProgram2nd_Load(object sender, EventArgs e)
        {
            this.BackColor = ColorResource.BACKGROUND_COLOR_BEIGE;
            this.form_mode = FORM_MODE.EDIT;
            this.lblDealer_Compnam.Text = "";
            this.mskOldSernum.Text      = this.parent_window.serial.sernum;
            this.msk2Sernum.Focus();

            this.msk2Sernum.Leave += new EventHandler(this.validateSernumFieldLeave);

            this.msk2Sernum.GotFocus += new EventHandler(this.onControlFocusedHandler);
            this.txtVersion.GotFocus += new EventHandler(this.onControlFocusedHandler);
            this.txtDealer.GotFocus  += new EventHandler(this.onControlFocusedHandler);
            this.btnOK.GotFocus      += new EventHandler(this.onControlFocusedHandler);
            this.btnCancel.GotFocus  += new EventHandler(this.onControlFocusedHandler);

            this.msk2Sernum.Enter += new EventHandler(this.onControlEnterHandler);
            this.txtVersion.Enter += new EventHandler(this.onControlEnterHandler);
            this.txtDealer.Enter  += new EventHandler(this.onControlEnterHandler);

            this.msk2Sernum.Leave += new EventHandler(this.onControlLeaveHandler);
            this.txtVersion.Leave += new EventHandler(this.onControlLeaveHandler);
            this.txtDealer.Leave  += new EventHandler(this.onControlLeaveHandler);

            this.txtVersion.Leave += delegate
            {
                if (this.txtVersion.Text.Length == 0)
                {
                    if (ValidateSN.Check(this.msk2Sernum.Text))
                    {
                        this.txtVersion.Text = this.msk2Sernum.Text.Substring(2, 1) + "." + this.msk2Sernum.Text.Substring(3, 1);
                    }
                    else
                    {
                        this.txtVersion.Text = "";
                    }
                }
            };

            this.txtDealer.Leave += new EventHandler(this.validateDealerField);
        }