Пример #1
0
    private ToastNotification GetNotification(AdaptableItem item)
    {
        ToastContent content = new ToastContent()
        {
            Launch = item.Create(),
            Visual = new ToastVisual()
            {
                BindingGeneric = new ToastBindingGeneric()
                {
                    AppLogoOverride = new ToastGenericAppLogo()
                    {
                        Source = "ms-appx:///Assets/StoreLogo.png"
                    },
                    Children =
                    {
                        new AdaptiveText()
                        {
                            Text      = item.Title,
                            HintStyle = AdaptiveTextStyle.Body
                        },
                        new AdaptiveText()
                        {
                            Text      = item.Body,
                            HintWrap  = true,
                            HintStyle = AdaptiveTextStyle.CaptionSubtle
                        }
                    }
                }
            }
        };

        return(new ToastNotification(content.GetXml()));
    }
Пример #2
0
    public AdaptableItem Show(string title, string body)
    {
        string        id   = random.Next(1, 100000000).ToString();
        AdaptableItem item = new AdaptableItem()
        {
            Id = id, Title = title, Body = body
        };
        ToastNotification notification = GetNotification(item);

        ToastNotificationManager.CreateToastNotifier().Show(notification);
        return(item);
    }