internal async Task InitiateAsync(RemotingAgent agent) { if (agent == null) { throw new ArgumentNullException(nameof(agent)); } Settings.Load(); NotifyIconContainer.ShowIcon("pack://application:,,,/Resources/Icons/TrayIcon.ico", ProductInfo.Title); _current.MainWindow = new MainWindow(this); _current.MainWindow.Deactivated += OnMainWindowDeactivated; if (!StartupService.IsStartedOnSignIn(Settings.LastSaveTime)) { _current.MainWindow.Show(); } agent.ShowRequested += OnMainWindowShowRequested; await ScanAsync(); _settingsWatcher.Subscribe(() => ScanAsync()); _powerWatcher.Subscribe(() => ScanAsync()); _brightnessWatcher.Subscribe((instanceName, brightness) => Update(instanceName, brightness)); }