Example #1
0
        public TrayViewModel(IKernel kernel,
                             IWindowManager windowManager,
                             IWindowService windowService,
                             IMessageService messageService,
                             IUpdateService updateService,
                             IEventAggregator eventAggregator,
                             ICoreService coreService,
                             IDebugService debugService,
                             ISettingsService settingsService)
        {
            _kernel          = kernel;
            _windowManager   = windowManager;
            _eventAggregator = eventAggregator;
            _debugService    = debugService;

            Core.Utilities.ShutdownRequested += UtilitiesOnShutdownRequested;
            Core.Utilities.RestartRequested  += UtilitiesOnShutdownRequested;

            windowService.ConfigureMainWindowProvider(this);
            messageService.ConfigureNotificationProvider(this);
            bool autoRunning   = Bootstrapper.StartupArguments.Contains("--autorun");
            bool minimized     = Bootstrapper.StartupArguments.Contains("--minimized");
            bool showOnAutoRun = settingsService.GetSetting("UI.ShowOnStartup", true).Value;

            if (autoRunning && !showOnAutoRun || minimized)
            {
                coreService.Initialized += (_, _) => updateService.AutoUpdate();
            }
            else
            {
                ShowSplashScreen();
                coreService.Initialized += (_, _) => TrayBringToForeground();
            }
        }