Example #1
0
        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));
        }
Example #2
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            ConsoleLogService.Start();

            _agent = new RemotingAgent();
            if (!_agent.Start())
            {
                this.Shutdown();
                return;
            }

            LanguageService.Switch(e.Args);

            _controller = new MainController();
            await _controller.InitiateAsync(_agent);

            //this.MainWindow = new MainWindow();
            //this.MainWindow.Show();
        }