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(); } } }
private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { var wasVisible = (bool)e.OldValue; var isNowVisible = (bool)e.NewValue; if (!isNowVisible && wasVisible && Settings.Default.AlwaysOn && !App.IsShuttingDown) { TrayIconHelper.ShowRunningInTrayBalloon(); } }
public static bool Initialize() { if (IsExistingInstanceRunning()) { return(false); } SettingsHelper.UpgradeSettings(); LoadAccounts(); InitMainWindow(); if (Settings.Default.AlwaysOn) { TrayIconHelper.CreateTrayIcon(); if (!App.Arguments.Contains("-systemstartup")) { TrayIconHelper.ShowRunningInTrayBalloon(); } } LaunchStartAccount(); return(true); }
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(); }