mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Replace Flow.Launcher.Core.MessageBoxType & MessageBoxImage with System.Windows.MessageBoxButton & MessageBoxImage
Remove useless warning file
This commit is contained in:
parent
dcea54ab83
commit
897fd7aaba
15 changed files with 20 additions and 75 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 |
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue