Path: blob/master/samples/winrt/JavaScript/js/default.js
16339 views
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF1//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO2//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A3//// PARTICULAR PURPOSE.4////5//// Copyright (c) Microsoft Corporation. All rights reserved678(function () {9"use strict";1011var sampleTitle = "OpenCV Image Manipulations sample";1213var scenarios = [14{ url: "/html/AdvancedCapture.html", title: "Enumerate cameras and add a video effect" },15];1617function activated(eventObject) {18if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {19// Use setPromise to indicate to the system that the splash screen must not be torn down20// until after processAll and navigate complete asynchronously.21eventObject.setPromise(WinJS.UI.processAll().then(function () {22// Navigate to either the first scenario or to the last running scenario23// before suspension or termination.24var url = WinJS.Application.sessionState.lastUrl || scenarios[0].url;25return WinJS.Navigation.navigate(url);26}));27}28}2930WinJS.Navigation.addEventListener("navigated", function (eventObject) {31var url = eventObject.detail.location;32var host = document.getElementById("contentHost");33// Call unload method on current scenario, if there is one34host.winControl && host.winControl.unload && host.winControl.unload();35WinJS.Utilities.empty(host);36eventObject.detail.setPromise(WinJS.UI.Pages.render(url, host, eventObject.detail.state).then(function () {37WinJS.Application.sessionState.lastUrl = url;38}));39});4041WinJS.Namespace.define("SdkSample", {42sampleTitle: sampleTitle,43scenarios: scenarios,44mediaCaptureMgr: null,45photoFile: "photo.jpg",46deviceList: null,47recordState: null,48captureInitSettings: null,49encodingProfile: null,50storageFile: null,51photoStorage: null,52cameraControlSliders: null,535455displayStatus: function (statusText) {56WinJS.log && WinJS.log(statusText, "MediaCapture", "status");57},5859displayError: function (error) {60WinJS.log && WinJS.log(error, "MediaCapture", "error");61},6263id: function (elementId) {64return document.getElementById(elementId);65},6667});6869WinJS.Application.addEventListener("activated", activated, false);70WinJS.Application.start();71Windows.UI.WebUI.WebUIApplication.addEventListener("suspending", SdkSample.suspendingHandler, false);72Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", SdkSample.resumingHandler, false);73})();747576