Add message box handler to LibationUiBase
This commit is contained in:
parent
38cc3e9725
commit
0e49df06b8
@ -16,6 +16,8 @@ using Dinah.Core;
|
||||
using LibationAvalonia.Themes;
|
||||
using Avalonia.Data.Core.Plugins;
|
||||
using System.Linq;
|
||||
using LibationUiBase.Forms;
|
||||
using Avalonia.Controls;
|
||||
|
||||
#nullable enable
|
||||
namespace LibationAvalonia
|
||||
@ -42,6 +44,9 @@ namespace LibationAvalonia
|
||||
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
MessageBoxBase.ShowAsyncImpl = (owner, message, caption, buttons, icon, defaultButton, saveAndRestorePosition) =>
|
||||
MessageBox.Show(owner as Window, message, caption, buttons, icon, defaultButton, saveAndRestorePosition);
|
||||
|
||||
// Avoid duplicate validations from both Avalonia and the CommunityToolkit.
|
||||
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
|
||||
DisableAvaloniaDataAnnotationValidation();
|
||||
|
||||
@ -4,6 +4,7 @@ using Avalonia.Markup.Xaml.MarkupExtensions;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.VisualTree;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#nullable enable
|
||||
|
||||
@ -4,6 +4,7 @@ using LibationAvalonia.Dialogs;
|
||||
using LibationAvalonia.ViewModels.Settings;
|
||||
using LibationFileManager;
|
||||
using LibationFileManager.Templates;
|
||||
using LibationUiBase.Forms;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ using LibationAvalonia.Dialogs;
|
||||
using LibationAvalonia.ViewModels.Settings;
|
||||
using LibationFileManager;
|
||||
using LibationFileManager.Templates;
|
||||
using LibationUiBase.Forms;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationAvalonia.Controls.Settings
|
||||
|
||||
@ -3,6 +3,7 @@ using LibationAvalonia.Controls;
|
||||
using LibationAvalonia.ViewModels;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase;
|
||||
using LibationUiBase.Forms;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -3,6 +3,7 @@ using AudibleUtilities;
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using LibationUiBase.Forms;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -7,6 +7,7 @@ using Avalonia.Platform.Storage;
|
||||
using Avalonia.Threading;
|
||||
using DataLayer;
|
||||
using FileLiberator;
|
||||
using LibationUiBase.Forms;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -3,6 +3,7 @@ using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Styling;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ using Avalonia.Styling;
|
||||
using Dinah.Core;
|
||||
using LibationFileManager;
|
||||
using LibationFileManager.Templates;
|
||||
using LibationUiBase.Forms;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform.Storage;
|
||||
using LibationUiBase.Forms;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LibationAvalonia.Dialogs
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using AudibleApi;
|
||||
using AudibleUtilities;
|
||||
using LibationUiBase.Forms;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationAvalonia.Dialogs.Login
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using AudibleApi;
|
||||
using AudibleUtilities;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
using LibationUiBase.Forms;
|
||||
using ReactiveUI;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
using Dinah.Core;
|
||||
using LibationUiBase.Forms;
|
||||
using System;
|
||||
|
||||
namespace LibationAvalonia.Dialogs.Login
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using Avalonia.Controls;
|
||||
using Dinah.Core;
|
||||
using FileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using System;
|
||||
|
||||
namespace LibationAvalonia.Dialogs
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using LibationAvalonia.ViewModels.Dialogs;
|
||||
using LibationUiBase.Forms;
|
||||
|
||||
namespace LibationAvalonia.Dialogs
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using AudibleUtilities;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using LibationUiBase.Forms;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using Avalonia.Controls;
|
||||
using LibationAvalonia.ViewModels.Settings;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationAvalonia.Dialogs
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
|
||||
namespace LibationAvalonia.Dialogs
|
||||
{
|
||||
|
||||
@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Avalonia.Platform.Storage;
|
||||
using LibationUiBase.Forms;
|
||||
|
||||
#nullable enable
|
||||
namespace LibationAvalonia.Dialogs;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using AppScaffolding;
|
||||
using Avalonia.Controls;
|
||||
using Dinah.Core;
|
||||
using LibationUiBase.Forms;
|
||||
|
||||
namespace LibationAvalonia.Dialogs
|
||||
{
|
||||
|
||||
@ -6,6 +6,7 @@ using DataLayer;
|
||||
using Dinah.Core.Logging;
|
||||
using LibationAvalonia.Dialogs;
|
||||
using LibationAvalonia.ViewModels.Dialogs;
|
||||
using LibationUiBase.Forms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -13,54 +14,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LibationAvalonia
|
||||
{
|
||||
public enum DialogResult
|
||||
{
|
||||
None = 0,
|
||||
OK = 1,
|
||||
Cancel = 2,
|
||||
Abort = 3,
|
||||
Retry = 4,
|
||||
Ignore = 5,
|
||||
Yes = 6,
|
||||
No = 7,
|
||||
TryAgain = 10,
|
||||
Continue = 11
|
||||
}
|
||||
|
||||
public enum MessageBoxIcon
|
||||
{
|
||||
None = 0,
|
||||
Error = 16,
|
||||
Hand = 16,
|
||||
Stop = 16,
|
||||
Question = 32,
|
||||
Exclamation = 48,
|
||||
Warning = 48,
|
||||
Asterisk = 64,
|
||||
Information = 64
|
||||
}
|
||||
|
||||
public enum MessageBoxButtons
|
||||
{
|
||||
OK,
|
||||
OKCancel,
|
||||
AbortRetryIgnore,
|
||||
YesNoCancel,
|
||||
YesNo,
|
||||
RetryCancel,
|
||||
CancelTryContinue
|
||||
}
|
||||
|
||||
public enum MessageBoxDefaultButton
|
||||
{
|
||||
Button1,
|
||||
Button2 = 256,
|
||||
Button3 = 512,
|
||||
}
|
||||
|
||||
public class MessageBox
|
||||
{
|
||||
|
||||
public static Task<DialogResult> Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
|
||||
=> ShowCoreAsync(null, text, caption, buttons, icon, defaultButton);
|
||||
public static Task<DialogResult> Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, bool saveAndRestorePosition = true)
|
||||
@ -71,8 +27,8 @@ namespace LibationAvalonia
|
||||
=> ShowCoreAsync(null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
public static Task<DialogResult> Show(string text)
|
||||
=> ShowCoreAsync(null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
public static Task<DialogResult> Show(Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
|
||||
=> ShowCoreAsync(owner, text, caption, buttons, icon, defaultButton);
|
||||
public static Task<DialogResult> Show(Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool saveAndRestorePosition = true)
|
||||
=> ShowCoreAsync(owner, text, caption, buttons, icon, defaultButton, saveAndRestorePosition);
|
||||
|
||||
public static Task<DialogResult> Show(Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
=> ShowCoreAsync(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using LibationUiBase.Forms;
|
||||
using System;
|
||||
|
||||
namespace LibationAvalonia.ViewModels.Dialogs
|
||||
{
|
||||
|
||||
@ -4,6 +4,7 @@ using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Input;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
@ -7,6 +7,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Input;
|
||||
using LibationUiBase.Forms;
|
||||
|
||||
#nullable enable
|
||||
namespace LibationAvalonia.ViewModels
|
||||
|
||||
@ -4,6 +4,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using DataLayer;
|
||||
using LibationUiBase.Forms;
|
||||
|
||||
#nullable enable
|
||||
namespace LibationAvalonia.ViewModels
|
||||
|
||||
@ -5,6 +5,7 @@ using DataLayer;
|
||||
using Avalonia.Threading;
|
||||
using LibationAvalonia.Dialogs;
|
||||
using ReactiveUI;
|
||||
using LibationUiBase.Forms;
|
||||
|
||||
#nullable enable
|
||||
namespace LibationAvalonia.ViewModels
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
using ApplicationServices;
|
||||
using AudibleApi;
|
||||
using AudibleApi.Common;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Threading;
|
||||
using DataLayer;
|
||||
@ -10,6 +9,7 @@ using Dinah.Core.ErrorHandling;
|
||||
using FileLiberator;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase;
|
||||
using LibationUiBase.Forms;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -5,6 +5,7 @@ using Avalonia.Threading;
|
||||
using DataLayer;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase;
|
||||
using LibationUiBase.Forms;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -5,8 +5,8 @@ using Avalonia.Controls;
|
||||
using Avalonia.Threading;
|
||||
using DataLayer;
|
||||
using Dinah.Core.Collections.Generic;
|
||||
using LibationAvalonia.Dialogs.Login;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using LibationUiBase.GridView;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
|
||||
@ -7,6 +7,7 @@ using FileManager;
|
||||
using LibationAvalonia.Dialogs;
|
||||
using LibationAvalonia.ViewModels;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using LibationUiBase.GridView;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
|
||||
@ -2,7 +2,6 @@ using ApplicationServices;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input.Platform;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Styling;
|
||||
using DataLayer;
|
||||
@ -13,6 +12,7 @@ using LibationAvalonia.Dialogs;
|
||||
using LibationAvalonia.ViewModels;
|
||||
using LibationFileManager;
|
||||
using LibationFileManager.Templates;
|
||||
using LibationUiBase.Forms;
|
||||
using LibationUiBase.GridView;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
|
||||
@ -9,6 +9,7 @@ using Dinah.Core.StepRunner;
|
||||
using LibationAvalonia.Dialogs;
|
||||
using LibationAvalonia.Views;
|
||||
using LibationFileManager;
|
||||
using LibationUiBase.Forms;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
133
Source/LibationUiBase/MessageBoxBase.cs
Normal file
133
Source/LibationUiBase/MessageBoxBase.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using MathNet.Numerics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#nullable enable
|
||||
namespace LibationUiBase.Forms;
|
||||
|
||||
public enum DialogResult
|
||||
{
|
||||
/// <summary> Nothing is returned from the dialog box. This means that the modal dialog continues running. </summary>
|
||||
None = 0,
|
||||
/// <summary> The dialog box return value is OK (usually sent from a button labeled OK). </summary>
|
||||
OK = 1, //IDOK
|
||||
/// <summary> The dialog box return value is Cancel (usually sent from a button labeled Cancel). </summary>
|
||||
Cancel = 2, //IDCANCEL
|
||||
/// <summary> The dialog box return value is Abort (usually sent from a button labeled Abort). </summary>
|
||||
Abort = 3, //IDABORT
|
||||
/// <summary> The dialog box return value is Retry (usually sent from a button labeled Retry). </summary>
|
||||
Retry = 4, //IDRETRY
|
||||
/// <summary> The dialog box return value is Ignore (usually sent from a button labeled Ignore). </summary>
|
||||
Ignore = 5, //IDIGNORE
|
||||
/// <summary> The dialog box return value is Yes (usually sent from a button labeled Yes). </summary>
|
||||
Yes = 6, //IDYES
|
||||
/// <summary> The dialog box return value is No (usually sent from a button labeled No). </summary>
|
||||
No = 7, //IDNO
|
||||
/// <summary> The dialog box return value is Try Again (usually sent from a button labeled Try Again). </summary>
|
||||
TryAgain = 10, //IDTRYAGAIN
|
||||
/// <summary> The dialog box return value is Continue (usually sent from a button labeled Continue). </summary>
|
||||
Continue = 11 //IDCONTINUE
|
||||
}
|
||||
|
||||
public enum MessageBoxIcon
|
||||
{
|
||||
/// <summary> Specifies that the message box contain no symbols. </summary>
|
||||
None = 0x00000000,
|
||||
/// <summary> Specifies that the message box contains a hand symbol. </summary>
|
||||
Hand = 0x00000010, //MB_ICONHAND
|
||||
/// <summary> Specifies that the message box contains a question mark symbol. </summary>
|
||||
Question = 0x00000020, //MB_ICONQUESTION
|
||||
/// <summary> Specifies that the message box contains an exclamation symbol. </summary>
|
||||
Exclamation = 0x00000030, //MB_ICONEXCLAMATION
|
||||
/// <summary> Specifies that the message box contains an asterisk symbol. </summary>
|
||||
Asterisk = 0x00000040, //MB_ICONASTERISK
|
||||
/// <summary> Specifies that the message box contains a hand icon. This field is constant. </summary>
|
||||
Stop = Hand,
|
||||
/// <summary> Specifies that the message box contains a hand icon. </summary>
|
||||
Error = Hand,
|
||||
/// <summary> Specifies that the message box contains an exclamation icon. </summary>
|
||||
Warning = Exclamation,
|
||||
/// <summary> Specifies that the message box contains an asterisk icon. </summary>
|
||||
Information = Asterisk
|
||||
}
|
||||
|
||||
public enum MessageBoxButtons
|
||||
{
|
||||
/// <summary> Specifies that the message box contains an OK button. </summary>
|
||||
OK = 0x00000000, //MB_OK
|
||||
/// <summary> Specifies that the message box contains OK and Cancel buttons. </summary>
|
||||
OKCancel = 0x00000001, //MB_OKCANCEL
|
||||
/// <summary> Specifies that the message box contains Abort, Retry, and Ignore buttons. </summary>
|
||||
AbortRetryIgnore = 0x00000002, //MB_ABORTRETRYIGNORE
|
||||
/// <summary> Specifies that the message box contains Yes, No, and Cancel buttons. </summary>
|
||||
YesNoCancel = 0x00000003, //MB_YESNOCANCEL
|
||||
/// <summary> Specifies that the message box contains Yes and No buttons. </summary>
|
||||
YesNo = 0x00000004, //MB_YESNO
|
||||
/// <summary> Specifies that the message box contains Retry and Cancel buttons. </summary>
|
||||
RetryCancel = 0x00000005, //MB_RETRYCANCEL
|
||||
/// <summary> Specifies that the message box contains Cancel, Try Again, and Continue buttons. </summary>
|
||||
CancelTryContinue = 0x00000006 //MB_CANCELTRYCONTINUE
|
||||
}
|
||||
|
||||
public enum MessageBoxDefaultButton
|
||||
{
|
||||
/// <summary> Specifies that the first button on the message box should be the default button. </summary>
|
||||
Button1 = 0x00000000, //MB_DEFBUTTON1
|
||||
/// <summary> Specifies that the second button on the message box should be the default button. </summary>
|
||||
Button2 = 0x00000100, //MB_DEFBUTTON2
|
||||
/// <summary> Specifies that the third button on the message box should be the default button. </summary>
|
||||
Button3 = 0x00000200, //MB_DEFBUTTON3
|
||||
/// <summary> Specifies that the Help button on the message box should be the default button. </summary>
|
||||
Button4 = 0x00000300, //MB_DEFBUTTON4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, and default button.
|
||||
/// </summary>
|
||||
/// <param name="owner">An implementation of a GUI window that will own the modal dialog box</param>
|
||||
/// <param name="message">The text to display in the message box</param>
|
||||
/// <param name="caption">The text to display in the title bar of the message box</param>
|
||||
/// <param name="buttons">One of the <see cref="MessageBoxButtons"/> values that specifies which buttons to disply in the message box</param>
|
||||
/// <param name="icon">One of the <see cref="MessageBoxIcon"/> values that specifies which icon to disply in the message box</param>
|
||||
/// <param name="defaultButton">One of the <see cref="MessageBoxDefaultButton"/> values that specifies the default button of the message box</param>
|
||||
/// <param name="saveAndRestorePosition">A value indicating whether the message box's position should be saved and restored the next time it is shown</param>
|
||||
/// <returns>One of the <see cref="DialogResult"/> values</returns>
|
||||
public delegate Task<DialogResult> ShowAsyncDelegate(object? owner, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool saveAndRestorePosition = true);
|
||||
|
||||
public static class MessageBoxBase
|
||||
{
|
||||
private static ShowAsyncDelegate? s_ShowAsyncImpl;
|
||||
public static ShowAsyncDelegate ShowAsyncImpl
|
||||
{
|
||||
get => s_ShowAsyncImpl ?? DefaultShowAsyncImpl;
|
||||
set => s_ShowAsyncImpl = value;
|
||||
}
|
||||
|
||||
private static Task<DialogResult> DefaultShowAsyncImpl(object? owner, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool saveAndRestorePosition = true)
|
||||
{
|
||||
// default to a no-op impl
|
||||
Serilog.Log.Logger.Error("MessageBoxBase implementation not set. {@DebugInfo}", new { owner, message, caption, buttons, icon, defaultButton });
|
||||
return Task.FromResult(DialogResult.None);
|
||||
}
|
||||
|
||||
public static Task<DialogResult> Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool saveAndRestorePosition = true)
|
||||
=> ShowAsyncImpl(null, text, caption, buttons, icon, defaultButton);
|
||||
public static Task<DialogResult> Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, bool saveAndRestorePosition = true)
|
||||
=> ShowAsyncImpl(null, text, caption, buttons, icon, MessageBoxDefaultButton.Button1, saveAndRestorePosition);
|
||||
public static Task<DialogResult> Show(string text, string caption, MessageBoxButtons buttons)
|
||||
=> ShowAsyncImpl(null, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
public static Task<DialogResult> Show(string text, string caption)
|
||||
=> ShowAsyncImpl(null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
public static Task<DialogResult> Show(string text)
|
||||
=> ShowAsyncImpl(null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
public static Task<DialogResult> Show(object? owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
|
||||
=> ShowAsyncImpl(owner, text, caption, buttons, icon, defaultButton);
|
||||
public static Task<DialogResult> Show(object? owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
=> ShowAsyncImpl(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
|
||||
public static Task<DialogResult> Show(object? owner, string text, string caption, MessageBoxButtons buttons)
|
||||
=> ShowAsyncImpl(owner, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
public static Task<DialogResult> Show(object? owner, string text, string caption)
|
||||
=> ShowAsyncImpl(owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
public static Task<DialogResult> Show(object? owner, string text)
|
||||
=> ShowAsyncImpl(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
@ -22,6 +22,10 @@ namespace LibationWinForms
|
||||
static void Main()
|
||||
{
|
||||
Task<List<LibraryBook>> libraryLoadTask;
|
||||
|
||||
LibationUiBase.Forms.MessageBoxBase.ShowAsyncImpl = (owner, message, caption, buttons, icon, defaultButton, saveAndRestorePosition) =>
|
||||
Task.FromResult((LibationUiBase.Forms.DialogResult)MessageBox.Show(owner as IWin32Window, message, caption, (MessageBoxButtons)buttons, (MessageBoxIcon)icon, (MessageBoxDefaultButton)defaultButton));
|
||||
|
||||
try
|
||||
{
|
||||
//// Uncomment to see Console. Must be called before anything writes to Console.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user