mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Check ui thread when calling close function & Update documents
This commit is contained in:
parent
aff6b1aff1
commit
8aebf958aa
3 changed files with 11 additions and 14 deletions
|
|
@ -66,11 +66,16 @@ namespace Flow.Launcher.Core
|
|||
|
||||
private new void Close()
|
||||
{
|
||||
if (!Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(Close);
|
||||
}
|
||||
|
||||
if (_isClosed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
base.Close();
|
||||
_isClosed = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
public interface IProgressBoxEx
|
||||
{
|
||||
/// <summary>
|
||||
/// Show progress box. It should be called from the main ui thread.
|
||||
/// Show progress box.
|
||||
/// </summary>
|
||||
/// <param name="progress">
|
||||
/// Progress value. Should be between 0 and 100. When progress is 100, the progress box will be closed.
|
||||
|
|
@ -14,7 +14,7 @@ public interface IProgressBoxEx
|
|||
public void ReportProgress(double progress);
|
||||
|
||||
/// <summary>
|
||||
/// Close progress box. It should be called from the main ui thread.
|
||||
/// Close progress box.
|
||||
/// </summary>
|
||||
public void Close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
if (downloadCancelled)
|
||||
return;
|
||||
else
|
||||
CleanupProgressBoxEx(prgBox);
|
||||
prgBox?.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -217,7 +217,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
catch (HttpRequestException e)
|
||||
{
|
||||
// force close progress box
|
||||
CleanupProgressBoxEx(prgBox);
|
||||
prgBox?.Close();
|
||||
|
||||
// show error message
|
||||
Context.API.ShowMsgError(
|
||||
|
|
@ -230,7 +230,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
catch (Exception e)
|
||||
{
|
||||
// force close progress box
|
||||
CleanupProgressBoxEx(prgBox);
|
||||
prgBox?.Close();
|
||||
|
||||
// show error message
|
||||
Context.API.ShowMsgError(Context.API.GetTranslation("plugin_pluginsmanager_install_error_title"),
|
||||
|
|
@ -256,14 +256,6 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
}
|
||||
}
|
||||
|
||||
private static void CleanupProgressBoxEx(IProgressBoxEx prgBox)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
prgBox?.Close();
|
||||
});
|
||||
}
|
||||
|
||||
internal async ValueTask<List<Result>> RequestUpdateAsync(string search, CancellationToken token,
|
||||
bool usePrimaryUrlOnly = false)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue