HTML and CSS Reference
In-Depth Information
msg.commands.append
(new Windows.UI.Popups.UICommand("Yes, proceed!", TodoList.deleteTask));
msg.commands.append
(new Windows.UI.Popups.UICommand("No, I'm not sure...", function() {}));
msg.defaultCommandIndex = 1;
msg.showAsync();
}
The defaultCommandIndex property sets the 0-based index of the button to be selected by
default. In this case, the No button is selected, as seen in Figure 10-14.
FIGURE 10-14 Deleting a task.
Here's the code that actually deletes the file:
TodoList.deleteTask = function () {
// Get the task
var task = TodoList.getTaskFromUI();
// Locates the file and deletes it
var name = task.description;
var localFolder = Windows.Storage.ApplicationData.current.roamingFolder;
localFolder.getFileAsync(name)
.then(function (file) {
file.deleteAsync().then(function () {
TodoList.cancelTaskClick();
TodoList.populateTaskList();
Search WWH ::




Custom Search