HTML and CSS Reference
In-Depth Information
Note that this is only a recommended practice; you can name the dictionary entry in any arbitrary
way. To save values permanently, you use code as below:
localSettings.values["defaultPriority"] = someValue;
To complete the initialization of the application, you need to place a call that actually loads
settings upon application startup.
In todolist.js , you also add the previous line of code at the end of the TodoList.init method. Now
that settings have been integrated in the application, you need to use them where it makes the most
sense. This drives some further changes in todolist.js .
In particular, you edit the Task object so that it defaults the priority property to the value read-out
of the settings:
var Task = WinJS.Class.define(function () {
var that = {};
that.description = "This is my new task";
that.dueDate = TodoList.firstOfNextMonth();
that.priority = TodoList.Priority.Normal;
if (TodoList.settings.defaultPriority != "undefined")
that.priority = TodoList.settings.defaultPriority;
return that;
Another change regards the TodoList.performInitialBinding method. At this point, you might want
it to initialize the user interface based on the Task object it receives; not on the Task object it creates
TodoList.performInitialBinding = function (task) {
// var task = new Task(); // This line must be removed
// Rest of the code here
Finally, you introduce a new function like this:
TodoList.displayTask = function (task) {
Search WWH ::

Custom Search