dotnet add package Nlnet.Avalonia.MessageBox --version 1.0.0-beta.4
<ResourceInclude Source="avares://Nlnet.Avalonia.MessageBox/Assets/Themes.axaml" />
// WPF Standard: call messagebox synchronous.
private void OnClick(object? sender, RoutedEventArgs e)
{
var result = MessageBox.Show("Hello, this is Nlnet MessageBox!",
"Welcome", Buttons.OkCancel, Images.Info);
TbxResult.Text = result.ToString();
}
// Avalonia Standard: call messagebox asynchronous.
private async void OnClick(object? sender, RoutedEventArgs e)
{
var result = await MessageBox.ShowAsync("Hello, this is Nlnet MessageBox :)",
"Welcome", Buttons.OkCancel, Images.Info);
TbxResult.Text = result.ToString();
}
<ResourceInclude
Source="avares://Nlnet.Avalonia.MessageBox/Assets/Themes.Acss.axaml" />
我们提供了独立的 MessageBox 示例代码,请在 Github 上访问它。