public static void OpenOptions() { var alwaysOn = Settings.Default.AlwaysOn; var dialog = new Options(); dialog.ShowDialog(); if (alwaysOn != Settings.Default.AlwaysOn) { if (Settings.Default.AlwaysOn) { TrayIconHelper.CreateTrayIcon(); App.HideMainWindow(); } else { App.ShowMainWindow(); } } else { if (Settings.Default.AlwaysOn) { TrayIconHelper.RefreshTrayIconMenu(); } } }
public static void ReloadData() { try { App.Accounts = new ObservableCollection <Account>(SettingsHelper.DeserializeAccounts(Settings.Default.Accounts)); } catch { App.Accounts = new ObservableCollection <Account>(); Popup.Show( "Existing account data is corrupt.\n\n" + "All accounts have been reset.", MessageBoxButton.OK, MessageBoxImage.Error); } App.Accounts.CollectionChanged += (sender, args) => { TrayIconHelper.RefreshTrayIconMenu(); }; TrayIconHelper.RefreshTrayIconMenu(); App.SwitchWindow?.ReloadAccountListBinding(); }