Ejemplo n.º 1
0
        public static void ShowDesktopNotification(this string notificationText, params ToastButton[] buttons)
        {
            var toastContent = new ToastContent
            {
                Visual = new ToastVisual
                {
                    BindingGeneric = new ToastBindingGeneric
                    {
                        Children =
                        {
                            new AdaptiveText
                            {
                                Text = notificationText
                            }
                        }
                    }
                }
            };

            if (buttons != null && buttons.Length > 0)
            {
                var toastActions = new ToastActionsCustom();

                foreach (var toastButton in buttons)
                {
                    toastActions.Buttons.Add(toastButton);
                }

                toastContent.Actions = toastActions;
            }

            toastContent.Show();
        }