add error message method to api to allow the use of standard error icon

This commit is contained in:
Jeremy Wu 2021-04-16 08:53:19 +10:00
parent 41c3f8a793
commit e7127cf514
3 changed files with 14 additions and 5 deletions

View file

@ -47,6 +47,13 @@ namespace Flow.Launcher.Plugin
/// </summary>
void CheckForNewUpdate();
/// <summary>
/// Show the error message using Flow's standard error icon.
/// </summary>
/// <param name="title">Message title</param>
/// <param name="subTitle">Optional message subtitle</param>
void ShowMsgError(string title, string subTitle = "");
/// <summary>
/// Show message box
/// </summary>

View file

@ -84,6 +84,8 @@ namespace Flow.Launcher
public Task ReloadAllPluginData() => PluginManager.ReloadData();
public void ShowMsgError(string title, string subTitle = "") => ShowMsg(title, subTitle, Constant.ErrorIcon, true);
public void ShowMsg(string title, string subTitle = "", string iconPath = "") => ShowMsg(title, subTitle, iconPath, true);
public void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true)

View file

@ -184,7 +184,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
var message = $"Fail to delete {fileOrFolder} at {record.FullPath}";
LogException(message, e);
Context.API.ShowMsg(message);
Context.API.ShowMsgError(message);
return false;
}
@ -208,7 +208,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
var name = "Plugin: Folder";
var message = $"File not found: {e.Message}";
Context.API.ShowMsg(name, message);
Context.API.ShowMsgError(name, message);
}
return true;
@ -236,7 +236,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
var message = $"Fail to open file at {record.FullPath}";
LogException(message, e);
Context.API.ShowMsg(message);
Context.API.ShowMsgError(message);
return false;
}
@ -267,7 +267,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
var message = $"Failed to open editor for file at {record.FullPath}";
LogException(message, e);
Context.API.ShowMsg(message);
Context.API.ShowMsgError(message);
return false;
}
},
@ -326,7 +326,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
var message = Context.API.GetTranslation("plugin_explorer_openindexingoptions_errormsg");
LogException(message, e);
Context.API.ShowMsg(message);
Context.API.ShowMsgError(message);
return false;
}
},