mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add default messageboxShow parameter for functions in FilesFolders
This commit is contained in:
parent
5312505d2a
commit
0d362b30dd
1 changed files with 11 additions and 6 deletions
|
|
@ -22,7 +22,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
/// <param name="sourcePath"></param>
|
||||
/// <param name="targetPath"></param>
|
||||
/// <param name="messageBoxExShow"></param>
|
||||
public static void CopyAll(this string sourcePath, string targetPath, Func<string, MessageBoxResult> messageBoxExShow)
|
||||
public static void CopyAll(this string sourcePath, string targetPath, Func<string, MessageBoxResult> messageBoxExShow = null)
|
||||
{
|
||||
// Get the subdirectories for the specified directory.
|
||||
DirectoryInfo dir = new DirectoryInfo(sourcePath);
|
||||
|
|
@ -63,6 +63,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
messageBoxExShow ??= MessageBox.Show;
|
||||
messageBoxExShow(string.Format("Copying path {0} has failed, it will now be deleted for consistency", targetPath));
|
||||
RemoveFolderIfExists(targetPath, messageBoxExShow);
|
||||
#endif
|
||||
|
|
@ -78,7 +79,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
/// <param name="toPath"></param>
|
||||
/// <param name="messageBoxExShow"></param>
|
||||
/// <returns></returns>
|
||||
public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath, Func<string, MessageBoxResult> messageBoxExShow)
|
||||
public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath, Func<string, MessageBoxResult> messageBoxExShow = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -98,6 +99,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
messageBoxExShow ??= MessageBox.Show;
|
||||
messageBoxExShow(string.Format("Unable to verify folders and files between {0} and {1}", fromPath, toPath));
|
||||
return false;
|
||||
#endif
|
||||
|
|
@ -110,7 +112,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="messageBoxExShow"></param>
|
||||
public static void RemoveFolderIfExists(this string path, Func<string, MessageBoxResult> messageBoxExShow)
|
||||
public static void RemoveFolderIfExists(this string path, Func<string, MessageBoxResult> messageBoxExShow = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -122,6 +124,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
messageBoxExShow ??= MessageBox.Show;
|
||||
messageBoxExShow(string.Format("Not able to delete folder {0}, please go to the location and manually delete it", path));
|
||||
#endif
|
||||
}
|
||||
|
|
@ -152,7 +155,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
/// </summary>
|
||||
/// <param name="fileOrFolderPath"></param>
|
||||
/// <param name="messageBoxExShow"></param>
|
||||
public static void OpenPath(string fileOrFolderPath, Func<string, MessageBoxResult> messageBoxExShow)
|
||||
public static void OpenPath(string fileOrFolderPath, Func<string, MessageBoxResult> messageBoxExShow = null)
|
||||
{
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
|
|
@ -170,6 +173,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
messageBoxExShow ??= MessageBox.Show;
|
||||
messageBoxExShow(string.Format("Unable to open the path {0}, please check if it exists", fileOrFolderPath));
|
||||
#endif
|
||||
}
|
||||
|
|
@ -179,10 +183,10 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
/// Open a file with associated application
|
||||
/// </summary>
|
||||
/// <param name="filePath">File path</param>
|
||||
/// <param name="messageBoxExShow"></param>
|
||||
/// <param name="workingDir">Working directory</param>
|
||||
/// <param name="asAdmin">Open as Administrator</param>
|
||||
public static void OpenFile(string filePath, Func<string, MessageBoxResult> messageBoxExShow, string workingDir = "", bool asAdmin = false)
|
||||
/// <param name="messageBoxExShow"></param>
|
||||
public static void OpenFile(string filePath, string workingDir = "", bool asAdmin = false, Func<string, MessageBoxResult> messageBoxExShow = null)
|
||||
{
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
|
|
@ -201,6 +205,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
messageBoxExShow ??= MessageBox.Show;
|
||||
messageBoxExShow(string.Format("Unable to open the path {0}, please check if it exists", filePath));
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue