private void importCustomButtonsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (CustomButtons.Import())
     {
         RefreshCustomButtons();
         CustomButtons.SaveFile();
     }
 }
 private void RemoveButton_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(Strings.BoxDeleteCustomButtonText, Strings.BoxDeleteCustomButtonTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         CustomButtons.Remove(CustomButton);
         CustomButtons.SaveFile();
         form.RefreshCustomButtons();
     }
 }
Example #3
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.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.ToolTip     = TbToolTip.Text;
                inedit.EnableStyle = (CustomButton.EnableStyles)CbEStyles.SelectedItem;
                inedit.ButtonType  = (CustomButton.ButtonTypes)CbByttonType.SelectedItem;
            }

            CustomButtons.SaveFile();

            Close();
        }