更新整理
This commit is contained in:
92
WPFluent.Gallery/Views/MainWindowEx.xaml.cs
Normal file
92
WPFluent.Gallery/Views/MainWindowEx.xaml.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
|
||||
using System.Threading;
|
||||
|
||||
using System.Windows;
|
||||
|
||||
using WPFluent.Controls;
|
||||
|
||||
using MessageBox = WPFluent.Controls.MessageBox;
|
||||
|
||||
|
||||
namespace WPFluent.Gallery;
|
||||
|
||||
/// <summary>
|
||||
/// MainWindowEx.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindowEx
|
||||
{
|
||||
ContentDialog dialog;
|
||||
ContentDialog newdialog;
|
||||
|
||||
public MainWindowEx()
|
||||
{
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user