Files
Shrlalgo.RvKits/WPFluent.Gallery/MainWindow.xaml.cs

93 lines
2.9 KiB
C#

using System.Threading;
using System.Windows;
using WPFluent.Controls;
using MessageBox = WPFluent.Controls.MessageBox;
namespace WPFluent.Gallery;
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow
{
ContentDialog dialog;
ContentDialog newdialog;
public MainWindow()
{
InitializeComponent();
dialog = new()
{
Title = "My sample dialog",
Content = "Content of the dialog",
CloseButtonText = "Close button",
PrimaryButtonText = "Primary button",
SecondaryButtonText = "Secondary button",
// Setting the dialog container
//DialogHost = ContentDialogHostService.ContentPresenterForDialogs
};
newdialog = new()
{
Title = "My sample dialog",
Content = "Content of the dialog",
CloseButtonText = "Close button",
PrimaryButtonText = "Primary button",
SecondaryButtonText = "Secondary button",
DefaultButton = ContentDialogButton.Primary,
};
Splash.CloseOnLoaded(this, minimumMilliseconds: 1800);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Toast.Information("I am information message");
Toast.Error("I am error message");
//Toast.Success("I am success message");
//Toast.Warning("I am warning message");
//Toast.Show(owner: null, "I am any message", new ToastConfig());
}
private async void ContentDialogClick(object sender, RoutedEventArgs e)
{
await dialog.ShowAsync(CancellationToken.None);
}
private async void MsgAsyncClick(object sender, RoutedEventArgs e)
{
// Async methods
_ = await MessageBox.InformationAsync("This is a information message");
_ = await MessageBox.WarningAsync("This is a warning message");
_ = await MessageBox.ErrorAsync("This is a error message");
var result = await MessageBox.QuestionAsync("This is a question and do you want to click OK?");
}
private void MsgSyncClick(object sender, RoutedEventArgs e)
{
_ = MessageBox.Information("This is a information message");
_ = MessageBox.Warning("This is a warning message");
_ = MessageBox.Error("This is a error message");
var result = MessageBox.Question("This is a question and do you want to click OK?");
}
private async void NewContentDialogClick(object sender, RoutedEventArgs e)
{
_ = await dialog.ShowAsync();
}
private void PendingBoxClick(object sender, RoutedEventArgs e)
{
// Default style.
using IPendingHandler pending = PendingBox.Show();
// Show with title and cancel button.
//using IPendingHandler pending = PendingBox.Show("Doing something", "I'm a title", isShowCancel: true);
}
}