diff --git a/Demo.WindowsForms/Source/Program.cs b/Demo.WindowsForms/Source/Program.cs --- a/Demo.WindowsForms/Source/Program.cs +++ b/Demo.WindowsForms/Source/Program.cs @@ -20,7 +20,6 @@ namespace Demo.WindowsForms /// /// // Instantiate the communications port - public SerialPort port = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One); static MainForm windowGUI; [STAThread] @@ -29,31 +28,11 @@ namespace Demo.WindowsForms Application.SetCompatibleTextRenderingDefault(false); var program = new Program(); windowGUI = new MainForm(); - program.SerialInitialize(); Application.EnableVisualStyles(); Application.Run(windowGUI); } - //inits the serial port and event handler - public void SerialInitialize() - { - // http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in-C_2300_-.NET.aspx - // Attach a method to be called when there is data waiting in the port's buffer - port.DataReceived += new SerialDataReceivedEventHandler(ReceiveData); - - // Open the port for communications - port.Open(); - - } - - //process received data - public void ReceiveData(object sender, SerialDataReceivedEventArgs e) - { - // Show all the incoming data in the port's buffer - string testChk = port.ReadLine(); - windowGUI.ParseIncomingData(testChk); - } } //public class Dummy