private void ReceiverOnTransponderDataReady(object sender, RawTransponderDataEventArgs e) { TransponderDataList.Clear(); // Just display data //System.Console.WriteLine("New data"); foreach (var data in e.TransponderData) { TransponderDataList.Add(data); //System.Console.WriteLine($"Transponderdata {data}"); } // Call Event NewPlanesEvent?.Invoke(TransponderDataList); Console.WriteLine(""); }
public void Decode(List <string> newData) { List <IPlane> newPlaneList = new List <IPlane>(); foreach (var data in newData) { string[] result = data.Split(';'); DateTime tempDateTime = DateTime.ParseExact(result[4], "yyyyMMddHHmmssfff", null); IPlane tempPlane = new Plane(result[0], int.Parse(result[1]), int.Parse(result[2]), int.Parse(result[3]), tempDateTime); newPlaneList.Add(tempPlane); } // Update the speed and direction of the new planes found foreach (var oldPlane in OldPlaneList) { foreach (var newPlane in newPlaneList) { if (newPlane.Tag == oldPlane.Tag) { newPlane.Update(oldPlane); // Update plane found in record break; // No reason to loop rest of planes } } } // Update oldPlaneList with new planes OldPlaneList = newPlaneList; // Get all planes that got all properties List <IPlane> completePlaneList = GetCompletePlanes(newPlaneList); // Call event NewPlanesEvent?.Invoke(completePlaneList); }