Example #1
0
        private void BtnCreate_Click(object sender, EventArgs e)
        {
            if (TBGCode.Text.Trim().Length == 0)
            {
                System.Windows.Forms.MessageBox.Show(Strings.BoxCustomButtonPleaseGCodeText, Strings.BoxCustomButtonPleaseToolTipTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                TBGCode.Focus();
                return;
            }

            if (TBGCode2.Visible && TBGCode2.Text.Trim().Length == 0)
            {
                System.Windows.Forms.MessageBox.Show(Strings.BoxCustomButtonPleaseGCodeText, Strings.BoxCustomButtonPleaseToolTipTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                TBGCode2.Focus();
                return;
            }

            if (TbToolTip.Text.Trim().Length == 0)
            {
                System.Windows.Forms.MessageBox.Show(Strings.BoxCustomButtonPleaseToolTipText, Strings.BoxCustomButtonPleaseToolTipTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                TbToolTip.Focus();
                return;
            }

            if (inedit == null)
            {
                CustomButton cb = new CustomButton();
                cb.ButtonType  = (CustomButton.ButtonTypes)CbByttonType.SelectedItem;
                cb.GCode       = TBGCode.Text;
                cb.GCode2      = TBGCode2.Text;
                cb.Image       = BTOpenImage.Image;
                cb.Caption     = TbCaption.Text;
                cb.ToolTip     = TbToolTip.Text;
                cb.EnableStyle = (CustomButton.EnableStyles)CbEStyles.SelectedItem;
                CustomButtons.Add(cb);
            }
            else
            {
                inedit.GCode       = TBGCode.Text;
                inedit.GCode2      = TBGCode2.Text;
                inedit.Image       = BTOpenImage.Image;
                inedit.Caption     = TbCaption.Text;
                inedit.ToolTip     = TbToolTip.Text;
                inedit.EnableStyle = (CustomButton.EnableStyles)CbEStyles.SelectedItem;
                inedit.ButtonType  = (CustomButton.ButtonTypes)CbByttonType.SelectedItem;
            }

            CustomButtons.SaveFile();

            Close();
        }
Example #2
0
        private void BtnCreate_Click(object sender, EventArgs e)
        {
            if (inedit == null)
            {
                CustomButton cb = new CustomButton();
                cb.GCode       = TBGCode.Text;
                cb.Image       = BTOpenImage.Image;
                cb.ToolTip     = TbToolTip.Text;
                cb.EnableStyle = (CustomButton.EnableStyles)CbEStyles.SelectedItem;
                CustomButtons.Add(cb);
            }
            else
            {
                inedit.GCode       = TBGCode.Text;
                inedit.Image       = BTOpenImage.Image;
                inedit.ToolTip     = TbToolTip.Text;
                inedit.EnableStyle = (CustomButton.EnableStyles)CbEStyles.SelectedItem;
            }

            CustomButtons.SaveFile();

            Close();
        }