HTML and CSS Reference
In-Depth Information
FIGURE 9-13 The About page.
Creating a functional Settings page
The layout of the Settings page—namely the page the user displays to change options and configure
the application to work differently—is the same as read-only pages. However, creating a Settings
page is much more challenging since it requires that you save settings somewhere and use them
throughout the application. This will take you to make some relevant changes to the code used so far.
Defining an application-wide settings object
If your application is expected to support customizable settings, then you should have an object that
defines all possible options. You open todolist.js and add the following code:
var TodoListSettings = WinJS.Class.define(function () {
var localSettings = Windows.Storage.ApplicationData.current.localSettings;
var that = {};
that.defaultPriority = TodoList.Priority.Normal;
that.load = function () {
_loadFromSettings();
};
that.save = function () {
_saveToSettings();
};
function _loadFromSettings() {
var priority = localSettings.values["defaultPriority"];
if (priority) {
that.defaultPriority = priority;
}
};
Search WWH ::




Custom Search