예제 #1
0
        /// <summary>
        /// Set the user preferences or default values in the combo boxes and ports array
        /// using stored preferences or default values.
        /// </summary>

        private void UsePreferencesToSelectParameters()
        {
            int myPortIndex = 0;

            myPortIndex = MyPortSettingsDialog.SelectComPort(UserPort1.SavedPortName);

            MyPortSettingsDialog.SelectBitRate(UserPort1.SavedBitRate);

            UserPort1.SelectedPort.BaudRate = (int)MyPortSettingsDialog.cmbBitRate.SelectedItem;

            MyPortSettingsDialog.SelectHandshaking(UserPort1.SavedHandshake);

            UserPort1.SelectedPort.Handshake = (Handshake)MyPortSettingsDialog.cmbHandshaking.SelectedItem;

            MyPortSettingsDialog.chkOpenComPortOnStartup.Checked = savedOpenPortOnStartup;
        }
예제 #2
0
        /// <summary>
        /// Look for COM ports and display them in the combo box.
        /// </summary>

        private void btnPort_Click(object sender, System.EventArgs e)   // $$$$
        {
            ComPorts.FindComPorts();
            MyPortSettingsDialog.DisplayComPorts();
            MyPortSettingsDialog.SelectComPort(UserPort1.SelectedPort.PortName);
            MyPortSettingsDialog.SelectBitRate(UserPort1.SelectedPort.BaudRate);
            MyPortSettingsDialog.SelectHandshaking(UserPort1.SelectedPort.Handshake);

            UserPort1.ParameterChanged = false;

            //  Display the combo boxes for setting port parameters.

            MyPortSettingsDialog.ShowDialog();
        }