Esempio n. 1
0
 private static AdaptiveText GenerateTileTextForUpcomingItem(ViewItemTaskOrEvent item)
 {
     return(new AdaptiveText()
     {
         Text = TrimString(UWPNotificationsHelper.StripInvalidCharacters(item.Name), 200),
         HintStyle = AdaptiveTextStyle.CaptionSubtle
     });
 }
Esempio n. 2
0
        private static XmlDocument GenerateToastReminder(string title, string item1, string item2, string launch, string markCompleteArgs = null)
        {
            ToastBindingGeneric binding = new ToastBindingGeneric()
            {
                Children =
                {
                    new AdaptiveText()
                    {
                        Text = UWPNotificationsHelper.StripInvalidCharacters(title)
                    }
                }
            };

            if (item1 != null)
            {
                binding.Children.Add(new AdaptiveText()
                {
                    Text = UWPNotificationsHelper.StripInvalidCharacters(item1)
                });
            }

            if (item2 != null)
            {
                binding.Children.Add(new AdaptiveText()
                {
                    Text = UWPNotificationsHelper.StripInvalidCharacters(item2)
                });
            }

            ToastContent content = new ToastContent()
            {
                Launch   = launch,
                Scenario = ToastScenario.Reminder,
                Visual   = new ToastVisual()
                {
                    BindingGeneric = binding
                },

                Actions = new ToastActionsCustom()
                {
                    Inputs =
                    {
                        new ToastSelectionBox("1")
                        {
                            Items =
                            {
                                new ToastSelectionBoxItem("5",    PowerPlannerResources.GetXMinutes(5)),
                                new ToastSelectionBoxItem("15",   PowerPlannerResources.GetXMinutes(5)),
                                new ToastSelectionBoxItem("60",   PowerPlannerResources.GetXHours(1)),
                                new ToastSelectionBoxItem("240",  PowerPlannerResources.GetXHours(4)),
                                new ToastSelectionBoxItem("1440", PowerPlannerResources.GetString("String_OneDay"))
                            },

                            DefaultSelectionBoxItemId = "15"
                        }
                    },

                    Buttons =
                    {
                        new ToastButtonSnooze()
                        {
                            SelectionBoxId = "1"
                        },

                        new ToastButtonDismiss()
                    }
                }
            };

            if (markCompleteArgs != null)
            {
                (content.Actions as ToastActionsCustom).Buttons.Insert(0, new ToastButton(PowerPlannerResources.GetString("String_Complete"), markCompleteArgs)
                {
                    ActivationType = ToastActivationType.Background
                });
            }

            return(content.GetXml());
        }
        private static XmlDocument GenerateToastReminder(string title, string item1, string item2, string launch)
        {
            ToastBindingGeneric binding = new ToastBindingGeneric()
            {
                Children =
                {
                    new AdaptiveText()
                    {
                        Text = UWPNotificationsHelper.StripInvalidCharacters(title)
                    }
                }
            };

            if (item1 != null)
            {
                binding.Children.Add(new AdaptiveText()
                {
                    Text = UWPNotificationsHelper.StripInvalidCharacters(item1)
                });
            }

            if (item2 != null)
            {
                binding.Children.Add(new AdaptiveText()
                {
                    Text = UWPNotificationsHelper.StripInvalidCharacters(item2)
                });
            }

            ToastContent content = new ToastContent()
            {
                Launch   = launch,
                Scenario = ToastScenario.Reminder,
                Visual   = new ToastVisual()
                {
                    BindingGeneric = binding
                },

                Actions = new ToastActionsCustom()
                {
                    Inputs =
                    {
                        new ToastSelectionBox("1")
                        {
                            Items =
                            {
                                new ToastSelectionBoxItem("5",    "5 minutes"),
                                new ToastSelectionBoxItem("15",   "15 minutes"),
                                new ToastSelectionBoxItem("60",   "1 hour"),
                                new ToastSelectionBoxItem("240",  "4 hours"),
                                new ToastSelectionBoxItem("1440", "1 day")
                            },

                            DefaultSelectionBoxItemId = "5"
                        }
                    },

                    Buttons =
                    {
                        new ToastButtonSnooze()
                        {
                            SelectionBoxId = "1"
                        },

                        new ToastButtonDismiss()
                    }
                }
            };

            //XmlDocument doc = new XmlDocument();
            //doc.LoadXml(content.GetContent());

            //return doc;
            return(content.GetXml());
        }