Skip to content

Commit 9b75acd

Browse files
committed
Add ShowMsgBox functions in public api
1 parent 7ba8d58 commit 9b75acd

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Runtime.CompilerServices;
88
using System.Threading;
99
using System.Threading.Tasks;
10+
using System.Windows;
1011

1112
namespace Flow.Launcher.Plugin
1213
{
@@ -298,5 +299,81 @@ public interface IPublicAPI
298299
/// </summary>
299300
/// <param name="reselect">Choose the first result after reload if true; keep the last selected result if false. Default is true.</param>
300301
public void ReQuery(bool reselect = true);
302+
303+
/// <summary>
304+
/// Displays a message box that has a message and that returns a result.
305+
/// </summary>
306+
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
307+
/// <returns>
308+
/// A System.Windows.MessageBoxResult value that specifies which message box button
309+
/// is clicked by the user.
310+
/// </returns>
311+
public MessageBoxResult ShowMsgBox(string messageBoxText);
312+
313+
/// <summary>
314+
/// Displays a message box that has a message and title bar caption; and that returns
315+
/// a result.
316+
/// </summary>
317+
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
318+
/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
319+
/// <returns>
320+
/// A System.Windows.MessageBoxResult value that specifies which message box button
321+
/// is clicked by the user.
322+
/// </returns>
323+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption);
324+
325+
/// <summary>
326+
/// Displays a message box that has a message, title bar caption, and button; and
327+
/// that returns a result.
328+
/// </summary>
329+
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
330+
/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
331+
/// <param name="button">
332+
/// A System.Windows.MessageBoxButton value that specifies which button or buttons
333+
/// to display.
334+
/// </param>
335+
/// <returns>
336+
/// A System.Windows.MessageBoxResult value that specifies which message box button
337+
/// is clicked by the user.
338+
/// </returns>
339+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button);
340+
341+
/// <summary>
342+
/// Displays a message box that has a message, title bar caption, button, and icon;
343+
/// and that returns a result.
344+
/// </summary>
345+
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
346+
/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
347+
/// <param name="button">
348+
/// A System.Windows.MessageBoxButton value that specifies which button or buttons
349+
/// to display.
350+
/// </param>
351+
/// <param name="icon">A System.Windows.MessageBoxImage value that specifies the icon to display.</param>
352+
/// <returns>
353+
/// A System.Windows.MessageBoxResult value that specifies which message box button
354+
/// is clicked by the user.
355+
/// </returns>
356+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon);
357+
358+
/// <summary>
359+
/// Displays a message box that has a message, title bar caption, button, and icon;
360+
/// and that accepts a default message box result and returns a result.
361+
/// </summary>
362+
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
363+
/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
364+
/// <param name="button">
365+
/// A System.Windows.MessageBoxButton value that specifies which button or buttons
366+
/// to display.
367+
/// </param>
368+
/// <param name="icon">A System.Windows.MessageBoxImage value that specifies the icon to display.</param>
369+
/// <param name="defaultResult">
370+
/// A System.Windows.MessageBoxResult value that specifies the default result of
371+
/// the message box.
372+
/// </param>
373+
/// <returns>
374+
/// A System.Windows.MessageBoxResult value that specifies which message box button
375+
/// is clicked by the user.
376+
/// </returns>
377+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult);
301378
}
302379
}

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using System.Collections.Concurrent;
2626
using System.Diagnostics;
2727
using System.Collections.Specialized;
28+
using Flow.Launcher.Core;
2829

2930
namespace Flow.Launcher
3031
{
@@ -318,6 +319,19 @@ public bool IsGameModeOn()
318319

319320
public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect);
320321

322+
public MessageBoxResult ShowMsgBox(string messageBoxText) => MessageBoxEx.Show(messageBoxText);
323+
324+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption) => MessageBoxEx.Show(messageBoxText, caption);
325+
326+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button) =>
327+
MessageBoxEx.Show(messageBoxText, caption, button);
328+
329+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon) =>
330+
MessageBoxEx.Show(messageBoxText, caption, button, icon);
331+
332+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult) =>
333+
MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult);
334+
321335
#endregion
322336

323337
#region Private Methods

0 commit comments

Comments
 (0)