|
1 | | -using Flow.Launcher.Plugin.SharedModels; |
| 1 | +using Flow.Launcher.Plugin.SharedModels; |
2 | 2 | using JetBrains.Annotations; |
3 | 3 | using System; |
4 | 4 | using System.Collections.Generic; |
@@ -181,9 +181,13 @@ public interface IPublicAPI |
181 | 181 | /// </summary> |
182 | 182 | /// <param name="url">URL to download file</param> |
183 | 183 | /// <param name="filePath">path to save downloaded file</param> |
| 184 | + /// <param name="reportProgress"> |
| 185 | + /// Action to report progress. The input of the action is the progress value which is a double value between 0 and 100. |
| 186 | + /// It will be called if url support range request and the reportProgress is not null. |
| 187 | + /// </param> |
184 | 188 | /// <param name="token">place to store file</param> |
185 | 189 | /// <returns>Task showing the progress</returns> |
186 | | - Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath, CancellationToken token = default); |
| 190 | + Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath, Action<double> reportProgress = null, CancellationToken token = default); |
187 | 191 |
|
188 | 192 | /// <summary> |
189 | 193 | /// Add ActionKeyword for specific plugin |
@@ -316,5 +320,19 @@ public interface IPublicAPI |
316 | 320 | /// <param name="defaultResult">Specifies the default result of the message box.</param> |
317 | 321 | /// <returns>Specifies which message box button is clicked by the user.</returns> |
318 | 322 | public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK); |
| 323 | + |
| 324 | + /// <summary> |
| 325 | + /// Displays a standardised Flow message box. |
| 326 | + /// If there is issue when showing the message box, it will return null. |
| 327 | + /// </summary> |
| 328 | + /// <param name="caption">The caption of the message box.</param> |
| 329 | + /// <param name="reportProgressAsync"> |
| 330 | + /// Time-consuming task function, whose input is the action to report progress. |
| 331 | + /// The input of the action is the progress value which is a double value between 0 and 100. |
| 332 | + /// If there are any exceptions, this action will be null. |
| 333 | + /// </param> |
| 334 | + /// <param name="forceClosed">When user closes the progress box manually by button or esc key, this action will be called.</param> |
| 335 | + /// <returns>A progress box interface.</returns> |
| 336 | + public Task ShowProgressBoxAsync(string caption, Func<Action<double>, Task> reportProgressAsync, Action forceClosed = null); |
319 | 337 | } |
320 | 338 | } |
0 commit comments