Example #1
0
        private void SerialConfig_FormClosing(object sender, FormClosingEventArgs e)
        {
            SerialSetupForm ssf = (SerialSetupForm)sender;

            if (ssf.DialogResult == DialogResult.OK)
            {
                Properties.Settings.Default.SerialPort   = (comboBox1.SelectedIndex > -1) ? comboBox1.SelectedItem.ToString() : null;
                Properties.Settings.Default.SerialRate   = int.Parse(comboBox2.SelectedItem.ToString());
                Properties.Settings.Default.SerialData   = (comboBox3.SelectedIndex == 0) ? 7 : 8;
                Properties.Settings.Default.SerialParity = (Parity)Enum.Parse(typeof(Parity), comboBox4.SelectedItem.ToString());
                Properties.Settings.Default.SerialStop   = (StopBits)Enum.Parse(typeof(StopBits), comboBox5.SelectedItem.ToString());
                Properties.Settings.Default.SerialFlow   = (Handshake)Enum.Parse(typeof(Handshake), comboBox6.SelectedItem.ToString());
                Properties.Settings.Default.Save();
            }
        }
Example #2
0
        private void SerialSetupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SerialSetupForm sc = new SerialSetupForm();

            sc.ShowDialog();
        }