protected virtual void OnDataRecieved(EventArgs e, string myGPSData, bool myThreadEnd) { SendSerialPortArgs args = new SendSerialPortArgs() { gpsData = myGPSData, ThreadEnd = myThreadEnd }; SerialPortEvent.Invoke(null, args); }
protected virtual void OnPortsRecieved(EventArgs e, string[] myPortList) // [2] Recieves the new date and time { SendSerialPortArgs args = new SendSerialPortArgs() { portList = myPortList }; //[3] Sets the data out as outlined in 4 SerialPortEvent.Invoke(null, args); // [5] Pass the data to the event }
private void SerialPortTaskActive(object sender, SendSerialPortArgs args) { if (args.ThreadEnd != false)//Serial Port Task has not ended .. it shouldnt { NewGPSDataRecieved(args.gpsData); } else { UnexpectedThreadEnd(2); } }
private void FillSerialCombo(object sender, SendSerialPortArgs args) { Dispatcher.BeginInvoke(new Action(() => { comboboxComPort.Items.Add("Choose GPS port"); comboboxComPort.Items.Add("UDP Source"); foreach (string port in args.portList) { comboboxComPort.Items.Add(port); } }), DispatcherPriority.Background); }