public async Task ShowMessage( MessageOptions messageOptions ) { if (!Initialized) { throw new Exception("NaylahUWPDialogService not initialized"); } if (messageOptions == null) { throw new ArgumentException("messageOptions is missing"); } if ((Approach == NDialogServiceApproach.MessageDialog) || (windowsNotificationService.NotificationsIsAvailble) || messageOptions.Modal) { await windowsDialogService.ShowMessage(messageOptions); return; } else { await windowsNotificationService.ShowNotification(messageOptions); } }
public async Task ShowNotification( MessageOptions messageOptions ) { var toastContent = CreateToastContent(); toastContent.Scenario = ToastScenario.Default; toastContent.Visual = new ToastVisual(); toastContent.Visual.TitleText = new ToastText() { Text = messageOptions.Title }; if (!string.IsNullOrEmpty(messageOptions.BodyText1)) { toastContent.Visual.BodyTextLine1 = new ToastText() { Text = messageOptions.BodyText1 }; } if (!string.IsNullOrEmpty(messageOptions.BodyText2)) { toastContent.Visual.BodyTextLine2 = new ToastText() { Text = messageOptions.BodyText2 }; } if (messageOptions.InteractionOptions != null) { toastContent.Actions = new ToastActionsCustom(); foreach (var button in messageOptions.InteractionOptions.Buttons) { ((ToastActionsCustom)toastContent.Actions).Buttons.Add(new ToastButton(button.Content, button.Argument)); } } DateTimeOffset? expiration = null; if (messageOptions.WindowsNotificationOptions != null) { toastContent.Audio = new ToastAudio(); toastContent.Audio.Silent = messageOptions.WindowsNotificationOptions.Silent; if (messageOptions.WindowsNotificationOptions.ExpireAfter > 0) { expiration = DateTimeOffset.Now.Add(TimeSpan.FromSeconds(messageOptions.WindowsNotificationOptions.ExpireAfter)); } } ShowNotificationImmediate(toastContent, expiration, messageOptions?.WindowsNotificationOptions?.Tag, messageOptions.WindowsNotificationOptions?.Group, messageOptions.InteractionOptions?.InteractionEvent); }
internal void ShowDialog(string v) { //var interaction = new InteractionOptions(); //interaction.Buttons.Add(new InteractionOptions.Button("Sim", "s")); //interaction.Buttons.Add(new InteractionOptions.Button("Nao", "n")); //interaction.InteractionEvent += asdas; var messageOptions = new MessageOptions("CultureInfo Infots", CultureInfo.CurrentCulture.DisplayName + Environment.NewLine + CultureInfo.CurrentUICulture.DisplayName, null, false, null, new WindowsNotificationOptions() { ExpireAfter = 10 }); DialogService.ShowMessage(messageOptions); }