Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Monitor monitor = new Monitor();

            monitor.SetX(0, 10000);   // 0 - 10.000
            monitor.SetZ(500, 20000); // 500 - 20.000
            monitor.SetY(0, 90000);   // 0 - 90.000

            IPositionCalc calc = new PositionCalc();

            IDisplay display = new Display();

            INotificationCenter notificationCenter = new NotificationCenter(display);
            IDisplayFormatter   formatter          = new DisplayFormatter(display, calc, notificationCenter);

            notificationCenter.SetFormatter(formatter);

            ILog log = new Log(Directory.GetCurrentDirectory() + @"\log.txt");

            Airspace airspace = new Airspace(monitor, formatter, log);

            var simThread = new Thread(() => SimulationThread(airspace));

            simThread.Start();
        }
Exemplo n.º 2
0
        public void Update(List <Data> data)
        {
            foreach (var track in data)
            {
                EventType type = Monitor.EventTracker(track);

                UpdateListAfterEvent(type, track);

                switch (type)
                {
                case EventType.ENTERING:

                    Log.WriteNotification(track, false);
                    DisplayFormatter.ShowNotification(track, EventType.ENTERING);
                    break;

                case EventType.LEAVING:

                    Log.WriteNotification(track, true);
                    DisplayFormatter.ShowNotification(track, EventType.LEAVING);
                    break;

                case EventType.INSIDE:
                    break;

                case EventType.CONFLICTING:

                    List <Data> list = Monitor.GetTracksInConflict();
                    DisplayFormatter.ShowWarning(Monitor.GetAllConflicts());
                    list.Add(track);
                    if (list.Count > 1)
                    {
                        Log.WriteWarning(list);
                    }

                    break;

                case EventType.CONFLICTING_ENTERING:

                    var list1 = Monitor.GetTracksInConflict();
                    DisplayFormatter.ShowWarning(Monitor.GetAllConflicts());
                    DisplayFormatter.ShowNotification(track, EventType.ENTERING);
                    list1.Add(track);

                    if (list1.Count > 1)
                    {
                        Log.WriteWarning(list1);
                    }
                    break;

                case EventType.CONFLICTING_LEAVING:

                    var list2 = Monitor.GetTracksInConflict();
                    DisplayFormatter.ShowWarning(Monitor.GetAllConflicts());
                    DisplayFormatter.ShowNotification(track, EventType.LEAVING);
                    list2.Add(track);

                    if (list2.Count > 1)
                    {
                        Log.WriteWarning(list2);
                    }

                    break;
                }
            }
            List <Data> clonelist;

            lock (_tracks)
            {
                clonelist = _tracks.Select(x => x.Clone()).ToList();
            }

            DisplayFormatter.ShowTracks(clonelist);
        }