From ed5e0bb2d9a8c908f301d794ce2f4bcda8d2b8ca Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 26 Feb 2025 20:11:27 +0800 Subject: [PATCH] Improve documents --- Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 11 +++++------ Flow.Launcher/ProgressBoxEx.xaml.cs | 14 +++++++------- Flow.Launcher/PublicAPIInstance.cs | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index 8376fd07b..ef22b697e 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -322,17 +322,16 @@ namespace Flow.Launcher.Plugin public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK); /// - /// Displays a standardised Flow message box. - /// If there is issue when showing the message box, it will return null. + /// Displays a standardised Flow progress box. /// - /// The caption of the message box. + /// The caption of the progress box. /// /// Time-consuming task function, whose input is the action to report progress. /// The input of the action is the progress value which is a double value between 0 and 100. /// If there are any exceptions, this action will be null. /// - /// When user closes the progress box manually by button or esc key, this action will be called. - /// A progress box interface. - public Task ShowProgressBoxAsync(string caption, Func, Task> reportProgressAsync, Action forceClosed = null); + /// When user cancel the progress, this action will be called. + /// + public Task ShowProgressBoxAsync(string caption, Func, Task> reportProgressAsync, Action cancelProgress = null); } } diff --git a/Flow.Launcher/ProgressBoxEx.xaml.cs b/Flow.Launcher/ProgressBoxEx.xaml.cs index 755fc4a1f..2395bdf34 100644 --- a/Flow.Launcher/ProgressBoxEx.xaml.cs +++ b/Flow.Launcher/ProgressBoxEx.xaml.cs @@ -8,15 +8,15 @@ namespace Flow.Launcher { public partial class ProgressBoxEx : Window { - private readonly Action _forceClosed; + private readonly Action _cancelProgress; - private ProgressBoxEx(Action forceClosed) + private ProgressBoxEx(Action cancelProgress) { - _forceClosed = forceClosed; + _cancelProgress = cancelProgress; InitializeComponent(); } - public static async Task ShowAsync(string caption, Func, Task> reportProgressAsync, Action forceClosed = null) + public static async Task ShowAsync(string caption, Func, Task> reportProgressAsync, Action cancelProgress = null) { ProgressBoxEx prgBox = null; try @@ -25,7 +25,7 @@ namespace Flow.Launcher { await Application.Current.Dispatcher.InvokeAsync(() => { - prgBox = new ProgressBoxEx(forceClosed) + prgBox = new ProgressBoxEx(cancelProgress) { Title = caption }; @@ -35,7 +35,7 @@ namespace Flow.Launcher } else { - prgBox = new ProgressBoxEx(forceClosed) + prgBox = new ProgressBoxEx(cancelProgress) { Title = caption }; @@ -113,7 +113,7 @@ namespace Flow.Launcher private void ForceClose() { Close(); - _forceClosed?.Invoke(); + _cancelProgress?.Invoke(); } } } diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 7706a64ba..848d7f14c 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -324,7 +324,7 @@ namespace Flow.Launcher 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); - public Task ShowProgressBoxAsync(string caption, Func, Task> reportProgressAsync, Action forceClosed = null) => ProgressBoxEx.ShowAsync(caption, reportProgressAsync, forceClosed); + public Task ShowProgressBoxAsync(string caption, Func, Task> reportProgressAsync, Action cancelProgress = null) => ProgressBoxEx.ShowAsync(caption, reportProgressAsync, cancelProgress); #endregion