Windows Store Apps power of WinJS

Great Indian Developer Summit we showed the power of WinJS by taking pic and setting it in HTML page. Later we have used the image and set it as Profile picture. This was part of our Windows Store apps demo.

The code is shared here

 (function () {
    //intialize Camera and then enable Webcam capability in manifest
    var cam = new Windows.Media.Capture.CameraCaptureUI();
    //Set the mode to still photo
    var mode = Windows.Media.Capture.CameraCaptureUIMode.photo;
    //Call the camera object Async
    cam.captureFileAsync(mode).then(function (capImage) {
        var img = capImage; 
        var imgTag = document.createElement("img"); //Create html img tag
        imgTag.src = URL.createObjectURL(img); //HTML5 feature to convert image stream to temporary URL
        document.getElementById("content").appendChild(imgTag); // Add the img to the HTML to render
        //Part 2: Setting the UserProfile image from JS
        Windows.System.UserProfile.UserInformation.setAccountPictureAsync(img).then();
    });
})();
 

Namoskar!!!