public static XmlDocument CreateTaskToastNotification(ITask task)
        {
            string content = string.Empty;

            try
            {
                XmlDocument xmlDocument = new XmlDocument();

                const string templateXml = @"
                    <toast scenario='reminder'>
                        <visual>
                            <binding template='ToastGeneric'>
                                <text>{0}</text>
                                <text>{1}</text>
                                <image placement='AppLogoOverride' src='{2}' />
                            </binding>
                        </visual>
                        <actions>
                            <input id='snoozeTime' type='selection' defaultInput='5'>
                              <selection id='5' content='5 {3}' />
                              <selection id='30' content='30 {3}' />
                              <selection id='60' content='1 {4}' />
                              <selection id='240' content='4 {5}' />
                              <selection id='1440' content='1 {6}' />
                            </input>
                            <action activationType='system' arguments='snooze' hint-inputId='snoozeTime' content=''/>
                            <action content='{7}' arguments='{8}' activationType='background' />
                            <action content='{9}' arguments='{10}' activationType='foreground' />
                        </actions>
                        <audio src='ms-winsoundevent:Notification.Reminder' />
                    </toast>
                    ";

                content = string.Format(
                    templateXml,
                    SafeEscape(task.Title),                         // 0
                    SafeEscape(task.Note ?? string.Empty),          // 1
                    ResourcesLocator.GetAppIconPng(),               // 2
                    StringResources.Notification_SnoozeMinutes,     // 3
                    StringResources.Notification_SnoozeHour,        // 4
                    StringResources.Notification_SnoozeHours,       // 5
                    StringResources.Notification_SnoozeDay,         // 6
                    StringResources.Notification_Done,              // 7
                    LaunchArgumentsHelper.GetArgCompleteTask(task), // 8
                    StringResources.Notification_Edit,              // 9
                    LaunchArgumentsHelper.GetArgEditTask(task)      // 10
                    );

                xmlDocument.LoadXml(content);

                return(xmlDocument);
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, string.Format("Exception CreateTaskToastNotification: {0}", content));
                return(null);
            }
        }
Пример #2
0
 public void GetArgCompleteTask()
 {
     Assert.AreEqual("complete/task-9", LaunchArgumentsHelper.GetArgCompleteTask(this.workbook.Tasks[0]));
 }