HTML and CSS Reference
In-Depth Information
//Tiles.sendTileUpdate();
//Tiles.sendBadgeUpdate();
Location.startTracking();
});
}
function performResume(e) {
Location.startTracking();
}
function performSuspend(e) {
var promise = Location.stopTracking();
if (promise) {
var deferral = e.suspendingOperation.getDeferral();
promise.then(function () {
deferral.complete();
});
}
}
})();
Windows provides information about why your application has been sent the
activated
event through the
kind
property of the
Event
object passed to your handler function. The range
of possible values is enumerated by
Windows.ApplicationModel.Activation.ActivationKind
.
There are different kinds of activation for different contracts for printing, for opening a file, for
working with a device camera, and, of course, for handling search requests. By checking the
value of the
kind
property, I can discover whether the
activated
event has been sent for a
search request:
…
if (e.kind == actNS.ActivationKind.search) {
Search.searchAndSelect(e.queryText);
}
…
The search term that the user has provided is available through the event's
queryText
prop-
erty. If my
activated
event has been sent for a search request, then I call the
searchAndSelect
function, passing in the
queryText
value. This has the effect of locating and selecting the first
matching item in the grocery list.
Ensuring Application Setup
My technique for servicing search requests relies on the
performInitialSetup
function having
been called before I call
searchAndSelect
, because I rely on the view model and its associated
bindings to translate a change in the
selectedItemIndex
property into changes in the display.
The problem is that the search-related
activated
event can have two meanings. If my app
is already running, the search
activated
event means just “perform this search.” But, if my app
isn't running, then the event means “start the app
and
perform this search.” Working out which
meaning I am dealing with is important. You get only one
activated
event, even if your app
isn't running when the user initiated the search.
Search WWH ::

Custom Search