예제 #1
0
        /// <summary>
        /// Takes part of the ischanged function for chkTech, prompts a user to enter the new tech field, then saves it in settings
        /// </summary>
        /// <param name="sender">frmMain</param>
        /// <param name="e">mnuEditTech</param>
        private void mnuEditTech_Click(object sender, EventArgs e)
        {
            using (frmTech techForm = new frmTech())
            {
                techForm.ShowDialog();

                if (techForm.technician == null || techForm.technician == "")
                {
                    MessageBox.Show("Technician(s) cannot be included on the label(s) if the technician field is empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Settings.Default.isChkTech  = false;
                    Settings.Default.technician = "";
                }
                else
                {
                    Settings.Default.technician = techForm.technician;
                }
                validateSettings();
            }
        }
예제 #2
0
        /// <summary>
        /// Handles the checking and unchecking of chkTech. Asks the user if they would like to change the
        /// technician field. If so, runs a form to take that requested input. Notices a technician field that is empty
        /// and force un-checks the box
        /// </summary>
        /// <param name="sender">frmMain</param>
        /// <param name="e">chkTech</param>
        /// <seealso cref="mnuEditTech_Click(object, EventArgs)"/>
        private void chkTech_Click(object sender, EventArgs e)
        {
            if (chkTech.Checked == true)
            {
                var selection = MessageBox.Show("Do you wish to change the default Technician(s)?", "Change Technician(s)?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (selection.Equals(DialogResult.Yes))
                {
                    using (frmTech techForm = new frmTech())
                    {
                        techForm.ShowDialog();

                        if (techForm.technician == null || techForm.technician == "")
                        {
                            MessageBox.Show("Technician(s) cannot be included on the label if the Technician(s) field is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Settings.Default.technician = "";
                            Settings.Default.isChkTech  = false;
                        }
                        else
                        {
                            Settings.Default.technician = techForm.technician;
                            Settings.Default.isChkTech  = true;
                        }
                    }
                }
                else if (selection == DialogResult.No && txtTech.Text.Equals(""))
                {
                    MessageBox.Show("Technician(s) cannot be included on the label if the Technician(s) Field is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Settings.Default.isChkTech = false;
                }
                else
                {
                    Settings.Default.isChkTech = true;
                }
            }
            else
            {
                Settings.Default.isChkTech = false;
            }
            validateSettings();
        }