public void ListController(object sender, PlaneDetectorEventArgs e)
        {
            // If no previous data is present it has no base from which to calculate the velocity and the course, so the function returns
            if (flightDataListOld.Count <= 0)
            {
                flightDataListOld = e.PlanesInAirspace;
                return;
            }

            List <FlightData> listToReturn = new List <FlightData>();

            // Calculates the course and velocity based on the new flight data that has been sent and the previously sent data
            listToReturn = Calculator.CalculateCompassCourse(flightDataListOld, e.PlanesInAirspace);
            try
            {
                listToReturn = Calculator.CalculateVelocity(flightDataListOld, e.PlanesInAirspace);
            }
            catch (ArgumentException exception)
            {
                Console.WriteLine(exception);
                //There should be some error handling here
            }

            render.DisplayData(listToReturn);       // Displays the data after it has been calculated

            flightDataListOld = e.PlanesInAirspace; // The new flight data has been calculated and displayed and now replaces the old flight data
        }
 public void OnPlaneDetectorEvent(object sender, PlaneDetectorEventArgs e)
 {
     for (int i = 0; i < e.PlanesInAirspace.Count; i++)         // Iterates through each plane in the list sent from AirSpacePlaneDetector
     {
         for (int j = i + 1; j < e.PlanesInAirspace.Count; j++) // Iterates through the remainder of the planes in the list
         {
             // Checks if the distance between two planes is within the specified distance of each other
             if ((Calculator.HorizontalDistance(e.PlanesInAirspace[i], e.PlanesInAirspace[j]) < 300) &&
                 (Calculator.VerticalDistance(e.PlanesInAirspace[i], e.PlanesInAirspace[j]) < 5000))
             {
                 // Displays and alarm in the console window and adds an occurence to the log
                 renderer.DisplayAlarm();
                 logger.Log(e.PlanesInAirspace[i], e.PlanesInAirspace[j]);
                 return;
             }
         }
     }
 }
 private void OnAirplaneDetected(PlaneDetectorEventArgs args)
 {
     AirplaneDetected?.Invoke(this, args);
 }