Ejemplo n.º 1
0
        public MainWindow(
            FlightInfoViewModel viewModel,
            SignalRLogic signalR,
            FlightLogic flightLogic,
            TestLogic testLogic,
            IFlightSimInterface flightSimInterface,
            FileWatcherLogic watcher,
            IStorageLogic storageLogic,
            ILogger <MainWindow> logger)
        {
            InitializeComponent();

            this.viewModel          = viewModel;
            this.signalR            = signalR;
            this.flightLogic        = flightLogic;
            this.testLogic          = testLogic;
            this.flightSimInterface = flightSimInterface ?? throw new ArgumentNullException(nameof(flightSimInterface));
            this.watcher            = watcher ?? throw new ArgumentNullException(nameof(watcher));
            this.storageLogic       = storageLogic ?? throw new ArgumentNullException(nameof(storageLogic));
            this.logger             = logger;
            DataContext             = viewModel;

            flightSimInterface.AircraftDataUpdated += FlightSimInterface_AircraftDataUpdated;
            flightSimInterface.FlightPlanUpdated   += FlightSimInterface_FlightPlanUpdated;
            flightSimInterface.FlightStatusUpdated += FlightStatusUpdater_FlightStatusUpdated;

            watcher.FileCreated += Watcher_FileCreated;

            TextArchiveFolder.Text = storageLogic.ArchiveFolder;
        }
Ejemplo n.º 2
0
 private async Task InitializeSimConnectsync(SimConnectLogic simConnect, FlightInfoViewModel viewModel)
 {
     while (true)
     {
         try
         {
             viewModel.SimConnectionState = ConnectionState.Connecting;
             simConnect.Initialize(Handle);
             viewModel.SimConnectionState = ConnectionState.Connected;
             break;
         }
         catch (COMException)
         {
             viewModel.SimConnectionState = ConnectionState.Failed;
             await Task.Delay(5000).ConfigureAwait(true);
         }
     }
 }