static void Main(string[] args)
        {
            //Dependencies for Airport
            DecodeFactory.DecodeFactory trackFactory = new TrackFactory();
            AirSpace airspace = new AirSpace
            {
                Height_from = 500,
                Height_to   = 20000,
                X           = 80000,
                Y           = 80000
            };
            IExceptionHandler exceptionHandler = new NullReferenceExceptionHandler();

            var receiver = TransponderReceiverFactory.CreateTransponderDataReceiver();

            var Airport = new Airport(receiver, trackFactory, airspace, exceptionHandler);

            //Dependencies for ATM
            IOccurenceDetector Detector  = new TrackOccurrenceDetector();
            IDisplay           Display   = new MonitorConsole();
            IOccurrenceLogger  Logger    = new OccurrenceLogger();
            IFormat            Formatter = new TrackFormater();
            IExceptionHandler  Exception = new NullReferenceExceptionHandler();
            IConsoleClear      Consoler  = new ConsoleClear();

            Air_Traffic_Monitor ATM = new Air_Traffic_Monitor(Airport, Detector, Display, Logger, Formatter, Consoler, Exception);


            #region DecodeFactory Test

            /*
             * var Aircrafts = new List<string>
             * {
             *  "BTR312;2004;18204;5500;20151006213456789",
             *  "BTR312;3200;18602;5500;20151006213456789",
             *  "BTR312;4200;18802;5500;20151006213456789"
             * };
             *
             * var factory = new TrackFactory();
             * var tracks = factory.CreateTracks(Aircrafts);
             *
             * foreach(var track in tracks)
             * {
             *  Console.WriteLine($"Tag: {track.Tag}");
             *  Console.WriteLine($"Current altitude: x:{track.CurrentPositionX.ToString()}, y:{track.CurrentPositionY.ToString()}");
             *  Console.WriteLine($"Current altitude (Meters): {track.CurrentAltitude.ToString()}");
             *  Console.WriteLine($"Current Horizontal Velocity (m/s): {track.CurrentHorizontalVelocity.ToString()}");
             *  Console.WriteLine($"Current Compass Course: {track.CurrentCompassCourse}");
             *  Console.WriteLine( $"Timestamp: {track.TimeStamp.ToString()}\n");
             *
             * }
             */
            #endregion


            Console.ReadLine();
        }
        private void SetTextForBoth(string text)
        {
            if ((ConsoleClear != null) &&
                String.IsNullOrEmpty(textBoxLine.Text) &&
                String.IsNullOrEmpty(text))
            {
                ConsoleClear.Invoke(this, new EventArgs());
            }

            textBoxLine.Text         = text;
            passwordBoxLine.Password = text;
        }
示例#3
0
文件: Startup.cs 项目: swetllana/ATM
        static void Main(string[] args)
        {
            var atm = new Atm();

            var dataReader = new ConsoleDataReader();
            var dataWriter = new ConsoleDataWriter();
            var dataClear  = new ConsoleClear();
            var options    = new Options();
            var menu       = new Menu(dataReader, dataWriter, dataClear);

            Console.Write(Constants.ENTER_START_SUM_MESSAGE);
            var startSum = int.Parse(Console.ReadLine());

            atm.StartSum     = startSum;
            atm.Menu         = menu;
            atm.Menu.Options = options;

            bool showMenu = true;

            while (showMenu)
            {
                showMenu = atm.Menu.MainMenu(ref startSum);
            }
        }