default.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. (function () {
  8. "use strict";
  9. var sampleTitle = "OpenCV Image Manipulations sample";
  10. var scenarios = [
  11. { url: "/html/AdvancedCapture.html", title: "Enumerate cameras and add a video effect" },
  12. ];
  13. function activated(eventObject) {
  14. if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
  15. // Use setPromise to indicate to the system that the splash screen must not be torn down
  16. // until after processAll and navigate complete asynchronously.
  17. eventObject.setPromise(WinJS.UI.processAll().then(function () {
  18. // Navigate to either the first scenario or to the last running scenario
  19. // before suspension or termination.
  20. var url = WinJS.Application.sessionState.lastUrl || scenarios[0].url;
  21. return WinJS.Navigation.navigate(url);
  22. }));
  23. }
  24. }
  25. WinJS.Navigation.addEventListener("navigated", function (eventObject) {
  26. var url = eventObject.detail.location;
  27. var host = document.getElementById("contentHost");
  28. // Call unload method on current scenario, if there is one
  29. host.winControl && host.winControl.unload && host.winControl.unload();
  30. WinJS.Utilities.empty(host);
  31. eventObject.detail.setPromise(WinJS.UI.Pages.render(url, host, eventObject.detail.state).then(function () {
  32. WinJS.Application.sessionState.lastUrl = url;
  33. }));
  34. });
  35. WinJS.Namespace.define("SdkSample", {
  36. sampleTitle: sampleTitle,
  37. scenarios: scenarios,
  38. mediaCaptureMgr: null,
  39. photoFile: "photo.jpg",
  40. deviceList: null,
  41. recordState: null,
  42. captureInitSettings: null,
  43. encodingProfile: null,
  44. storageFile: null,
  45. photoStorage: null,
  46. cameraControlSliders: null,
  47. displayStatus: function (statusText) {
  48. WinJS.log && WinJS.log(statusText, "MediaCapture", "status");
  49. },
  50. displayError: function (error) {
  51. WinJS.log && WinJS.log(error, "MediaCapture", "error");
  52. },
  53. id: function (elementId) {
  54. return document.getElementById(elementId);
  55. },
  56. });
  57. WinJS.Application.addEventListener("activated", activated, false);
  58. WinJS.Application.start();
  59. Windows.UI.WebUI.WebUIApplication.addEventListener("suspending", SdkSample.suspendingHandler, false);
  60. Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", SdkSample.resumingHandler, false);
  61. })();