Пример #1
0
        private static XmlDocument GeneratePayload(AccountDataItem account, ViewItemSchedule s)
        {
            var c = s.Class;

            var builder = new ToastContentBuilder()
                          .AddToastActivationInfo(new ViewClassArguments()
            {
                LocalAccountId = account.LocalAccountId,
                ItemId         = c.Identifier,
                LaunchSurface  = LaunchSurface.Toast
            }.SerializeToString(), ToastActivationType.Foreground)
                          .SetToastScenario(ToastScenario.Reminder)
                          .AddText(c.Name)
                          .AddText(string.Format(_timeToTime, _timeFormatter.Format(s.StartTime), _timeFormatter.Format(s.EndTime)));

            if (!string.IsNullOrWhiteSpace(s.Room))
            {
                builder.AddText(s.Room);
            }

            builder.AddToastInput(new ToastSelectionBox("snoozeTime")
            {
                DefaultSelectionBoxItemId = "5",
                Items =
                {
                    new ToastSelectionBoxItem("5",  PowerPlannerResources.GetXMinutes(5)),
                    new ToastSelectionBoxItem("10", PowerPlannerResources.GetXMinutes(10)),
                    new ToastSelectionBoxItem("15", PowerPlannerResources.GetXMinutes(15)),
                    new ToastSelectionBoxItem("30", PowerPlannerResources.GetXMinutes(30)),
                    new ToastSelectionBoxItem("45", PowerPlannerResources.GetXMinutes(45))
                }
            });

            builder.AddButton(new ToastButtonSnooze()
            {
                SelectionBoxId = "snoozeTime"
            });

            builder.AddButton(new ToastButtonDismiss());

            return(builder.GetToastContent().GetXml());
        }