Replace Flow.Launcher.Core.MessageBoxType & MessageBoxImage with System.Windows.MessageBoxButton & MessageBoxImage

Remove useless warning file
This commit is contained in:
Jack251970 2024-11-26 21:31:13 +08:00
parent dcea54ab83
commit 897fd7aaba
15 changed files with 20 additions and 75 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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:

View file

@ -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
{

View file

@ -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;

View file

@ -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);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 B

View file

@ -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)

View file

@ -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)

View file

@ -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
{

View file

@ -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
{

View file

@ -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);

View file

@ -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;
}

View file

@ -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
{

View file

@ -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;