public RootViewModel( IEventAggregator eventAggregator, ISettingsService settingsService, ICoreService coreService, IDebugService debugService, IRegistrationService builtInRegistrationService, ISnackbarMessageQueue snackbarMessageQueue, SidebarViewModel sidebarViewModel) { SidebarViewModel = sidebarViewModel; _eventAggregator = eventAggregator; _coreService = coreService; _debugService = debugService; _builtInRegistrationService = builtInRegistrationService; _snackbarMessageQueue = snackbarMessageQueue; _frameTimeUpdateTimer = new Timer(500); _colorScheme = settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic); _windowSize = settingsService.GetSetting <WindowSize>("UI.RootWindowSize"); _themeWatcher = new ThemeWatcher(); ApplyColorSchemeSetting(); ActiveItem = SidebarViewModel.SelectedItem; ActiveItemReady = true; AssemblyInformationalVersionAttribute?versionAttribute = typeof(RootViewModel).Assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>(); WindowTitle = $"Artemis {versionAttribute?.InformationalVersion}"; }
public RootViewModel(IEventAggregator eventAggregator, SidebarViewModel sidebarViewModel) { SidebarViewModel = sidebarViewModel; _eventAggregator = eventAggregator; var themeWatcher = new ThemeWatcher(); themeWatcher.ThemeChanged += (sender, args) => ApplyWindowsTheme(args.Theme); ApplyWindowsTheme(themeWatcher.GetWindowsTheme()); ActiveItem = SidebarViewModel.SelectedItem; ActiveItemReady = true; SidebarViewModel.PropertyChanged += SidebarViewModelOnPropertyChanged; }
protected override void OnExit(ExitEventArgs e) { // Stop Registry Monitoring NightLightWatcher.Stop(); ThemeWatcher.Stop(); // Save Configuration File var settingService = Container.Resolve <SettingService>(); Task.WaitAll(settingService.SaveConfigFile()); // Disable Tray Tray.Visible = false; // Continue App Termination base.OnExit(e); }
protected override async void OnStartup(StartupEventArgs e) { // Preparation PrepIcon(); Tray = new NotifyIcon(); Tray.Visible = true; Tray.Text = "Windows 10 Night Light Theme Synchronization"; Tray.ContextMenuStrip = new ContextMenuStrip(); Tray.ContextMenuStrip.Items.Add("&Setting", null, TrayClickSetting); Tray.ContextMenuStrip.Items.Add("E&xit", null, TrayClickExit); // Load Configuration File _settingService = Container.Resolve <SettingService>(); await _settingService.OpenConfigFile(); // Background Services // -> Monitoring Service ThemeWatcher.Start(); NightLightWatcher.Start(); NightLightWatcher.WatchingStatusChanged += NightLightWatcher_WatchingStatusChanged; // -> Theme Service : Just constructs it as it will sync theme automatically var themeService = Container.Resolve <ThemeService>(); ThemeWatcher.SystemThemeChanged += ThemeWatcher_SystemThemeChanged; // Tray Event Tray.MouseClick += _tray_MouseClick; SetTrayIcon(ThemeWatcher.SystemTheme); // Activate Window If StartMinimized is not enabled if (!_settingService.CurrentSetting.StartMinimized) { StartMainWindow(); } else { Tray.ShowBalloonTip(5000, "The app is started.", "It has been minimized to system tray.", ToolTipIcon.Info); } // Prevent default startup behavior //base.OnStartup(e); }
public TrayViewModel(IKernel kernel, IWindowManager windowManager, IWindowService windowService, 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; _themeWatcher = new ThemeWatcher(); _colorScheme = settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic); _colorScheme.SettingChanged += ColorSchemeOnSettingChanged; _themeWatcher.ThemeChanged += ThemeWatcherOnThemeChanged; ApplyColorSchemeSetting(); windowService.ConfigureMainWindowProvider(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(); } }
public RootViewModel( IKernel kernel, IEventAggregator eventAggregator, ISettingsService settingsService, ICoreService coreService, IWindowManager windowManager, IDebugService debugService, IRegistrationService builtInRegistrationService, IMessageService messageService, SidebarViewModel sidebarViewModel) { _kernel = kernel; _eventAggregator = eventAggregator; _settingsService = settingsService; _coreService = coreService; _windowManager = windowManager; _debugService = debugService; _builtInRegistrationService = builtInRegistrationService; _messageService = messageService; _sidebarViewModel = sidebarViewModel; _frameTimeUpdateTimer = new Timer(500); _colorScheme = _settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic); _windowSize = _settingsService.GetSetting <WindowSize>("UI.RootWindowSize"); _themeWatcher = new ThemeWatcher(); ApplyColorSchemeSetting(); _sidebarViewModel.ConductWith(this); ActiveItem = sidebarViewModel.SelectedItem; ActiveItemReady = true; PinSidebar = _settingsService.GetSetting("UI.PinSidebar", false); AssemblyInformationalVersionAttribute versionAttribute = typeof(RootViewModel).Assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>(); WindowTitle = $"Artemis {versionAttribute?.InformationalVersion} build {Constants.BuildInfo.BuildNumberDisplay}"; }
public ToastNotificationProvider() { _themeWatcher = new ThemeWatcher(); }