Esempio n. 1
0
        public static ToastContent CreatePostToastContent(string imageUrl, string caption, string subCaption, Status status)
        {
            status.MediaAttachments = new List <Attachment>();
            var notification = new ToastNotificationArgs()
            {
                Type   = ToastType.Status,
                Status = status
            };

            return(new ToastContent()
            {
                Launch = JsonConvert.SerializeObject(notification),
                Visual = new ToastVisual()
                {
                    BindingGeneric = new ToastBindingGeneric()
                    {
                        Children =
                        {
                            new AdaptiveText()
                            {
                                Text = caption
                            },
                            new AdaptiveText()
                            {
                                Text = subCaption
                            }
                        },
                        AppLogoOverride = new ToastGenericAppLogo()
                        {
                            Source = imageUrl,
                            HintCrop = ToastGenericAppLogoCrop.Circle
                        }
                    }
                },
                Actions = new ToastActionsCustom()
                {
                    Buttons =
                    {
                        new ToastButton("Open Status", JsonConvert.SerializeObject(notification))
                        {
                            ActivationType = ToastActivationType.Foreground
                        },
                        new ToastButton("Sleep", JsonConvert.SerializeObject(new ToastNotificationArgs()
                        {
                            Type = ToastType.Sleep
                        }))
                        {
                            ActivationType = ToastActivationType.Background
                        }
                    }
                },
                Audio = new ToastAudio()
                {
                    Src = new Uri("ms-winsoundevent:Notification.Default")
                }
            });
        }
Esempio n. 2
0
        public static ToastContent CreateFollowToastContent(string imageUrl, string caption, Account account)
        {
            var notification = new ToastNotificationArgs()
            {
                Type    = ToastType.Account,
                Account = account
            };

            return(new ToastContent()
            {
                Launch = JsonConvert.SerializeObject(notification),
                Visual = new ToastVisual()
                {
                    BindingGeneric = new ToastBindingGeneric()
                    {
                        Children =
                        {
                            new AdaptiveText()
                            {
                                Text = caption
                            }
                        },
                        AppLogoOverride = new ToastGenericAppLogo()
                        {
                            Source = imageUrl,
                            HintCrop = ToastGenericAppLogoCrop.Circle
                        }
                    }
                },
                Actions = new ToastActionsCustom()
                {
                    Buttons =
                    {
                        new ToastButton("Open Account", JsonConvert.SerializeObject(notification))
                        {
                            ActivationType = ToastActivationType.Foreground
                        },
                        new ToastButton("Sleep", JsonConvert.SerializeObject(new ToastNotificationArgs()
                        {
                            Type = ToastType.Sleep
                        }))
                        {
                            ActivationType = ToastActivationType.Background
                        }
                    }
                },
                Audio = new ToastAudio()
                {
                    Src = new Uri("ms-winsoundevent:Notification.Default")
                }
            });
        }