/// <summary> /// Create an instance of the ComPorts class. /// Initialize port settings and other parameters. /// specify behavior on events. /// </summary> private void Form1_Load(object sender, System.EventArgs e) { Show(); UserPort1 = new ComPorts(); MyPortSettingsDialog = new PortSettingsDialog(); tmrLookForPortChanges.Interval = 1000; tmrLookForPortChanges.Stop(); // Specify the routines that execute on events in other modules. // The routines can receive data from other modules. timerRobotnik.Stop(); }
/// <summary> /// Create an instance of the ComPorts class. /// Initialize port settings and other parameters. /// specify behavior on events. /// </summary> private void Form1_Load(object sender, System.EventArgs e) { Show(); UserPort1 = new ComPorts(); MyPortSettingsDialog = new PortSettingsDialog(); tmrLookForPortChanges.Interval = 1000; tmrLookForPortChanges.Stop(); InitializeDisplayElements(); SetInitialPortParameters(); if (ComPorts.comPortExists) { UserPort1.SelectedPort.PortName = ComPorts.myPortNames[MyPortSettingsDialog.cmbPort.SelectedIndex]; // A check box enables requesting to open the selected COM port on start up. // Otherwise the application opens the port when the user clicks the Open Port // button or types text to send. if (MyPortSettingsDialog.chkOpenComPortOnStartup.Checked) { UserPort1.PortOpen = UserPort1.OpenComPort(); AccessForm("DisplayCurrentSettings", "", Color.Black); AccessForm("DisplayStatus", "", Color.Black); } else { DisplayCurrentSettings(); } } // Specify the routines that execute on events in other modules. // The routines can receive data from other modules. ComPorts.UserInterfaceData += new ComPorts.UserInterfaceDataEventHandler(AccessFormMarshal); PortSettingsDialog.UserInterfaceData += new PortSettingsDialog.UserInterfaceDataEventHandler(AccessFormMarshal); PortSettingsDialog.UserInterfacePortSettings += new PortSettingsDialog.UserInterfacePortSettingsEventHandler(SetPortParameters); }
/// <summary> /// Create an instance of the ComPorts class. /// Initialize port settings and other parameters. /// specify behavior on events. /// </summary> private void Form1_Load( object sender, System.EventArgs e ) { Show(); UserPort1 = new ComPorts(); MyPortSettingsDialog = new PortSettingsDialog(); tmrLookForPortChanges.Interval = 1000; tmrLookForPortChanges.Stop(); InitializeDisplayElements(); SetInitialPortParameters(); if (ComPorts.comPortExists) { UserPort1.SelectedPort.PortName = ComPorts.myPortNames[MyPortSettingsDialog.cmbPort.SelectedIndex]; // A check box enables requesting to open the selected COM port on start up. // Otherwise the application opens the port when the user clicks the Open Port // button or types text to send. if (MyPortSettingsDialog.chkOpenComPortOnStartup.Checked) { UserPort1.PortOpen = UserPort1.OpenComPort(); AccessForm("DisplayCurrentSettings", "", Color.Black); AccessForm("DisplayStatus", "", Color.Black); } else { DisplayCurrentSettings(); } } // Specify the routines that execute on events in other modules. // The routines can receive data from other modules. ComPorts.UserInterfaceData += new ComPorts.UserInterfaceDataEventHandler(AccessFormMarshal); PortSettingsDialog.UserInterfaceData += new PortSettingsDialog.UserInterfaceDataEventHandler(AccessFormMarshal); PortSettingsDialog.UserInterfacePortSettings += new PortSettingsDialog.UserInterfacePortSettingsEventHandler(SetPortParameters); }