Ejemplo n.º 1
0
        private void TrackLeftedFunc(object o, TrackLeftAirspaceEventArgs args)
        {
            var trackToRemove = UpdatedTracksList.Find(i => i.Tag == args.Track.Tag);

            if (trackToRemove == null)
            {
                return;
            }
            UpdatedTracksList.Remove(trackToRemove);
            TrackLefted?.Invoke(this, new TrackLeftedAirspaceEventArgs(new Event(EventsList, "Track Left Airspace", args.Track, DateTime.Now)));
            TracksUpdated?.Invoke(this, new TracksUpdatedEventArgs(UpdatedTracksList, EventsList));
        }
Ejemplo n.º 2
0
        private void EvalTrack(object o, TracksFilteredEventArgs args)
        {
            if (args.FilteredTracks.Count != 0 && UpdatedTracksList.Count == 0)
            {
                foreach (var track in args.FilteredTracks)
                {
                    UpdatedTracksList.Add(track);
                    TrackEntered?.Invoke(this, new TrackEnteredAirspaceEventArgs(new Event(EventsList, "Track Entered Airspace", track, DateTime.Now)));
                }
            }

            else if (args.FilteredTracks.Count != 0 && UpdatedTracksList.Count != 0)
            {
                foreach (var filteredTrack in args.FilteredTracks)
                {
                    var updatedTrack = UpdatedTracksList.Find(i => i.Tag == filteredTrack.Tag);

                    if (updatedTrack == null)
                    {
                        UpdatedTracksList.Add(filteredTrack);
                        TrackEntered?.Invoke(this, new TrackEnteredAirspaceEventArgs(new Event(EventsList, "Track Entered Airspace", filteredTrack, DateTime.Now)));
                    }
                    else
                    {
                        var newCalEvent = new TrackStartCalEventArgs(
                            UpdatedTracksList[UpdatedTracksList.IndexOf(updatedTrack)],
                            filteredTrack);
                        TrackStartCal?.Invoke(this, newCalEvent);
                        if (newCalEvent.CalculatedTrack != null)
                        {
                            filteredTrack.Course   = newCalEvent.CalculatedTrack.Course;
                            filteredTrack.Velocity = newCalEvent.CalculatedTrack.Velocity;
                            UpdatedTracksList[UpdatedTracksList.IndexOf(updatedTrack)] = filteredTrack;
                        }

                        SeperationChecker?.Invoke(this, new SeperationCheckerEventArgs(EventsList, UpdatedTracksList, filteredTrack));
                    }
                }
            }
            args.UpdatedTracks = UpdatedTracksList;
            TracksUpdated?.Invoke(this, new TracksUpdatedEventArgs(UpdatedTracksList, EventsList));
        }
Ejemplo n.º 3
0
 protected virtual void UpdatedTrackEvent(EventTracks e)
 {
     TracksUpdated?.Invoke(this, e);
 }