using WPFluent.Controls; using System.Windows.Controls; namespace WPFluent.Extensions; public static class ContentDialogServiceExtensions { /// /// Shows the simple alert-like dialog. /// /// Result of the life cycle of the . public static Task ShowAlertAsync( this IContentDialogService dialogService, string title, string message, string closeButtonText, CancellationToken cancellationToken = default) { var dialog = new ContentDialog(); dialog.SetCurrentValue(ContentDialog.TitleProperty, title); dialog.SetCurrentValue(ContentControl.ContentProperty, message); dialog.SetCurrentValue(ContentDialog.CloseButtonTextProperty, closeButtonText); return dialogService.ShowAsync(dialog, cancellationToken); } /// /// Shows simple dialog /// /// The . /// Set of parameters of the basic dialog box. /// The cancellation token. /// Result of the life cycle of the . public static Task ShowSimpleDialogAsync( this IContentDialogService dialogService, SimpleContentDialogCreateOptions options, CancellationToken cancellationToken = default) { var dialog = new ContentDialog() { Title = options.Title, Content = options.Content, CloseButtonText = options.CloseButtonText, PrimaryButtonText = options.PrimaryButtonText, SecondaryButtonText = options.SecondaryButtonText, VerticalContentAlignment = VerticalAlignment.Center, HorizontalContentAlignment = HorizontalAlignment.Center }; return dialogService.ShowAsync(dialog, cancellationToken); } }