private static void ShowNotificationInDesktop(string message, ENotificationType type) { Action action = type switch { ENotificationType.Success => () => Growl.SuccessGlobal(message), ENotificationType.Info => () => Growl.InfoGlobal(message), ENotificationType.Warning => () => Growl.WarningGlobal(message), ENotificationType.Error => () => Growl.ErrorGlobal(message), ENotificationType.Fatal => () => Growl.FatalGlobal(message), _ => throw new ArgumentOutOfRangeException(nameof(type), type, null) }; Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, action); }