diff --git a/Flow.Launcher.Core/Configuration/Portable.cs b/Flow.Launcher.Core/Configuration/Portable.cs
index b58154dcb..d7c73fb46 100644
--- a/Flow.Launcher.Core/Configuration/Portable.cs
+++ b/Flow.Launcher.Core/Configuration/Portable.cs
@@ -40,7 +40,7 @@ namespace Flow.Launcher.Core.Configuration
#endif
IndicateDeletion(DataLocation.PortableDataPath);
- MessageBox.Show("Flow Launcher needs to restart to finish disabling portable mode, " +
+ MessageBoxEx.Show("Flow Launcher needs to restart to finish disabling portable mode, " +
"after the restart your portable data profile will be deleted and roaming data profile kept");
UpdateManager.RestartApp(Constant.ApplicationFileName);
@@ -64,7 +64,7 @@ namespace Flow.Launcher.Core.Configuration
#endif
IndicateDeletion(DataLocation.RoamingDataPath);
- MessageBox.Show("Flow Launcher needs to restart to finish enabling portable mode, " +
+ MessageBoxEx.Show("Flow Launcher needs to restart to finish enabling portable mode, " +
"after the restart your roaming data profile will be deleted and portable data profile kept");
UpdateManager.RestartApp(Constant.ApplicationFileName);
@@ -95,13 +95,13 @@ namespace Flow.Launcher.Core.Configuration
public void MoveUserDataFolder(string fromLocation, string toLocation)
{
- FilesFolders.CopyAll(fromLocation, toLocation);
+ FilesFolders.CopyAll(fromLocation, toLocation, MessageBoxEx.Show);
VerifyUserDataAfterMove(fromLocation, toLocation);
}
public void VerifyUserDataAfterMove(string fromLocation, string toLocation)
{
- FilesFolders.VerifyBothFolderFilesEqual(fromLocation, toLocation);
+ FilesFolders.VerifyBothFolderFilesEqual(fromLocation, toLocation, MessageBoxEx.Show);
}
public void CreateShortcuts()
@@ -157,13 +157,13 @@ namespace Flow.Launcher.Core.Configuration
// delete it and prompt the user to pick the portable data location
if (File.Exists(roamingDataDeleteFilePath))
{
- FilesFolders.RemoveFolderIfExists(roamingDataDir);
+ FilesFolders.RemoveFolderIfExists(roamingDataDir, MessageBoxEx.Show);
- if (MessageBox.Show("Flow Launcher has detected you enabled portable mode, " +
+ if (MessageBoxEx.Show("Flow Launcher has detected you enabled portable mode, " +
"would you like to move it to a different location?", string.Empty,
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
- FilesFolders.OpenPath(Constant.RootDirectory);
+ FilesFolders.OpenPath(Constant.RootDirectory, MessageBoxEx.Show);
Environment.Exit(0);
}
@@ -172,9 +172,9 @@ namespace Flow.Launcher.Core.Configuration
// delete it and notify the user about it.
else if (File.Exists(portableDataDeleteFilePath))
{
- FilesFolders.RemoveFolderIfExists(portableDataDir);
+ FilesFolders.RemoveFolderIfExists(portableDataDir, MessageBoxEx.Show);
- MessageBox.Show("Flow Launcher has detected you disabled portable mode, " +
+ MessageBoxEx.Show("Flow Launcher has detected you disabled portable mode, " +
"the relevant shortcuts and uninstaller entry have been created");
}
}
@@ -186,7 +186,7 @@ namespace Flow.Launcher.Core.Configuration
if (roamingLocationExists && portableLocationExists)
{
- MessageBox.Show(string.Format("Flow Launcher detected your user data exists both in {0} and " +
+ MessageBoxEx.Show(string.Format("Flow Launcher detected your user data exists both in {0} and " +
"{1}. {2}{2}Please delete {1} in order to proceed. No changes have occurred.",
DataLocation.PortableDataPath, DataLocation.RoamingDataPath, Environment.NewLine));
diff --git a/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs b/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs
index 30e812c6f..6d41e2383 100644
--- a/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs
+++ b/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs
@@ -4,8 +4,8 @@ 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;
@@ -57,7 +57,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
EnvName,
Environment.NewLine
);
- if (MessageBox.Show(noRuntimeMessage, string.Empty, MessageBoxButtons.YesNo) == DialogResult.No)
+ if (MessageBoxEx.Show(noRuntimeMessage, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
{
var msg = string.Format(InternationalizationManager.Instance.GetTranslation("runtimePluginChooseRuntimeExecutable"), EnvName);
string selectedFile;
@@ -82,7 +82,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
}
else
{
- MessageBox.Show(string.Format(InternationalizationManager.Instance.GetTranslation("runtimePluginUnableToSetExecutablePath"), Language));
+ MessageBoxEx.Show(string.Format(InternationalizationManager.Instance.GetTranslation("runtimePluginUnableToSetExecutablePath"), Language));
Log.Error("PluginsLoader",
$"Not able to successfully set {EnvName} path, setting's plugin executable path variable is still an empty string.",
$"{Language}Environment");
@@ -98,7 +98,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
if (expectedPath == currentPath)
return;
- FilesFolders.RemoveFolderIfExists(installedDirPath);
+ FilesFolders.RemoveFolderIfExists(installedDirPath, MessageBoxEx.Show);
InstallEnvironment();
diff --git a/Flow.Launcher.Core/ExternalPlugins/Environments/PythonEnvironment.cs b/Flow.Launcher.Core/ExternalPlugins/Environments/PythonEnvironment.cs
index 5676e12f5..96c29646e 100644
--- a/Flow.Launcher.Core/ExternalPlugins/Environments/PythonEnvironment.cs
+++ b/Flow.Launcher.Core/ExternalPlugins/Environments/PythonEnvironment.cs
@@ -28,7 +28,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
internal override void InstallEnvironment()
{
- FilesFolders.RemoveFolderIfExists(InstallPath);
+ FilesFolders.RemoveFolderIfExists(InstallPath, MessageBoxEx.Show);
// Python 3.11.4 is no longer Windows 7 compatible. If user is on Win 7 and
// uses Python plugin they need to custom install and use v3.8.9
diff --git a/Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptEnvironment.cs b/Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptEnvironment.cs
index 70341f711..0d6f109e0 100644
--- a/Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptEnvironment.cs
+++ b/Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptEnvironment.cs
@@ -25,7 +25,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
internal override void InstallEnvironment()
{
- FilesFolders.RemoveFolderIfExists(InstallPath);
+ FilesFolders.RemoveFolderIfExists(InstallPath, MessageBoxEx.Show);
DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath).Wait();
diff --git a/Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptV2Environment.cs b/Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptV2Environment.cs
index 11ed94d3f..582a4407c 100644
--- a/Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptV2Environment.cs
+++ b/Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptV2Environment.cs
@@ -25,7 +25,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
internal override void InstallEnvironment()
{
- FilesFolders.RemoveFolderIfExists(InstallPath);
+ FilesFolders.RemoveFolderIfExists(InstallPath, MessageBoxEx.Show);
DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath).Wait();
diff --git a/Flow.Launcher/MessageBoxEx.xaml b/Flow.Launcher.Core/MessageBoxEx.xaml
similarity index 81%
rename from Flow.Launcher/MessageBoxEx.xaml
rename to Flow.Launcher.Core/MessageBoxEx.xaml
index f466a640e..fff107a68 100644
--- a/Flow.Launcher/MessageBoxEx.xaml
+++ b/Flow.Launcher.Core/MessageBoxEx.xaml
@@ -1,9 +1,9 @@
-
+
@@ -33,14 +33,11 @@
-
-
-
-
-
+
+
+
+
+
+
@@ -74,7 +75,7 @@
Grid.Column="0"
Width="18"
Height="18"
- Margin="0 0 0 0"
+ Margin="0 0 10 0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
RenderOptions.BitmapScalingMode="Fant"
@@ -84,7 +85,7 @@
x:Name="TitleTextBlock"
Grid.Column="1"
MaxWidth="400"
- Margin="10 0 26 0"
+ Margin="0 0 26 0"
VerticalAlignment="Center"
FontFamily="Segoe UI"
FontSize="20"
@@ -94,14 +95,26 @@
-
+
+
-
-
+
+
diff --git a/Flow.Launcher.Core/MessageBoxEx.xaml.cs b/Flow.Launcher.Core/MessageBoxEx.xaml.cs
new file mode 100644
index 000000000..a01b5f68d
--- /dev/null
+++ b/Flow.Launcher.Core/MessageBoxEx.xaml.cs
@@ -0,0 +1,203 @@
+using System;
+using System.IO;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
+using Flow.Launcher.Infrastructure;
+using Flow.Launcher.Infrastructure.Image;
+using Flow.Launcher.Infrastructure.Logger;
+
+namespace Flow.Launcher.Core
+{
+ public partial class MessageBoxEx : Window
+ {
+ private static MessageBoxEx msgBox;
+ private static MessageBoxResult _result = MessageBoxResult.None;
+
+ private readonly MessageBoxButton _button;
+
+ private MessageBoxEx(MessageBoxButton button)
+ {
+ _button = button;
+ InitializeComponent();
+ }
+
+ public static MessageBoxResult Show(string messageBoxText)
+ => Show(messageBoxText, string.Empty, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
+
+ public static MessageBoxResult Show(
+ string messageBoxText,
+ string caption = "",
+ MessageBoxButton button = MessageBoxButton.OK,
+ MessageBoxImage icon = MessageBoxImage.None,
+ MessageBoxResult defaultResult = MessageBoxResult.OK)
+ {
+ if (!Application.Current.Dispatcher.CheckAccess())
+ {
+ return Application.Current.Dispatcher.Invoke(() => Show(messageBoxText, caption, button, icon, defaultResult));
+ }
+
+ try
+ {
+ msgBox = new MessageBoxEx(button);
+ if (caption == string.Empty && button == MessageBoxButton.OK && icon == MessageBoxImage.None)
+ {
+ msgBox.Title = messageBoxText;
+ msgBox.DescOnlyTextBlock.Visibility = Visibility.Visible;
+ msgBox.DescOnlyTextBlock.Text = messageBoxText;
+ }
+ else
+ {
+ msgBox.Title = caption;
+ msgBox.TitleTextBlock.Text = caption;
+ msgBox.DescTextBlock.Text = messageBoxText;
+ _ = SetImageOfMessageBoxAsync(icon);
+ }
+ SetButtonVisibilityFocusAndResult(button, defaultResult);
+ msgBox.ShowDialog();
+ return _result;
+ }
+ catch (Exception e)
+ {
+ Log.Error($"|MessageBoxEx.Show|An error occurred: {e.Message}");
+ msgBox = null;
+ return MessageBoxResult.None;
+ }
+ }
+
+ private static void SetButtonVisibilityFocusAndResult(MessageBoxButton button, MessageBoxResult defaultResult)
+ {
+ switch (button)
+ {
+ case MessageBoxButton.OK:
+ msgBox.btnCancel.Visibility = Visibility.Collapsed;
+ msgBox.btnNo.Visibility = Visibility.Collapsed;
+ msgBox.btnYes.Visibility = Visibility.Collapsed;
+ msgBox.btnOk.Focus();
+ _result = MessageBoxResult.OK;
+ break;
+ case MessageBoxButton.OKCancel:
+ msgBox.btnNo.Visibility = Visibility.Collapsed;
+ msgBox.btnYes.Visibility = Visibility.Collapsed;
+ if (defaultResult == MessageBoxResult.Cancel)
+ {
+ msgBox.btnCancel.Focus();
+ _result = MessageBoxResult.Cancel;
+ }
+ else
+ {
+ msgBox.btnOk.Focus();
+ _result = MessageBoxResult.OK;
+ }
+ break;
+ case MessageBoxButton.YesNo:
+ msgBox.btnOk.Visibility = Visibility.Collapsed;
+ msgBox.btnCancel.Visibility = Visibility.Collapsed;
+ if (defaultResult == MessageBoxResult.No)
+ {
+ msgBox.btnNo.Focus();
+ _result = MessageBoxResult.No;
+ }
+ else
+ {
+ msgBox.btnYes.Focus();
+ _result = MessageBoxResult.Yes;
+ }
+ break;
+ case MessageBoxButton.YesNoCancel:
+ msgBox.btnOk.Visibility = Visibility.Collapsed;
+ if (defaultResult == MessageBoxResult.No)
+ {
+ msgBox.btnNo.Focus();
+ _result = MessageBoxResult.No;
+ }
+ else if (defaultResult == MessageBoxResult.Cancel)
+ {
+ msgBox.btnCancel.Focus();
+ _result = MessageBoxResult.Cancel;
+ }
+ else
+ {
+ msgBox.btnYes.Focus();
+ _result = MessageBoxResult.Yes;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ private static async Task SetImageOfMessageBoxAsync(MessageBoxImage icon)
+ {
+ switch (icon)
+ {
+ case MessageBoxImage.Exclamation:
+ await msgBox.SetImageAsync("Exclamation.png");
+ msgBox.Img.Visibility = Visibility.Visible;
+ break;
+ case MessageBoxImage.Question:
+ await msgBox.SetImageAsync("Question.png");
+ msgBox.Img.Visibility = Visibility.Visible;
+ break;
+ case MessageBoxImage.Information:
+ await msgBox.SetImageAsync("Information.png");
+ msgBox.Img.Visibility = Visibility.Visible;
+ break;
+ case MessageBoxImage.Error:
+ await msgBox.SetImageAsync("Error.png");
+ msgBox.Img.Visibility = Visibility.Visible;
+ break;
+ default:
+ msgBox.Img.Visibility = Visibility.Collapsed;
+ break;
+ }
+ }
+
+ private async Task SetImageAsync(string imageName)
+ {
+ var imagePath = Path.Combine(Constant.ProgramDirectory, "Images", imageName);
+ var imageSource = await ImageLoader.LoadAsync(imagePath);
+ Img.Source = imageSource;
+ }
+
+ private void KeyEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
+ {
+ if (_button == MessageBoxButton.YesNo)
+ return;
+ else if (_button == MessageBoxButton.OK)
+ _result = MessageBoxResult.OK;
+ else
+ _result = MessageBoxResult.Cancel;
+ DialogResult = false;
+ Close();
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ if (sender == btnOk)
+ _result = MessageBoxResult.OK;
+ else if (sender == btnYes)
+ _result = MessageBoxResult.Yes;
+ else if (sender == btnNo)
+ _result = MessageBoxResult.No;
+ else if (sender == btnCancel)
+ _result = MessageBoxResult.Cancel;
+ else
+ _result = MessageBoxResult.None;
+ msgBox.Close();
+ msgBox = null;
+ }
+
+ private void Button_Cancel(object sender, RoutedEventArgs e)
+ {
+ if (_button == MessageBoxButton.YesNo)
+ return;
+ else if (_button == MessageBoxButton.OK)
+ _result = MessageBoxResult.OK;
+ else
+ _result = MessageBoxResult.Cancel;
+ msgBox.Close();
+ msgBox = null;
+ }
+ }
+}
diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs
index 91cb36a0e..5c4eaa1da 100644
--- a/Flow.Launcher.Core/Plugin/PluginManager.cs
+++ b/Flow.Launcher.Core/Plugin/PluginManager.cs
@@ -519,7 +519,7 @@ namespace Flow.Launcher.Core.Plugin
var newPluginPath = Path.Combine(installDirectory, folderName);
- FilesFolders.CopyAll(pluginFolderPath, newPluginPath);
+ FilesFolders.CopyAll(pluginFolderPath, newPluginPath, MessageBoxEx.Show);
Directory.Delete(tempFolderPluginPath, true);
diff --git a/Flow.Launcher.Core/Plugin/PluginsLoader.cs b/Flow.Launcher.Core/Plugin/PluginsLoader.cs
index 0f2e4f996..7973c66ba 100644
--- a/Flow.Launcher.Core/Plugin/PluginsLoader.cs
+++ b/Flow.Launcher.Core/Plugin/PluginsLoader.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
-using System.Windows.Forms;
+using System.Windows;
using Flow.Launcher.Core.ExternalPlugins.Environments;
#pragma warning disable IDE0005
using Flow.Launcher.Infrastructure.Logger;
@@ -119,10 +119,10 @@ namespace Flow.Launcher.Core.Plugin
_ = Task.Run(() =>
{
- MessageBox.Show($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" +
+ MessageBoxEx.Show($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" +
$"{errorPluginString}{Environment.NewLine}{Environment.NewLine}" +
$"Please refer to the logs for more information", "",
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBoxButton.OK, MessageBoxImage.Warning);
});
}
diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs
index f6f35589d..1505e84f8 100644
--- a/Flow.Launcher.Core/Resource/Internationalization.cs
+++ b/Flow.Launcher.Core/Resource/Internationalization.cs
@@ -124,7 +124,7 @@ namespace Flow.Launcher.Core.Resource
// "Do you want to search with pinyin?"
string text = languageToSet == AvailableLanguages.Chinese ? "是否启用拼音搜索?" : "是否啓用拼音搜索?" ;
- if (MessageBox.Show(text, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
+ if (MessageBoxEx.Show(text, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
return false;
return true;
diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs
index c3a3e9891..0d8c0d901 100644
--- a/Flow.Launcher.Core/Resource/Theme.cs
+++ b/Flow.Launcher.Core/Resource/Theme.cs
@@ -110,7 +110,7 @@ namespace Flow.Launcher.Core.Resource
Log.Error($"|Theme.ChangeTheme|Theme <{theme}> path can't be found");
if (theme != defaultTheme)
{
- MessageBox.Show(string.Format(InternationalizationManager.Instance.GetTranslation("theme_load_failure_path_not_exists"), theme));
+ MessageBoxEx.Show(string.Format(InternationalizationManager.Instance.GetTranslation("theme_load_failure_path_not_exists"), theme));
ChangeTheme(defaultTheme);
}
return false;
@@ -120,7 +120,7 @@ namespace Flow.Launcher.Core.Resource
Log.Error($"|Theme.ChangeTheme|Theme <{theme}> fail to parse");
if (theme != defaultTheme)
{
- MessageBox.Show(string.Format(InternationalizationManager.Instance.GetTranslation("theme_load_failure_parse_error"), theme));
+ MessageBoxEx.Show(string.Format(InternationalizationManager.Instance.GetTranslation("theme_load_failure_parse_error"), theme));
ChangeTheme(defaultTheme);
}
return false;
diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs
index 3f64b273e..b92d86568 100644
--- a/Flow.Launcher.Core/Updater.cs
+++ b/Flow.Launcher.Core/Updater.cs
@@ -53,7 +53,7 @@ namespace Flow.Launcher.Core
if (newReleaseVersion <= currentVersion)
{
if (!silentUpdate)
- MessageBox.Show(api.GetTranslation("update_flowlauncher_already_on_latest"));
+ MessageBoxEx.Show(api.GetTranslation("update_flowlauncher_already_on_latest"));
return;
}
@@ -68,9 +68,9 @@ namespace Flow.Launcher.Core
if (DataLocation.PortableDataLocationInUse())
{
var targetDestination = updateManager.RootAppDirectory + $"\\app-{newReleaseVersion.ToString()}\\{DataLocation.PortableFolderName}";
- FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination);
- if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination))
- MessageBox.Show(string.Format(api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"),
+ FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination, MessageBoxEx.Show);
+ if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination, MessageBoxEx.Show))
+ MessageBoxEx.Show(string.Format(api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"),
DataLocation.PortableDataPath,
targetDestination));
}
@@ -83,7 +83,7 @@ namespace Flow.Launcher.Core
Log.Info($"|Updater.UpdateApp|Update success:{newVersionTips}");
- if (MessageBox.Show(newVersionTips, api.GetTranslation("update_flowlauncher_new_update"), MessageBoxButton.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.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index c95a8ce7b..1e36f3adc 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -7,6 +7,7 @@ using System.IO;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
+using System.Windows;
namespace Flow.Launcher.Plugin
{
@@ -298,5 +299,16 @@ namespace Flow.Launcher.Plugin
///
/// Choose the first result after reload if true; keep the last selected result if false. Default is true.
public void ReQuery(bool reselect = true);
+
+ ///
+ /// Displays a standardised Flow message box.
+ ///
+ /// The message of the message box.
+ /// The caption of the message box.
+ /// Specifies which button or buttons to display.
+ /// Specifies the icon to display.
+ /// Specifies the default result of the message box.
+ /// Specifies which message box button is clicked by the user.
+ public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK);
}
}
diff --git a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs
index dd8c4b112..5f003e351 100644
--- a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs
+++ b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs
@@ -21,7 +21,8 @@ namespace Flow.Launcher.Plugin.SharedCommands
///
///
///
- public static void CopyAll(this string sourcePath, string targetPath)
+ ///
+ public static void CopyAll(this string sourcePath, string targetPath, Func messageBoxExShow = null)
{
// Get the subdirectories for the specified directory.
DirectoryInfo dir = new DirectoryInfo(sourcePath);
@@ -54,7 +55,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
foreach (DirectoryInfo subdir in dirs)
{
string temppath = Path.Combine(targetPath, subdir.Name);
- CopyAll(subdir.FullName, temppath);
+ CopyAll(subdir.FullName, temppath, messageBoxExShow);
}
}
catch (Exception)
@@ -62,8 +63,9 @@ namespace Flow.Launcher.Plugin.SharedCommands
#if DEBUG
throw;
#else
- MessageBox.Show(string.Format("Copying path {0} has failed, it will now be deleted for consistency", targetPath));
- RemoveFolderIfExists(targetPath);
+ messageBoxExShow ??= MessageBox.Show;
+ messageBoxExShow(string.Format("Copying path {0} has failed, it will now be deleted for consistency", targetPath));
+ RemoveFolderIfExists(targetPath, messageBoxExShow);
#endif
}
@@ -75,8 +77,9 @@ namespace Flow.Launcher.Plugin.SharedCommands
///
///
///
+ ///
///
- public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath)
+ public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath, Func messageBoxExShow = null)
{
try
{
@@ -96,7 +99,8 @@ namespace Flow.Launcher.Plugin.SharedCommands
#if DEBUG
throw;
#else
- MessageBox.Show(string.Format("Unable to verify folders and files between {0} and {1}", fromPath, toPath));
+ messageBoxExShow ??= MessageBox.Show;
+ messageBoxExShow(string.Format("Unable to verify folders and files between {0} and {1}", fromPath, toPath));
return false;
#endif
}
@@ -107,7 +111,8 @@ namespace Flow.Launcher.Plugin.SharedCommands
/// Deletes a folder if it exists
///
///
- public static void RemoveFolderIfExists(this string path)
+ ///
+ public static void RemoveFolderIfExists(this string path, Func messageBoxExShow = null)
{
try
{
@@ -119,7 +124,8 @@ namespace Flow.Launcher.Plugin.SharedCommands
#if DEBUG
throw;
#else
- MessageBox.Show(string.Format("Not able to delete folder {0}, please go to the location and manually delete it", path));
+ messageBoxExShow ??= MessageBox.Show;
+ messageBoxExShow(string.Format("Not able to delete folder {0}, please go to the location and manually delete it", path));
#endif
}
}
@@ -148,7 +154,8 @@ namespace Flow.Launcher.Plugin.SharedCommands
/// Open a directory window (using the OS's default handler, usually explorer)
///
///
- public static void OpenPath(string fileOrFolderPath)
+ ///
+ public static void OpenPath(string fileOrFolderPath, Func messageBoxExShow = null)
{
var psi = new ProcessStartInfo
{
@@ -166,7 +173,8 @@ namespace Flow.Launcher.Plugin.SharedCommands
#if DEBUG
throw;
#else
- MessageBox.Show(string.Format("Unable to open the path {0}, please check if it exists", fileOrFolderPath));
+ messageBoxExShow ??= MessageBox.Show;
+ messageBoxExShow(string.Format("Unable to open the path {0}, please check if it exists", fileOrFolderPath));
#endif
}
}
@@ -177,7 +185,8 @@ namespace Flow.Launcher.Plugin.SharedCommands
/// File path
/// Working directory
/// Open as Administrator
- public static void OpenFile(string filePath, string workingDir = "", bool asAdmin = false)
+ ///
+ public static void OpenFile(string filePath, string workingDir = "", bool asAdmin = false, Func messageBoxExShow = null)
{
var psi = new ProcessStartInfo
{
@@ -196,7 +205,8 @@ namespace Flow.Launcher.Plugin.SharedCommands
#if DEBUG
throw;
#else
- MessageBox.Show(string.Format("Unable to open the path {0}, please check if it exists", filePath));
+ messageBoxExShow ??= MessageBox.Show;
+ messageBoxExShow(string.Format("Unable to open the path {0}, please check if it exists", filePath));
#endif
}
}
diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs
index 371b2dd07..ba47a4ded 100644
--- a/Flow.Launcher/ActionKeywords.xaml.cs
+++ b/Flow.Launcher/ActionKeywords.xaml.cs
@@ -2,6 +2,7 @@
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Plugin;
using Flow.Launcher.ViewModel;
+using Flow.Launcher.Core;
namespace Flow.Launcher
{
@@ -43,7 +44,7 @@ namespace Flow.Launcher
else
{
string msg = translater.GetTranslation("newActionKeywordsHasBeenAssigned");
- MessageBox.Show(msg);
+ MessageBoxEx.Show(msg);
}
}
}
diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
index 5db6115ad..81e7600b8 100644
--- a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
+++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
@@ -6,7 +6,7 @@ using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
-using Flow.Launcher.ViewModel;
+using Flow.Launcher.Core;
namespace Flow.Launcher
{
@@ -63,7 +63,7 @@ namespace Flow.Launcher
o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
if (updateCustomHotkey == null)
{
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidPluginHotkey"));
+ MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("invalidPluginHotkey"));
Close();
return;
}
diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs
index 531b29d50..dec3506eb 100644
--- a/Flow.Launcher/CustomShortcutSetting.xaml.cs
+++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs
@@ -3,6 +3,7 @@ using System;
using System.Windows;
using System.Windows.Input;
using Flow.Launcher.SettingPages.ViewModels;
+using Flow.Launcher.Core;
namespace Flow.Launcher
{
@@ -42,13 +43,13 @@ namespace Flow.Launcher
{
if (String.IsNullOrEmpty(Key) || String.IsNullOrEmpty(Value))
{
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("emptyShortcut"));
+ MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("emptyShortcut"));
return;
}
// Check if key is modified or adding a new one
if (((update && originalKey != Key) || !update) && _hotkeyVm.DoesShortcutExist(Key))
{
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("duplicateShortcut"));
+ MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("duplicateShortcut"));
return;
}
DialogResult = !update || originalKey != Key || originalValue != Value;
diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs
index 21ddf276a..8b30b8be1 100644
--- a/Flow.Launcher/Helper/HotKeyMapper.cs
+++ b/Flow.Launcher/Helper/HotKeyMapper.cs
@@ -4,8 +4,8 @@ using System;
using NHotkey;
using NHotkey.Wpf;
using Flow.Launcher.Core.Resource;
-using System.Windows;
using Flow.Launcher.ViewModel;
+using Flow.Launcher.Core;
namespace Flow.Launcher.Helper;
@@ -46,7 +46,7 @@ internal static class HotKeyMapper
{
string errorMsg = string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr);
string errorMsgTitle = InternationalizationManager.Instance.GetTranslation("MessageBoxTitle");
- MessageBox.Show(errorMsg,errorMsgTitle);
+ MessageBoxEx.Show(errorMsg, errorMsgTitle);
}
}
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/MessageBoxEx.xaml.cs b/Flow.Launcher/MessageBoxEx.xaml.cs
deleted file mode 100644
index e203f2683..000000000
--- a/Flow.Launcher/MessageBoxEx.xaml.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Forms;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using Flow.Launcher.Core.Resource;
-using Flow.Launcher.Infrastructure;
-using Flow.Launcher.Infrastructure.Image;
-using YamlDotNet.Core.Tokens;
-
-namespace Flow.Launcher
-{
- public partial class MessageBoxEx : Window
- {
- public MessageBoxEx()
- {
- 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;
-
-
- /// 1 parameter
- public static MessageBoxResult Show(string msg)
- {
- return Show(string.Empty, msg, MessageBoxButton.OK, MessageBoxImage.None);
- }
-
- // 2 parameter
- public static MessageBoxResult Show(string caption, string text)
- {
- return Show(caption, text, MessageBoxButton.OK, MessageBoxImage.None);
- }
-
- /// 3 parameter
- public static MessageBoxResult Show(string caption, string msg, MessageBoxType type)
- {
- switch (type)
- {
- case MessageBoxType.ConfirmationWithYesNo:
- return Show(caption, msg, MessageBoxButton.YesNo,
- MessageBoxImage.Question);
- case MessageBoxType.YesNo:
- return Show(caption, msg, MessageBoxButton.YesNo,
- MessageBoxImage.Question);
- case MessageBoxType.ConfirmationWithYesNoCancel:
- return Show(caption, msg, MessageBoxButton.YesNoCancel,
- MessageBoxImage.Question);
- case MessageBoxType.Information:
- return Show(caption, msg, MessageBoxButton.OK,
- MessageBoxImage.Information);
- case MessageBoxType.Error:
- return Show(caption, msg, MessageBoxButton.OK,
- MessageBoxImage.Error);
- case MessageBoxType.Warning:
- return Show(caption, msg, MessageBoxButton.OK,
- MessageBoxImage.Warning);
- default:
- return MessageBoxResult.No;
- }
- }
-
- // 4 parameter, Final Display Message.
- public static MessageBoxResult Show(string caption, string text, MessageBoxButton button, MessageBoxImage image)
- {
- msgBox = new MessageBoxEx();
- msgBox.TitleTextBlock.Text = text;
- msgBox.DescTextBlock.Text = caption;
- msgBox.Title = text;
- SetVisibilityOfButtons(button);
- SetImageOfMessageBox(image);
- msgBox.ShowDialog();
- return _result;
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- if (sender == btnOk)
- _result = MessageBoxResult.OK;
- else if (sender == btnYes)
- _result = MessageBoxResult.Yes;
- else if (sender == btnNo)
- _result = MessageBoxResult.No;
- else if (sender == btnCancel)
- _result = MessageBoxResult.Cancel;
- else
- _result = MessageBoxResult.None;
- msgBox.Close();
- msgBox = null;
- }
-
- private static void SetVisibilityOfButtons(MessageBoxButton button)
- {
- switch (button)
- {
- case MessageBoxButton.OK:
- msgBox.btnCancel.Visibility = Visibility.Collapsed;
- msgBox.btnNo.Visibility = Visibility.Collapsed;
- msgBox.btnYes.Visibility = Visibility.Collapsed;
- msgBox.btnOk.Focus();
- break;
- case MessageBoxButton.OKCancel:
- msgBox.btnNo.Visibility = Visibility.Collapsed;
- msgBox.btnYes.Visibility = Visibility.Collapsed;
- msgBox.btnCancel.Focus();
- break;
- case MessageBoxButton.YesNo:
- msgBox.btnOk.Visibility = Visibility.Collapsed;
- msgBox.btnCancel.Visibility = Visibility.Collapsed;
- msgBox.btnNo.Focus();
- break;
- case MessageBoxButton.YesNoCancel:
- msgBox.btnOk.Visibility = Visibility.Collapsed;
- msgBox.btnCancel.Focus();
- break;
- default:
- break;
- }
- }
- private static void SetImageOfMessageBox(MessageBoxImage image)
- {
- switch (image)
- {
- case MessageBoxImage.Warning:
- msgBox.SetImage("Warning.png");
- msgBox.Img.Visibility = Visibility.Visible;
- break;
- case MessageBoxImage.Question:
- msgBox.SetImage("Question.png");
- msgBox.Img.Visibility = Visibility.Visible;
- break;
- case MessageBoxImage.Information:
- msgBox.SetImage("Information.png");
- msgBox.Img.Visibility = Visibility.Visible;
- break;
- case MessageBoxImage.Error:
- msgBox.SetImage("Error.png");
- msgBox.Img.Visibility = Visibility.Visible;
- break;
- default:
- msgBox.Img.Visibility = Visibility.Collapsed;
- break;
- }
- }
- private void SetImage(string imageName)
- {
- string uri = Constant.ProgramDirectory + "/Images/" + imageName;
- var uriSource = new Uri(uri, UriKind.RelativeOrAbsolute);
- Img.Source = new BitmapImage(uriSource);
- }
- private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
- {
- DialogResult = false;
- Close();
- }
-
- private void Button_Cancel(object sender, RoutedEventArgs e)
- {
- msgBox.Close();
- msgBox = null;
- }
-
- }
-}
diff --git a/Flow.Launcher/PriorityChangeWindow.xaml.cs b/Flow.Launcher/PriorityChangeWindow.xaml.cs
index 2d0966de4..2154b058d 100644
--- a/Flow.Launcher/PriorityChangeWindow.xaml.cs
+++ b/Flow.Launcher/PriorityChangeWindow.xaml.cs
@@ -5,6 +5,7 @@ using Flow.Launcher.ViewModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using Flow.Launcher.Core;
namespace Flow.Launcher
{
@@ -23,7 +24,7 @@ namespace Flow.Launcher
this.pluginViewModel = pluginViewModel;
if (plugin == null)
{
- MessageBox.Show(translater.GetTranslation("cannotFindSpecifiedPlugin"));
+ MessageBoxEx.Show(translater.GetTranslation("cannotFindSpecifiedPlugin"));
Close();
}
}
@@ -43,7 +44,7 @@ namespace Flow.Launcher
else
{
string msg = translater.GetTranslation("invalidPriority");
- MessageBox.Show(msg);
+ MessageBoxEx.Show(msg);
}
}
diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs
index 20b02ddee..0e567cdd4 100644
--- a/Flow.Launcher/PublicAPIInstance.cs
+++ b/Flow.Launcher/PublicAPIInstance.cs
@@ -25,6 +25,7 @@ using Flow.Launcher.Infrastructure.Storage;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Collections.Specialized;
+using Flow.Launcher.Core;
namespace Flow.Launcher
{
@@ -318,6 +319,9 @@ namespace Flow.Launcher
public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect);
+ public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK) =>
+ MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult);
+
#endregion
#region Private Methods
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs
index c314b42ee..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.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 a4488a037..6d8af9a3f 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs
@@ -7,6 +7,7 @@ using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
+using Flow.Launcher.Core;
namespace Flow.Launcher.SettingPages.ViewModels;
@@ -41,11 +42,11 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
var item = SelectedCustomPluginHotkey;
if (item is null)
{
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
+ MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
return;
}
- var result = MessageBox.Show(
+ var result = MessageBoxEx.Show(
string.Format(
InternationalizationManager.Instance.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey
),
@@ -66,7 +67,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
var item = SelectedCustomPluginHotkey;
if (item is null)
{
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
+ MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
return;
}
@@ -87,11 +88,11 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
var item = SelectedCustomShortcut;
if (item is null)
{
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
+ MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
return;
}
- var result = MessageBox.Show(
+ var result = MessageBoxEx.Show(
string.Format(
InternationalizationManager.Instance.GetTranslation("deleteCustomShortcutWarning"), item.Key, item.Value
),
@@ -111,7 +112,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
var item = SelectedCustomShortcut;
if (item is null)
{
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
+ MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
return;
}
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneProxyViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneProxyViewModel.cs
index 2dd57809d..1c840fb27 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneProxyViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneProxyViewModel.cs
@@ -1,5 +1,4 @@
using System.Net;
-using System.Windows;
using CommunityToolkit.Mvvm.Input;
using Flow.Launcher.Core;
using Flow.Launcher.Core.Resource;
@@ -23,7 +22,7 @@ public partial class SettingsPaneProxyViewModel : BaseModel
private void OnTestProxyClicked()
{
var message = TestProxy();
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation(message));
+ MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation(message));
}
private string TestProxy()
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs
index f2e52dbae..8a835ba7c 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Windows;
-using System.Windows.Controls;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -15,6 +14,7 @@ using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.ViewModel;
using ModernWpf;
+using Flow.Launcher.Core;
using ThemeManager = Flow.Launcher.Core.Resource.ThemeManager;
using ThemeManagerForColorSchemeSwitch = ModernWpf.ThemeManager;
@@ -49,7 +49,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel
{
if (ThemeManager.Instance.BlurEnabled && value)
{
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("shadowEffectNotAllowed"));
+ MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("shadowEffectNotAllowed"));
return;
}
diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs
index 5077e6061..7f42eacf6 100644
--- a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
-using System.Windows;
using System.Windows.Controls;
using Mages.Core;
using Flow.Launcher.Plugin.Calculator.ViewModels;
@@ -101,7 +100,7 @@ namespace Flow.Launcher.Plugin.Calculator
}
catch (ExternalException)
{
- MessageBox.Show("Copy failed, please try later");
+ Context.API.ShowMsgBox("Copy failed, please try later");
return false;
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
index f061ca183..feccc74c8 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
@@ -10,10 +10,6 @@ using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
using System.Linq;
using Flow.Launcher.Plugin.Explorer.Helper;
-using MessageBox = System.Windows.Forms.MessageBox;
-using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon;
-using MessageBoxButton = System.Windows.Forms.MessageBoxButtons;
-using DialogResult = System.Windows.Forms.DialogResult;
using Flow.Launcher.Plugin.Explorer.ViewModels;
namespace Flow.Launcher.Plugin.Explorer
@@ -177,12 +173,12 @@ namespace Flow.Launcher.Plugin.Explorer
{
try
{
- if (MessageBox.Show(
+ if (Context.API.ShowMsgBox(
string.Format(Context.API.GetTranslation("plugin_explorer_delete_folder_link"), record.FullPath),
string.Empty,
MessageBoxButton.YesNo,
- MessageBoxIcon.Warning)
- == DialogResult.No)
+ MessageBoxImage.Warning)
+ == MessageBoxResult.No)
return false;
if (isFile)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs
index ef923632d..c8bd68279 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs
@@ -5,6 +5,7 @@ using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using System.Windows;
namespace Flow.Launcher.Plugin.Explorer.Search.Everything;
@@ -19,10 +20,10 @@ public static class EverythingDownloadHelper
if (string.IsNullOrEmpty(installedLocation))
{
- if (System.Windows.Forms.MessageBox.Show(
+ if (api.ShowMsgBox(
string.Format(api.GetTranslation("flowlauncher_plugin_everything_installing_select"), Environment.NewLine),
api.GetTranslation("flowlauncher_plugin_everything_installing_title"),
- System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
+ MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
var dlg = new System.Windows.Forms.OpenFileDialog
{
@@ -50,7 +51,7 @@ public static class EverythingDownloadHelper
installedLocation = "C:\\Program Files\\Everything\\Everything.exe";
- FilesFolders.OpenPath(installedLocation);
+ FilesFolders.OpenPath(installedLocation, (string str) => api.ShowMsgBox(str));
return installedLocation;
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
index 1e7555a8d..1add84765 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
@@ -5,7 +5,6 @@ using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using System.Windows;
using Flow.Launcher.Plugin.Explorer.Search.Everything;
using System.Windows.Input;
using Path = System.IO.Path;
@@ -123,7 +122,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
+ Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
return false;
}
}
@@ -137,7 +136,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
+ Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
return false;
}
}
@@ -152,7 +151,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
+ Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
return false;
}
}
@@ -315,7 +314,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_openfile_error"));
+ Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_openfile_error"));
}
return true;
@@ -337,7 +336,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
private static void OpenFile(string filePath, string workingDir = "", bool asAdmin = false)
{
IncrementEverythingRunCounterIfNeeded(filePath);
- FilesFolders.OpenFile(filePath, workingDir, asAdmin);
+ FilesFolders.OpenFile(filePath, workingDir, asAdmin, (string str) => Context.API.ShowMsgBox(str));
}
private static void OpenFolder(string folderPath, string fileNameOrFilePath = null)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
index 309f7a6f7..d2b85e687 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
@@ -14,7 +14,6 @@ using System.Linq;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Input;
-using MessageBox = System.Windows.Forms.MessageBox;
namespace Flow.Launcher.Plugin.Explorer.ViewModels
{
@@ -358,7 +357,7 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
private void ShowUnselectedMessage()
{
var warning = Context.API.GetTranslation("plugin_explorer_make_selection_warning");
- MessageBox.Show(warning);
+ Context.API.ShowMsgBox(warning);
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
index 9e86ce4b4..34a5b2760 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
@@ -62,10 +62,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views
switch (CurrentActionKeyword.KeywordProperty, KeywordEnabled)
{
case (Settings.ActionKeyword.FileContentSearchActionKeyword, true):
- MessageBox.Show(api.GetTranslation("plugin_explorer_globalActionKeywordInvalid"));
+ api.ShowMsgBox(api.GetTranslation("plugin_explorer_globalActionKeywordInvalid"));
return;
case (Settings.ActionKeyword.QuickAccessActionKeyword, true):
- MessageBox.Show(api.GetTranslation("plugin_explorer_quickaccess_globalActionKeywordInvalid"));
+ api.ShowMsgBox(api.GetTranslation("plugin_explorer_quickaccess_globalActionKeywordInvalid"));
return;
}
@@ -77,7 +77,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
}
// The keyword is not valid, so show message
- MessageBox.Show(api.GetTranslation("newActionKeywordsHasBeenAssigned"));
+ api.ShowMsgBox(api.GetTranslation("newActionKeywordsHasBeenAssigned"));
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
index 2d71329b4..305d248d3 100644
--- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
@@ -131,7 +131,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
Environment.NewLine);
}
- if (MessageBox.Show(message, Context.API.GetTranslation("plugin_pluginsmanager_install_title"),
+ if (Context.API.ShowMsgBox(message, Context.API.GetTranslation("plugin_pluginsmanager_install_title"),
MessageBoxButton.YesNo) == MessageBoxResult.No)
return;
@@ -265,7 +265,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
Environment.NewLine);
}
- if (MessageBox.Show(message,
+ if (Context.API.ShowMsgBox(message,
Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
MessageBoxButton.YesNo) != MessageBoxResult.Yes)
{
@@ -360,7 +360,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
resultsForUpdate.Count());
}
- if (MessageBox.Show(message,
+ if (Context.API.ShowMsgBox(message,
Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
MessageBoxButton.YesNo) == MessageBoxResult.No)
{
@@ -474,7 +474,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
if (Settings.WarnFromUnknownSource)
{
if (!InstallSourceKnown(plugin.UrlDownload)
- && MessageBox.Show(string.Format(
+ && Context.API.ShowMsgBox(string.Format(
Context.API.GetTranslation("plugin_pluginsmanager_install_unknown_source_warning"),
Environment.NewLine),
Context.API.GetTranslation(
@@ -511,7 +511,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
if (Settings.WarnFromUnknownSource)
{
if (!InstallSourceKnown(plugin.Website)
- && MessageBox.Show(string.Format(
+ && Context.API.ShowMsgBox(string.Format(
Context.API.GetTranslation(
"plugin_pluginsmanager_install_unknown_source_warning"),
Environment.NewLine),
@@ -648,7 +648,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
Environment.NewLine);
}
- if (MessageBox.Show(message,
+ if (Context.API.ShowMsgBox(message,
Context.API.GetTranslation("plugin_pluginsmanager_uninstall_title"),
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
index be8b768bd..6385ab364 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
@@ -32,7 +32,7 @@ namespace Flow.Launcher.Plugin.Program
var (modified, msg) = ViewModel.AddOrUpdate();
if (modified == false && msg != null)
{
- MessageBox.Show(msg); // Invalid
+ ViewModel.API.ShowMsgBox(msg); // Invalid
return;
}
DialogResult = modified;
diff --git a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml.cs
index 31565c8b0..55d44bdc2 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml.cs
@@ -39,14 +39,14 @@ namespace Flow.Launcher.Plugin.Program
if (suffixes.Length == 0 && UseCustomSuffixes)
{
string warning = context.API.GetTranslation("flowlauncher_plugin_program_suffixes_cannot_empty");
- MessageBox.Show(warning);
+ context.API.ShowMsgBox(warning);
return;
}
if (protocols.Length == 0 && UseCustomProtocols)
{
string warning = context.API.GetTranslation("flowlauncher_plugin_protocols_cannot_empty");
- MessageBox.Show(warning);
+ context.API.ShowMsgBox(warning);
return;
}
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
index 7570d6b4d..36b5acc8a 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
@@ -178,7 +178,7 @@ namespace Flow.Launcher.Plugin.Program.Views
if (selectedProgramSource == null)
{
string msg = context.API.GetTranslation("flowlauncher_plugin_program_pls_select_program_source");
- MessageBox.Show(msg);
+ context.API.ShowMsgBox(msg);
}
else
{
@@ -283,7 +283,7 @@ namespace Flow.Launcher.Plugin.Program.Views
if (selectedItems.Count == 0)
{
string msg = context.API.GetTranslation("flowlauncher_plugin_program_pls_select_program_source");
- MessageBox.Show(msg);
+ context.API.ShowMsgBox(msg);
return;
}
@@ -292,7 +292,7 @@ namespace Flow.Launcher.Plugin.Program.Views
var msg = string.Format(
context.API.GetTranslation("flowlauncher_plugin_program_delete_program_source"));
- if (MessageBox.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
+ if (context.API.ShowMsgBox(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 1ec07915d..6e5558228 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
-using System.Linq;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Forms;
@@ -14,7 +13,6 @@ using Flow.Launcher.Plugin.SharedCommands;
using Application = System.Windows.Application;
using Control = System.Windows.Controls.Control;
using FormsApplication = System.Windows.Forms.Application;
-using MessageBox = System.Windows.MessageBox;
namespace Flow.Launcher.Plugin.Sys
{
@@ -143,7 +141,7 @@ namespace Flow.Launcher.Plugin.Sys
IcoPath = "Images\\shutdown.png",
Action = c =>
{
- var result = MessageBox.Show(
+ var result = context.API.ShowMsgBox(
context.API.GetTranslation("flowlauncher_plugin_sys_dlgtext_shutdown_computer"),
context.API.GetTranslation("flowlauncher_plugin_sys_shutdown_computer"),
MessageBoxButton.YesNo, MessageBoxImage.Warning);
@@ -163,7 +161,7 @@ namespace Flow.Launcher.Plugin.Sys
IcoPath = "Images\\restart.png",
Action = c =>
{
- var result = MessageBox.Show(
+ var result = context.API.ShowMsgBox(
context.API.GetTranslation("flowlauncher_plugin_sys_dlgtext_restart_computer"),
context.API.GetTranslation("flowlauncher_plugin_sys_restart_computer"),
MessageBoxButton.YesNo, MessageBoxImage.Warning);
@@ -183,7 +181,7 @@ namespace Flow.Launcher.Plugin.Sys
IcoPath = "Images\\restart_advanced.png",
Action = c =>
{
- var result = MessageBox.Show(
+ var result = context.API.ShowMsgBox(
context.API.GetTranslation("flowlauncher_plugin_sys_dlgtext_restart_computer_advanced"),
context.API.GetTranslation("flowlauncher_plugin_sys_restart_computer"),
MessageBoxButton.YesNo, MessageBoxImage.Warning);
@@ -202,7 +200,7 @@ namespace Flow.Launcher.Plugin.Sys
IcoPath = "Images\\logoff.png",
Action = c =>
{
- var result = MessageBox.Show(
+ var result = context.API.ShowMsgBox(
context.API.GetTranslation("flowlauncher_plugin_sys_dlgtext_logoff_computer"),
context.API.GetTranslation("flowlauncher_plugin_sys_log_off"),
MessageBoxButton.YesNo, MessageBoxImage.Warning);
@@ -279,7 +277,7 @@ namespace Flow.Launcher.Plugin.Sys
var result = SHEmptyRecycleBin(new WindowInteropHelper(Application.Current.MainWindow).Handle, 0);
if (result != (uint) HRESULT.S_OK && result != (uint) 0x8000FFFF)
{
- MessageBox.Show($"Error emptying recycle bin, error code: {result}\n" +
+ context.API.ShowMsgBox($"Error emptying recycle bin, error code: {result}\n" +
"please refer to https://msdn.microsoft.com/en-us/library/windows/desktop/aa378137",
"Error",
MessageBoxButton.OK, MessageBoxImage.Error);
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs
index 39aa1738f..9b52db5a8 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs
@@ -13,7 +13,7 @@ namespace Flow.Launcher.Plugin.WebSearch
{
public class Main : IAsyncPlugin, ISettingProvider, IPluginI18n, IResultUpdated
{
- private PluginInitContext _context;
+ internal static PluginInitContext _context;
private Settings _settings;
private SettingsViewModel _viewModel;
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs
index 60863ee82..a3e5630c2 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs
@@ -55,17 +55,17 @@ namespace Flow.Launcher.Plugin.WebSearch
if (string.IsNullOrEmpty(_searchSource.Title))
{
var warning = _api.GetTranslation("flowlauncher_plugin_websearch_input_title");
- MessageBox.Show(warning);
+ _context.API.ShowMsgBox(warning);
}
else if (string.IsNullOrEmpty(_searchSource.Url))
{
var warning = _api.GetTranslation("flowlauncher_plugin_websearch_input_url");
- MessageBox.Show(warning);
+ _context.API.ShowMsgBox(warning);
}
else if (string.IsNullOrEmpty(_searchSource.ActionKeyword))
{
var warning = _api.GetTranslation("flowlauncher_plugin_websearch_input_action_keyword");
- MessageBox.Show(warning);
+ _context.API.ShowMsgBox(warning);
}
else if (_action == Action.Add)
{
@@ -92,7 +92,7 @@ namespace Flow.Launcher.Plugin.WebSearch
else
{
var warning = _api.GetTranslation("newActionKeywordsHasBeenAssigned");
- MessageBox.Show(warning);
+ _context.API.ShowMsgBox(warning);
}
}
@@ -113,7 +113,7 @@ namespace Flow.Launcher.Plugin.WebSearch
else
{
var warning = _api.GetTranslation("newActionKeywordsHasBeenAssigned");
- MessageBox.Show(warning);
+ _context.API.ShowMsgBox(warning);
}
if (!string.IsNullOrEmpty(selectedNewIconImageFullPath))
@@ -138,7 +138,7 @@ namespace Flow.Launcher.Plugin.WebSearch
if (!string.IsNullOrEmpty(selectedNewIconImageFullPath))
{
if (_viewModel.ShouldProvideHint(selectedNewIconImageFullPath))
- MessageBox.Show(_api.GetTranslation("flowlauncher_plugin_websearch_iconpath_hint"));
+ _context.API.ShowMsgBox(_api.GetTranslation("flowlauncher_plugin_websearch_iconpath_hint"));
imgPreviewIcon.Source = await _viewModel.LoadPreviewIconAsync(selectedNewIconImageFullPath);
}
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs
index 105e7dd68..9c5e81cb5 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs
@@ -41,7 +41,7 @@ namespace Flow.Launcher.Plugin.WebSearch
#if DEBUG
throw;
#else
- MessageBox.Show(string.Format("Copying the selected image file to {0} has failed, changes will now be reverted", destinationFileNameFullPath));
+ Main._context.API.ShowMsgBox(string.Format("Copying the selected image file to {0} has failed, changes will now be reverted", destinationFileNameFullPath));
UpdateIconAttributes(selectedSearchSource, fullPathToOriginalImage);
#endif
}
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs
index 7caa5beb3..739bc9d6b 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs
@@ -1,4 +1,4 @@
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
using Flow.Launcher.Core.Plugin;
using System.ComponentModel;
@@ -36,7 +36,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 = MessageBox.Show(formated, string.Empty, MessageBoxButton.YesNo);
+ var result = _context.API.ShowMsgBox(formated, string.Empty, MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
var id = _context.CurrentPluginMetadata.ID;