diff --git a/Flow.Launcher.Core/Configuration/Portable.cs b/Flow.Launcher.Core/Configuration/Portable.cs index 2a1db10e7..d7c73fb46 100644 --- a/Flow.Launcher.Core/Configuration/Portable.cs +++ b/Flow.Launcher.Core/Configuration/Portable.cs @@ -9,7 +9,6 @@ using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin.SharedCommands; using System.Linq; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.Core.Configuration { @@ -162,7 +161,7 @@ namespace Flow.Launcher.Core.Configuration if (MessageBoxEx.Show("Flow Launcher has detected you enabled portable mode, " + "would you like to move it to a different location?", string.Empty, - MessageBoxType.YesNo) == MessageBoxResult.Yes) + MessageBoxButton.YesNo) == MessageBoxResult.Yes) { FilesFolders.OpenPath(Constant.RootDirectory, MessageBoxEx.Show); diff --git a/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs b/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs index 433df6f97..6d41e2383 100644 --- a/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs +++ b/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs @@ -4,12 +4,10 @@ using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedCommands; using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Windows; using System.Windows.Forms; using Flow.Launcher.Core.Resource; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.Core.ExternalPlugins.Environments { @@ -59,7 +57,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments EnvName, Environment.NewLine ); - if (MessageBoxEx.Show(noRuntimeMessage, string.Empty, MessageBoxType.YesNo) == MessageBoxResult.No) + if (MessageBoxEx.Show(noRuntimeMessage, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No) { var msg = string.Format(InternationalizationManager.Instance.GetTranslation("runtimePluginChooseRuntimeExecutable"), EnvName); string selectedFile; diff --git a/Flow.Launcher.Core/MessageBoxEx.xaml.cs b/Flow.Launcher.Core/MessageBoxEx.xaml.cs index 1a986be4c..b87302ca5 100644 --- a/Flow.Launcher.Core/MessageBoxEx.xaml.cs +++ b/Flow.Launcher.Core/MessageBoxEx.xaml.cs @@ -13,25 +13,6 @@ namespace Flow.Launcher.Core InitializeComponent(); } - public enum MessageBoxType - { - ConfirmationWithYesNo = 0, - ConfirmationWithYesNoCancel, - YesNo, - Information, - Error, - Warning - } - - public enum MessageBoxImage - { - Warning = 0, - Question, - Information, - Error, - None - } - static MessageBoxEx msgBox; static MessageBoxResult _result = MessageBoxResult.No; @@ -49,31 +30,9 @@ namespace Flow.Launcher.Core } /// 3 parameter - public static MessageBoxResult Show(string messageBoxText, string title, MessageBoxType type) + public static MessageBoxResult Show(string messageBoxText, string title, MessageBoxButton type) { - switch (type) - { - case MessageBoxType.ConfirmationWithYesNo: - return Show(messageBoxText, title, MessageBoxButton.YesNo, - MessageBoxImage.Question); - case MessageBoxType.YesNo: - return Show(messageBoxText, title, MessageBoxButton.YesNo, - MessageBoxImage.Question); - case MessageBoxType.ConfirmationWithYesNoCancel: - return Show(messageBoxText, title, MessageBoxButton.YesNoCancel, - MessageBoxImage.Question); - case MessageBoxType.Information: - return Show(messageBoxText, title, MessageBoxButton.OK, - MessageBoxImage.Information); - case MessageBoxType.Error: - return Show(messageBoxText, title, MessageBoxButton.OK, - MessageBoxImage.Error); - case MessageBoxType.Warning: - return Show(messageBoxText, title, MessageBoxButton.OK, - MessageBoxImage.Warning); - default: - return MessageBoxResult.No; - } + return Show(messageBoxText, title, type, MessageBoxImage.None); } // 4 parameter, Final Display Message. @@ -144,8 +103,8 @@ namespace Flow.Launcher.Core { switch (image) { - case MessageBoxImage.Warning: - msgBox.SetImage("Warning.png"); + case MessageBoxImage.Exclamation: + msgBox.SetImage("Exclamation.png"); msgBox.Img.Visibility = Visibility.Visible; break; case MessageBoxImage.Question: diff --git a/Flow.Launcher.Core/Plugin/PluginsLoader.cs b/Flow.Launcher.Core/Plugin/PluginsLoader.cs index 495d25e1b..7973c66ba 100644 --- a/Flow.Launcher.Core/Plugin/PluginsLoader.cs +++ b/Flow.Launcher.Core/Plugin/PluginsLoader.cs @@ -11,7 +11,6 @@ using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch; -using MessageBoxImage = Flow.Launcher.Core.MessageBoxEx.MessageBoxImage; namespace Flow.Launcher.Core.Plugin { diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs index e634dc9dd..1505e84f8 100644 --- a/Flow.Launcher.Core/Resource/Internationalization.cs +++ b/Flow.Launcher.Core/Resource/Internationalization.cs @@ -11,7 +11,6 @@ using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using System.Globalization; using System.Threading.Tasks; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.Core.Resource { @@ -125,7 +124,7 @@ namespace Flow.Launcher.Core.Resource // "Do you want to search with pinyin?" string text = languageToSet == AvailableLanguages.Chinese ? "是否启用拼音搜索?" : "是否啓用拼音搜索?" ; - if (MessageBoxEx.Show(text, string.Empty, MessageBoxType.YesNo) == MessageBoxResult.No) + if (MessageBoxEx.Show(text, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No) return false; return true; diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 5a980c5e2..b92d86568 100644 --- a/Flow.Launcher.Core/Updater.cs +++ b/Flow.Launcher.Core/Updater.cs @@ -17,7 +17,6 @@ using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using System.Text.Json.Serialization; using System.Threading; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.Core { @@ -84,7 +83,7 @@ namespace Flow.Launcher.Core Log.Info($"|Updater.UpdateApp|Update success:{newVersionTips}"); - if (MessageBoxEx.Show(newVersionTips, api.GetTranslation("update_flowlauncher_new_update"), MessageBoxType.YesNo) == MessageBoxResult.Yes) + if (MessageBoxEx.Show(newVersionTips, api.GetTranslation("update_flowlauncher_new_update"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) { UpdateManager.RestartApp(Constant.ApplicationFileName); } diff --git a/Flow.Launcher/Images/warning.png b/Flow.Launcher/Images/warning.png deleted file mode 100644 index 8d29625ee..000000000 Binary files a/Flow.Launcher/Images/warning.png and /dev/null differ diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs index 6e6cbce4d..6e81db5e0 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs @@ -11,7 +11,6 @@ using Flow.Launcher.Core.Resource; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.SettingPages.ViewModels; @@ -66,7 +65,7 @@ public partial class SettingsPaneAboutViewModel : BaseModel var confirmResult = MessageBoxEx.Show( InternationalizationManager.Instance.GetTranslation("clearlogfolderMessage"), InternationalizationManager.Instance.GetTranslation("clearlogfolder"), - MessageBoxType.YesNo + MessageBoxButton.YesNo ); if (confirmResult == MessageBoxResult.Yes) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs index 669cd0784..6d8af9a3f 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs @@ -8,7 +8,6 @@ using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Flow.Launcher.Core; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.SettingPages.ViewModels; @@ -52,7 +51,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel InternationalizationManager.Instance.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey ), InternationalizationManager.Instance.GetTranslation("delete"), - MessageBoxType.YesNo + MessageBoxButton.YesNo ); if (result is MessageBoxResult.Yes) @@ -98,7 +97,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel InternationalizationManager.Instance.GetTranslation("deleteCustomShortcutWarning"), item.Key, item.Value ), InternationalizationManager.Instance.GetTranslation("delete"), - MessageBoxType.YesNo + MessageBoxButton.YesNo ); if (result is MessageBoxResult.Yes) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index 8c40cac9a..b13d89f2c 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -12,7 +12,6 @@ using System.Linq; using Flow.Launcher.Plugin.Explorer.Helper; using Flow.Launcher.Plugin.Explorer.ViewModels; using Flow.Launcher.Core; -using MessageBoxImage = Flow.Launcher.Core.MessageBoxEx.MessageBoxImage; namespace Flow.Launcher.Plugin.Explorer { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs index b890e6e18..ddeec0064 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs @@ -7,7 +7,6 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.Plugin.Explorer.Search.Everything; @@ -25,7 +24,7 @@ public static class EverythingDownloadHelper if (MessageBoxEx.Show( string.Format(api.GetTranslation("flowlauncher_plugin_everything_installing_select"), Environment.NewLine), api.GetTranslation("flowlauncher_plugin_everything_installing_title"), - MessageBoxType.YesNo) == MessageBoxResult.Yes) + MessageBoxButton.YesNo) == MessageBoxResult.Yes) { var dlg = new System.Windows.Forms.OpenFileDialog { diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs index fcba3ebee..fd978c6d1 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs @@ -13,7 +13,6 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Windows; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.Plugin.PluginsManager { @@ -134,7 +133,7 @@ namespace Flow.Launcher.Plugin.PluginsManager } if (MessageBoxEx.Show(message, Context.API.GetTranslation("plugin_pluginsmanager_install_title"), - MessageBoxType.YesNo) == MessageBoxResult.No) + MessageBoxButton.YesNo) == MessageBoxResult.No) return; // at minimum should provide a name, but handle plugin that is not downloaded from plugins manifest and is a url download @@ -269,7 +268,7 @@ namespace Flow.Launcher.Plugin.PluginsManager if (MessageBoxEx.Show(message, Context.API.GetTranslation("plugin_pluginsmanager_update_title"), - MessageBoxType.YesNo) != MessageBoxResult.Yes) + MessageBoxButton.YesNo) != MessageBoxResult.Yes) { return false; } @@ -364,7 +363,7 @@ namespace Flow.Launcher.Plugin.PluginsManager if (MessageBoxEx.Show(message, Context.API.GetTranslation("plugin_pluginsmanager_update_title"), - MessageBoxType.YesNo) == MessageBoxResult.No) + MessageBoxButton.YesNo) == MessageBoxResult.No) { return false; } @@ -481,7 +480,7 @@ namespace Flow.Launcher.Plugin.PluginsManager Environment.NewLine), Context.API.GetTranslation( "plugin_pluginsmanager_install_unknown_source_warning_title"), - MessageBoxType.YesNo) == MessageBoxResult.No) + MessageBoxButton.YesNo) == MessageBoxResult.No) return false; } @@ -519,7 +518,7 @@ namespace Flow.Launcher.Plugin.PluginsManager Environment.NewLine), Context.API.GetTranslation( "plugin_pluginsmanager_install_unknown_source_warning_title"), - MessageBoxType.YesNo) == MessageBoxResult.No) + MessageBoxButton.YesNo) == MessageBoxResult.No) return false; } @@ -652,7 +651,7 @@ namespace Flow.Launcher.Plugin.PluginsManager if (MessageBoxEx.Show(message, Context.API.GetTranslation("plugin_pluginsmanager_uninstall_title"), - MessageBoxType.YesNo) == MessageBoxResult.Yes) + MessageBoxButton.YesNo) == MessageBoxResult.Yes) { Application.Current.MainWindow.Hide(); Uninstall(x.Metadata); diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs index e85b7534e..c7595c49d 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs @@ -11,7 +11,6 @@ using System.ComponentModel; using System.Windows.Data; using Flow.Launcher.Plugin.Program.ViewModels; using Flow.Launcher.Core; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.Plugin.Program.Views { @@ -294,7 +293,7 @@ namespace Flow.Launcher.Plugin.Program.Views var msg = string.Format( context.API.GetTranslation("flowlauncher_plugin_program_delete_program_source")); - if (MessageBoxEx.Show(msg, string.Empty, MessageBoxType.YesNo) == MessageBoxResult.No) + if (MessageBoxEx.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No) { return; } diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs index 72f3639ff..94e83315b 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs @@ -15,7 +15,6 @@ using Flow.Launcher.Plugin.SharedCommands; using Application = System.Windows.Application; using Control = System.Windows.Controls.Control; using FormsApplication = System.Windows.Forms.Application; -using MessageBoxImage = Flow.Launcher.Core.MessageBoxEx.MessageBoxImage; namespace Flow.Launcher.Plugin.Sys { diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs index 7e4edf653..75f436013 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs @@ -4,7 +4,6 @@ using Flow.Launcher.Core.Plugin; using System.ComponentModel; using System.Windows.Data; using Flow.Launcher.Core; -using static Flow.Launcher.Core.MessageBoxEx; namespace Flow.Launcher.Plugin.WebSearch { @@ -38,7 +37,7 @@ namespace Flow.Launcher.Plugin.WebSearch var warning = _context.API.GetTranslation("flowlauncher_plugin_websearch_delete_warning"); var formated = string.Format(warning, selected.Title); - var result = MessageBoxEx.Show(formated, string.Empty, MessageBoxType.YesNo); + var result = MessageBoxEx.Show(formated, string.Empty, MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { var id = _context.CurrentPluginMetadata.ID;