/** * Mainform_Load(Object sender, EventArgs e) draws the main window. The code in this * method sets up the form appropriately. The splash screen form and the serial port * connection form both get instantiated here. Also, the serial port delegate function * (callback) gets setup here -- this.mySerialDelegate = new ReadDelegate(ProcessInData);<br> * * The application's state shall be read from Properties.Settings.Default and restored to * the main Window's GUI controls. In this case it is the disable Check Box state for the * Splash Screen.<br> * @code * maximSplashScreenForm.disableCheckBoxValue = Properties.Settings.Default.disableSplashValue; * @endcode <br> * * Finally, the code sets the application's title and version in the main Windows's title * bar and in the middle text region of the status bar. It also shows (or hides) the * splash screen based on state of "Disable" checkbox. * * @param sender The sender of the event. * @param e The arguments for the event. * <br> ****************************************************************************/ private void Mainform_Load(object sender, EventArgs e) { /* Create delegate for reading data */ this.mySerialDelegate = new ReadDelegate(ProcessInData); /* Create Splash Screen Form */ maximSplashScreenForm = new SplashScreen("DS18B20 Config Custom", "Version 1.0", "Copyright Maxim Integrated Products", "", 3); maximSplashScreenForm.disableCheckBoxValue = Properties.Settings.Default.disableSplashValue; maximSplashScreenForm.showOKButton(false); if (!maximSplashScreenForm.disableCheckBoxValue) { maximSplashScreenForm.ShowDialog(); } /* Setup SerialUSB Form */ USBform = new SerialUSBForm(serialPort1); USBform.ShowDialog(); /* Subscribe to event DataReceived with the onDataReceived Function */ serialPort1.DataReceived += this.SerialPort1_DataReceived; /* Initial Communication between GUI & FW */ try { serialPort1.WriteLine("INIT"); } catch (System.InvalidOperationException) { MessageBox.Show("You are not connected to a Serial Port!", "Serial Error"); return; } }