Skip to content

Commit b568d2d

Browse files
committed
Combine ShowMsgBox into one function.
1 parent 0d362b3 commit b568d2d

File tree

2 files changed

+9
-84
lines changed

2 files changed

+9
-84
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 8 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -299,81 +299,16 @@ public interface IPublicAPI
299299
/// </summary>
300300
/// <param name="reselect">Choose the first result after reload if true; keep the last selected result if false. Default is true.</param>
301301
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);
312302

313303
/// <summary>
314-
/// Displays a message box that has a message and title bar caption; and that returns
315-
/// a result.
304+
/// Displays a message box like <see cref="System.Windows.MessageBox"/>
316305
/// </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);
306+
/// <param name="messageBoxText">The message of the message box.</param>
307+
/// <param name="caption">The caption of the message box.</param>
308+
/// <param name="button">Specifies which button or buttons to display.</param>
309+
/// <param name="icon">Specifies the icon to display.</param>
310+
/// <param name="defaultResult">Specifies the default result of the message box.</param>
311+
/// <returns>Specifies which message box button is clicked by the user.</returns>
312+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK);
378313
}
379314
}

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,7 @@ public bool IsGameModeOn()
319319

320320
public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect);
321321

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) =>
322+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK) =>
333323
MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult);
334324

335325
#endregion

0 commit comments

Comments
 (0)