Skip to content

Instantly share code, notes, and snippets.

@Adamwaheed
Created March 15, 2016 10:50
Show Gist options
  • Save Adamwaheed/f50ddb261e2b69980e2f to your computer and use it in GitHub Desktop.
Save Adamwaheed/f50ddb261e2b69980e2f to your computer and use it in GitHub Desktop.
// For an introduction to the Blank template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232509
(function () {
"use strict";
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
// TODO: This application has been newly launched. Initialize
// your application here.
} else {
// TODO: This application has been reactivated from suspension.
// Restore application state here.
}
args.setPromise(WinJS.UI.processAll());
var helloButton = document.getElementById("helloButton");
helloButton.addEventListener("click", buttonClickHandler, false);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () { };
xhttp.open("POST", 'http://192.168.1.44/accounts/login/', true);
xhttp.send('username=admin&password=zkacc@ctl&login_type=pwd');
}
};
app.oncheckpoint = function (args) {
// TODO: This application is about to be suspended. Save any state
// that needs to persist across suspensions here. You might use the
// WinJS.Application.sessionState object, which is automatically
// saved and restored across suspension. If you need to complete an
// asynchronous operation before your application is suspended, call
// args.setPromise().
};
function buttonClickHandler(eventInfo) {
var userName = document.getElementById("nameInput").value;
var greetingString = "Hello, " + userName + "!";
document.getElementById("greetingOutput").innerText = greetingString;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (xhttp.readyState == 4 && xhttp.status == 200) {
document.getElementById("greetingOutput").innerHTML = xhttp.responseText;
}
};
xhttp.open("GET", 'http://192.168.1.44/iaccess/SendDoorData/?func=opendoor&type=part&data=9&open_interval=15&enable_no_tzs=false&stamp=1456942576896&_=1456942576899', true);
xhttp.send();
}
app.start();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment