public static void ShowNotification(Certify.UI.ViewModel.AppViewModel mainViewModel, Notifier notifier, string msg, NotificationType type = NotificationType.Info, bool autoClose = true) { var opts = new ToastNotifications.Core.MessageOptions { ShowCloseButton = false }; opts.FontSize = 12 * mainViewModel.UIScaleFactor; if (type == NotificationType.Error) { notifier.ShowError(msg, opts); } else if (type == NotificationType.Success) { notifier.ShowSuccess(msg, opts); } else if (type == NotificationType.Warning) { notifier.ShowWarning(msg, opts); } else { notifier.ShowInformation(msg, opts); } }
public static string ToggleTheme(System.Windows.Application application, Certify.UI.ViewModel.AppViewModel mainViewModel, string initialTheme = null) { if (initialTheme != null) { if (initialTheme == "Dark") { ThemeManager.Current.ChangeTheme(application, "Dark.Green"); } else { ThemeManager.Current.ChangeTheme(application, "Light.Green"); } // refresh bindings to force dynamic resources to redraw mainViewModel.RaisePropertyChangedEvent(nameof(mainViewModel.ManagedCertificates)); return(initialTheme); } else { var theme = ThemeManager.Current.DetectTheme(); string themeSelection; if (theme.BaseColorScheme == "Light") { ThemeManager.Current.ChangeTheme(application, "Dark.Green"); themeSelection = "Dark"; } else { ThemeManager.Current.ChangeTheme(application, "Light.Green"); themeSelection = "Light"; } mainViewModel.RaisePropertyChangedEvent(nameof(mainViewModel.ManagedCertificates)); return(themeSelection); } }