Skip to content

Instantly share code, notes, and snippets.

@boyofgreen
Created March 23, 2016 23:59
Show Gist options
  • Save boyofgreen/83d2a92c179cb3948e99 to your computer and use it in GitHub Desktop.
Save boyofgreen/83d2a92c179cb3948e99 to your computer and use it in GitHub Desktop.
if (typeof Windows !== 'undefined'&& typeof Windows.Security !== 'undefined' && typeof Windows.Security.Credentials !== 'undefined') {
function UploadCheck() {
var username = "BobBarker" + Math.random();
var keycredentialmanager = Windows.Security.Credentials.KeyCredentialManager;
keycredentialmanager.isSupportedAsync().done(function (result) {
if (result == true) {
var retreivalstatus = keycredentialmanager.openAsync(username).done(function (result) {
if (result.status == 2) {
var keycreationresult = keycredentialmanager.requestCreateAsync(username,
Windows.Security.Credentials.KeyCredentialCreationOption.replaceExisting).done(function (result) {
if (result.status == 0) {
// Credentials are correct
document.getElementById('statusUpload').textContent = "Done! The check has been sent to your bank.";
document.getElementById('btnUpload').style.display = "none";
}
});
}
});
}
});
}
function ScanCheck() {
var camera = new Windows.Media.Capture.CameraCaptureUI();
camera.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function (result) {
if (result) {
var photoBlobUrl = URL.createObjectURL(result, { oneTimeOnly: true });
var img = new Image();
img.src = photoBlobUrl;
document.getElementById('placeholderCheck').appendChild(img);
document.getElementById('btnUpload').style.display = "";
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment