internal void LoadConfigSettings() { Top = Settings.Default.Top; Left = Settings.Default.Left; DataContext = _viewModel; _viewModel.ProgressChanged += _viewModel_ProgressChanged; _viewModel.RunningStateChanged += _viewModel_RunningStateChanged; Update.Updater.StatusBar.PropertyChanged += StatusBar_PropertyChanged; UiStyleManager.IsStyleChanged += UiStyleManager_IsStyleChanged; _taskbarIcon.DoubleClickCommand = new DelegateCommand(() => NotifyIconOnClick(false)); if (_taskbarIcon.TrayPopup is Tray.ContextMenu contextMenu) { contextMenu.CloseCommand = new DelegateCommand(Close); contextMenu.MinimizeShowCommand = new DelegateCommand(() => NotifyIconOnClick(WindowState == WindowState.Normal)); contextMenu.EditCommand = _viewModel.EditCommand; contextMenu.SettingsCommand = _viewModel.SettingsClickedCommand; contextMenu.AboutCommand = _viewModel.AboutClickedCommand; contextMenu.StartStopCommand = _viewModel.StartStopCommand; } Settings.Default.SelectedAccent = string.IsNullOrWhiteSpace(Settings.Default.SelectedAccent) ? "Crimson" : Settings.Default.SelectedAccent; Settings.Default.SelectedTheme = string.IsNullOrWhiteSpace(Settings.Default.SelectedTheme) ? "BaseDark" : Settings.Default.SelectedTheme; Settings.Save(); try { UiStyleManager.ChangeAppStyle(Settings.Default.SelectedAccent, Settings.Default.SelectedTheme); } catch (Exception exception) { Logger.Error("LoadConfigSettings()", exception); UiStyleManager.ChangeAppStyle("Crimson", "BaseDark"); } _viewModel.InitControl(); }
/// <summary> /// Saves the position /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainWindow_OnClosing(object sender, CancelEventArgs e) { Settings.Default.Top = Top; Settings.Default.Left = Left; Settings.Save(); }