~paparazzi-uav/paparazzi/v5.0-manual

« back to all changes in this revision

Viewing changes to sw/ext/opencv_bebop/opencv/samples/winrt/JavaScript/js/default.js

  • Committer: Paparazzi buildbot
  • Date: 2016-05-18 15:00:29 UTC
  • Revision ID: felix.ruess+docbot@gmail.com-20160518150029-e8lgzi5kvb4p7un9
Manual import commit 4b8bbb730080dac23cf816b98908dacfabe2a8ec from v5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
 
2
//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 
3
//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
 
4
//// PARTICULAR PURPOSE.
 
5
////
 
6
//// Copyright (c) Microsoft Corporation. All rights reserved
 
7
 
 
8
 
 
9
(function () {
 
10
    "use strict";
 
11
 
 
12
    var sampleTitle = "OpenCV Image Manipulations sample";
 
13
 
 
14
    var scenarios = [
 
15
        { url: "/html/AdvancedCapture.html", title: "Enumerate cameras and add a video effect" },
 
16
    ];
 
17
 
 
18
    function activated(eventObject) {
 
19
        if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
 
20
            // Use setPromise to indicate to the system that the splash screen must not be torn down
 
21
            // until after processAll and navigate complete asynchronously.
 
22
            eventObject.setPromise(WinJS.UI.processAll().then(function () {
 
23
                // Navigate to either the first scenario or to the last running scenario
 
24
                // before suspension or termination.
 
25
                var url = WinJS.Application.sessionState.lastUrl || scenarios[0].url;
 
26
                return WinJS.Navigation.navigate(url);
 
27
            }));
 
28
        }
 
29
    }
 
30
 
 
31
    WinJS.Navigation.addEventListener("navigated", function (eventObject) {
 
32
        var url = eventObject.detail.location;
 
33
        var host = document.getElementById("contentHost");
 
34
        // Call unload method on current scenario, if there is one
 
35
        host.winControl && host.winControl.unload && host.winControl.unload();
 
36
        WinJS.Utilities.empty(host);
 
37
        eventObject.detail.setPromise(WinJS.UI.Pages.render(url, host, eventObject.detail.state).then(function () {
 
38
            WinJS.Application.sessionState.lastUrl = url;
 
39
        }));
 
40
    });
 
41
 
 
42
    WinJS.Namespace.define("SdkSample", {
 
43
        sampleTitle: sampleTitle,
 
44
        scenarios: scenarios,
 
45
        mediaCaptureMgr: null,
 
46
        photoFile: "photo.jpg",
 
47
        deviceList: null,
 
48
        recordState: null,
 
49
        captureInitSettings: null,
 
50
        encodingProfile: null,
 
51
        storageFile: null,
 
52
        photoStorage: null,
 
53
        cameraControlSliders: null,
 
54
 
 
55
 
 
56
        displayStatus: function (statusText) {
 
57
            WinJS.log && WinJS.log(statusText, "MediaCapture", "status");
 
58
        },
 
59
 
 
60
        displayError: function (error) {
 
61
            WinJS.log && WinJS.log(error, "MediaCapture", "error");
 
62
        },
 
63
 
 
64
        id: function (elementId) {
 
65
            return document.getElementById(elementId);
 
66
        },
 
67
 
 
68
    });
 
69
 
 
70
    WinJS.Application.addEventListener("activated", activated, false);
 
71
    WinJS.Application.start();
 
72
    Windows.UI.WebUI.WebUIApplication.addEventListener("suspending", SdkSample.suspendingHandler, false);
 
73
    Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", SdkSample.resumingHandler, false);
 
74
})();