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; }
protected override void OnStop() { FileWatcherLogic.StopMonitoring(); _shutdownEvent.Set(); if (!_thread.Join(3000)) { _thread.Abort(); } }
private void WorkerThreadFunc() { FileWatcherLogic.StartMonitoring(); GetSettings(); FileWatcherLogic.ConfigureWatcher(); while (!_shutdownEvent.WaitOne(0)) { ConfigurationManager.RefreshSection("appSettings"); GetSettings(); FileWatcherLogic.UpdateWatcherSettings(); Thread.Sleep(1000); } }