Fixed all remote service examples due to changes in the services
|
@ -1,85 +1,85 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
|
||||
|
||||
var filterAutoComplete = new Telerik.UI.RadAutoCompleteBox(document.getElementById("autoComplete"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Customers",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
dataTextField: "CompanyName",
|
||||
onopen: FilteringExternalList.open,
|
||||
ondatabound: FilteringExternalList.dataBound
|
||||
});
|
||||
|
||||
filterAutoComplete.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
||||
WinJS.Namespace.define("FilteringExternalList", {
|
||||
|
||||
open: function (args) {
|
||||
args.preventDefault();
|
||||
},
|
||||
|
||||
dataBound: function (args) {
|
||||
var list = document.getElementById("listView").winControl;
|
||||
var listSource = new WinJS.Binding.List(args.target.dataSource.view);
|
||||
list.itemDataSource = listSource.dataSource;
|
||||
},
|
||||
|
||||
getTemplate: WinJS.Utilities.markSupportedForProcessing(function (itemPromise) {
|
||||
return itemPromise.then(function (item) {
|
||||
var el = document.createElement("div");
|
||||
el.classList.add("companyItem");
|
||||
el.innerHTML = [
|
||||
"<h3>" + item.data.CompanyName + "</h3>",
|
||||
"<p>Contact Name: " + item.data.ContactName + "</p>",
|
||||
"<p>Phone: " + item.data.Phone + "</p>"].join("");
|
||||
return el;
|
||||
})
|
||||
})
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
|
||||
|
||||
var filterAutoComplete = new Telerik.UI.RadAutoCompleteBox(document.getElementById("autoComplete"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Customers",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
dataTextField: "CompanyName",
|
||||
onopen: FilteringExternalList.open,
|
||||
ondatabound: FilteringExternalList.dataBound
|
||||
});
|
||||
|
||||
filterAutoComplete.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
||||
WinJS.Namespace.define("FilteringExternalList", {
|
||||
|
||||
open: function (args) {
|
||||
args.preventDefault();
|
||||
},
|
||||
|
||||
dataBound: function (args) {
|
||||
var list = document.getElementById("listView").winControl;
|
||||
var listSource = new WinJS.Binding.List(args.target.dataSource.view);
|
||||
list.itemDataSource = listSource.dataSource;
|
||||
},
|
||||
|
||||
getTemplate: WinJS.Utilities.markSupportedForProcessing(function (itemPromise) {
|
||||
return itemPromise.then(function (item) {
|
||||
var el = document.createElement("div");
|
||||
el.classList.add("companyItem");
|
||||
el.innerHTML = [
|
||||
"<h3>" + item.data.CompanyName + "</h3>",
|
||||
"<p>Contact Name: " + item.data.ContactName + "</p>",
|
||||
"<p>Phone: " + item.data.Phone + "</p>"].join("");
|
||||
return el;
|
||||
})
|
||||
})
|
||||
});
|
|
@ -1,70 +1,70 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function itemTemplate(item) {
|
||||
return matchQuery(item.ProductName);
|
||||
}
|
||||
|
||||
function matchQuery(name) {
|
||||
var autoCompleteBox = document.getElementById("autoComplete").winControl;
|
||||
var query = autoCompleteBox.text.toLowerCase();
|
||||
var index = name.toLowerCase().indexOf(query);
|
||||
var match = name.substring(index, index + query.length);
|
||||
return name.replace(match, "<span class='match'>" + match + "</span>");
|
||||
}
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
|
||||
var matchAutoComplete = new Telerik.UI.RadAutoCompleteBox(document.getElementById("autoComplete"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
dataTextField: "ProductName",
|
||||
template: itemTemplate
|
||||
});
|
||||
|
||||
matchAutoComplete.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function itemTemplate(item) {
|
||||
return matchQuery(item.ProductName);
|
||||
}
|
||||
|
||||
function matchQuery(name) {
|
||||
var autoCompleteBox = document.getElementById("autoComplete").winControl;
|
||||
var query = autoCompleteBox.text.toLowerCase();
|
||||
var index = name.toLowerCase().indexOf(query);
|
||||
var match = name.substring(index, index + query.length);
|
||||
return name.replace(match, "<span class='match'>" + match + "</span>");
|
||||
}
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
|
||||
var matchAutoComplete = new Telerik.UI.RadAutoCompleteBox(document.getElementById("autoComplete"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
dataTextField: "ProductName",
|
||||
template: itemTemplate
|
||||
});
|
||||
|
||||
matchAutoComplete.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var winTemplateAutoCompleteCtrl = new Telerik.UI.RadAutoCompleteBox(document.getElementById("winTemplateAutoComplete"), {
|
||||
dataTextField: "CompanyName",
|
||||
dataValueField: "CustomerID",
|
||||
filter: "contains",
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Customers",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
template: document.getElementById("autoCompleteBoxTemplate").winControl,
|
||||
height: 230
|
||||
});
|
||||
|
||||
winTemplateAutoCompleteCtrl.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var winTemplateAutoCompleteCtrl = new Telerik.UI.RadAutoCompleteBox(document.getElementById("winTemplateAutoComplete"), {
|
||||
dataTextField: "CompanyName",
|
||||
dataValueField: "CustomerID",
|
||||
filter: "contains",
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Customers",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
template: document.getElementById("autoCompleteBoxTemplate").winControl,
|
||||
height: 230
|
||||
});
|
||||
|
||||
winTemplateAutoCompleteCtrl.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -1,59 +1,59 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var autoCompleteBox = new Telerik.UI.RadAutoCompleteBox(document.getElementById("autoComplete"), {
|
||||
dataTextField: "CompanyName",
|
||||
filter: "contains",
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Customers",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
},
|
||||
onerror: function (e) {
|
||||
errorMsg.innerText = "Could not connect to remote service. Try again later.";
|
||||
}
|
||||
}
|
||||
});
|
||||
autoCompleteBox.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var autoCompleteBox = new Telerik.UI.RadAutoCompleteBox(document.getElementById("autoComplete"), {
|
||||
dataTextField: "CompanyName",
|
||||
filter: "contains",
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Customers",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
},
|
||||
onerror: function (e) {
|
||||
errorMsg.innerText = "Could not connect to remote service. Try again later.";
|
||||
}
|
||||
}
|
||||
});
|
||||
autoCompleteBox.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -1,70 +1,70 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
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().then(function () {
|
||||
var categories = new Telerik.UI.RadComboBox(categoriesCombo, {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Categories",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
dataTextField: "CategoryName",
|
||||
dataValueField: "CategoryID"
|
||||
});
|
||||
|
||||
|
||||
var products = new Telerik.UI.RadComboBox(productsCombo, {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
dataTextField: "ProductName",
|
||||
dataValueField: "ProductID",
|
||||
cascadeFrom: "categoriesCombo"
|
||||
});
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
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().then(function () {
|
||||
var categories = new Telerik.UI.RadComboBox(categoriesCombo, {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Categories",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
dataTextField: "CategoryName",
|
||||
dataValueField: "CategoryID"
|
||||
});
|
||||
|
||||
|
||||
var products = new Telerik.UI.RadComboBox(productsCombo, {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
dataTextField: "ProductName",
|
||||
dataValueField: "ProductID",
|
||||
cascadeFrom: "categoriesCombo"
|
||||
});
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|AnyCPU">
|
||||
|
@ -60,6 +60,7 @@
|
|||
<Content Include="images\storelogo.png" />
|
||||
<Content Include="js\default.js" />
|
||||
<Content Include="css\default.css" />
|
||||
<Content Include="js\movies.json" />
|
||||
<Content Include="ReadMe.html" />
|
||||
<None Include="Templates_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
|
@ -79,4 +80,4 @@
|
|||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
|
@ -1,8 +1,8 @@
|
|||
.mainContent {
|
||||
margin: 120px 0 250px 120px;
|
||||
}
|
||||
|
||||
.info {
|
||||
color: #feef7a;
|
||||
margin-left: 120px;
|
||||
.mainContent {
|
||||
margin: 120px 0 500px 120px;
|
||||
}
|
||||
|
||||
.info {
|
||||
color: #feef7a;
|
||||
margin-left: 120px;
|
||||
}
|
|
@ -1,60 +1,60 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var winTemplateComboBoxCtrl = new Telerik.UI.RadComboBox(document.getElementById("winTemplateComboBox"), {
|
||||
dataTextField: "Title",
|
||||
dataValueField: "Id",
|
||||
filter: "contains",
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://ebayodata.cloudapp.net/Deals",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
template: document.getElementById("comboBoxTemplate").winControl,
|
||||
height: 265
|
||||
});
|
||||
|
||||
winTemplateComboBoxCtrl.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var winTemplateComboBoxCtrl = new Telerik.UI.RadComboBox(document.getElementById("winTemplateComboBox"), {
|
||||
dataTextField: "Title",
|
||||
dataValueField: "Id",
|
||||
filter: "contains",
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "/js/movies.json",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "movies"
|
||||
}
|
||||
},
|
||||
template: document.getElementById("comboBoxTemplate").winControl,
|
||||
height: 265
|
||||
});
|
||||
|
||||
winTemplateComboBoxCtrl.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"movies": [
|
||||
{ "Id": 1, "Title": "Star Wars III - Revenge of the Sith", "SmallPictureUrl": "http://content8.flixster.com/movie/10/94/47/10944718_mob.jpg" },
|
||||
{ "Id": 2, "Title": "School of Rock", "SmallPictureUrl": "http://content7.flixster.com/movie/11/16/89/11168965_mob.jpg" },
|
||||
{ "Id": 3, "Title": "Man of Steel", "SmallPictureUrl": "http://content6.flixster.com/movie/11/17/13/11171304_mob.jpg" },
|
||||
{ "Id": 4, "Title": "Now You See Me", "SmallPictureUrl": "http://content6.flixster.com/movie/11/17/04/11170496_mob.jpg" },
|
||||
{ "Id": 5, "Title": "The Hobbit - The Desolation of Smaug", "SmallPictureUrl": "http://content7.flixster.com/movie/11/17/18/11171801_mob.jpg" },
|
||||
{ "Id": 6, "Title": "High School Musical", "SmallPictureUrl": "http://content9.flixster.com/movie/10/89/47/10894779_mob.jpg" }
|
||||
]
|
||||
}
|
|
@ -1,50 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>WebServiceBinding</title>
|
||||
|
||||
<!-- WinJS references -->
|
||||
<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
|
||||
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
|
||||
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
|
||||
|
||||
<!-- Telerik references -->
|
||||
<link href="///Telerik.UI/css/common.css" rel="stylesheet" />
|
||||
<link href="///Telerik.UI/css/dark.css" rel="stylesheet" />
|
||||
<script src="///Telerik.UI/js/jquery.js"></script>
|
||||
<script src="///Telerik.UI/js/ui.js"></script>
|
||||
|
||||
<!-- WebServiceBinding references -->
|
||||
<link href="/css/default.css" rel="stylesheet" />
|
||||
<script src="/js/default.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<section class="mainContent">
|
||||
<span id="comboBox1" data-win-control="Telerik.UI.RadComboBox" data-win-options="{
|
||||
index: 0,
|
||||
dataTextField: 'ProductName',
|
||||
dataValueField: 'ProductID',
|
||||
filter: 'contains',
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: 'http://services.odata.org/Northwind/Northwind.svc/Products',
|
||||
dataType: 'json'
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: 'd.results'
|
||||
},
|
||||
sort: { field: 'ProductName', dir: 'asc' }
|
||||
}
|
||||
}">
|
||||
</span>
|
||||
</section>
|
||||
<div class="info" data-win-control="WinJS.UI.HtmlControl" data-win-options="{
|
||||
uri: 'readme.html'
|
||||
}">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>WebServiceBinding</title>
|
||||
|
||||
<!-- WinJS references -->
|
||||
<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
|
||||
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
|
||||
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
|
||||
|
||||
<!-- Telerik references -->
|
||||
<link href="///Telerik.UI/css/common.css" rel="stylesheet" />
|
||||
<link href="///Telerik.UI/css/dark.css" rel="stylesheet" />
|
||||
<script src="///Telerik.UI/js/jquery.js"></script>
|
||||
<script src="///Telerik.UI/js/ui.js"></script>
|
||||
|
||||
<!-- WebServiceBinding references -->
|
||||
<link href="/css/default.css" rel="stylesheet" />
|
||||
<script src="/js/default.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<section class="mainContent">
|
||||
<span id="comboBox1" data-win-control="Telerik.UI.RadComboBox" data-win-options="{
|
||||
index: 0,
|
||||
dataTextField: 'ProductName',
|
||||
dataValueField: 'ProductID',
|
||||
filter: 'contains',
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: 'http://services.odata.org/Northwind/Northwind.svc/Products',
|
||||
dataType: 'json'
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: 'value'
|
||||
},
|
||||
sort: { field: 'ProductName', dir: 'asc' }
|
||||
}
|
||||
}">
|
||||
</span>
|
||||
</section>
|
||||
<div class="info" data-win-control="WinJS.UI.HtmlControl" data-win-options="{
|
||||
uri: 'readme.html'
|
||||
}">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,81 +1,81 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
|
||||
var suppliers = new Telerik.UI.RadDropDownList(suppliersList, {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Suppliers",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
dataTextField: "CompanyName",
|
||||
dataValueField: "SupplierID",
|
||||
optionLabel: "Pick a supplier"
|
||||
});
|
||||
|
||||
|
||||
var products = new Telerik.UI.RadDropDownList(productsList, {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
dataTextField: "ProductName",
|
||||
dataValueField: "ProductID",
|
||||
optionLabel: "Pick a product",
|
||||
cascadeFrom: "suppliersList"
|
||||
});
|
||||
|
||||
suppliers.dataSource.addEventListener("error", webServiceError);
|
||||
products.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
|
||||
var suppliers = new Telerik.UI.RadDropDownList(suppliersList, {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Suppliers",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
dataTextField: "CompanyName",
|
||||
dataValueField: "SupplierID",
|
||||
optionLabel: "Pick a supplier"
|
||||
});
|
||||
|
||||
|
||||
var products = new Telerik.UI.RadDropDownList(productsList, {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
dataTextField: "ProductName",
|
||||
dataValueField: "ProductID",
|
||||
optionLabel: "Pick a product",
|
||||
cascadeFrom: "suppliersList"
|
||||
});
|
||||
|
||||
suppliers.dataSource.addEventListener("error", webServiceError);
|
||||
products.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|AnyCPU">
|
||||
|
@ -60,6 +60,7 @@
|
|||
<Content Include="images\storelogo.png" />
|
||||
<Content Include="js\default.js" />
|
||||
<Content Include="css\default.css" />
|
||||
<Content Include="js\movies.json" />
|
||||
<Content Include="ReadMe.html" />
|
||||
<None Include="Templates_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
|
@ -79,4 +80,4 @@
|
|||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
|
@ -1,8 +1,8 @@
|
|||
.mainContent {
|
||||
margin: 120px 0 250px 120px;
|
||||
}
|
||||
|
||||
.info {
|
||||
color: #feef7a;
|
||||
margin: 120px;
|
||||
.mainContent {
|
||||
margin: 120px 0 500px 120px;
|
||||
}
|
||||
|
||||
.info {
|
||||
color: #feef7a;
|
||||
margin: 120px;
|
||||
}
|
|
@ -1,59 +1,59 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var stringTemplateDropDownCtrl = new Telerik.UI.RadDropDownList(document.getElementById("stringTemplateDropDown"), {
|
||||
dataTextField: "Title",
|
||||
dataValueField: "Id",
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://ebayodata.cloudapp.net/Deals",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
template: "<div id='container'><img src='#=SmallPictureUrl#' style='width:50px' alt='ProductName'/><h6>#=Title#</h6></div>",
|
||||
height: 330
|
||||
});
|
||||
|
||||
stringTemplateDropDownCtrl.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var stringTemplateDropDownCtrl = new Telerik.UI.RadDropDownList(document.getElementById("stringTemplateDropDown"), {
|
||||
dataTextField: "Title",
|
||||
dataValueField: "Id",
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "/js/movies.json",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "movies"
|
||||
}
|
||||
},
|
||||
template: "<div id='container'><img src='#=SmallPictureUrl#' style='width:50px' alt='ProductName'/><h6>#=Title#</h6></div>",
|
||||
height: 330
|
||||
});
|
||||
|
||||
stringTemplateDropDownCtrl.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"movies": [
|
||||
{ "Id": 1, "Title": "Star Wars III - Revenge of the Sith", "SmallPictureUrl": "http://content8.flixster.com/movie/10/94/47/10944718_mob.jpg" },
|
||||
{ "Id": 2, "Title": "School of Rock", "SmallPictureUrl": "http://content7.flixster.com/movie/11/16/89/11168965_mob.jpg" },
|
||||
{ "Id": 3, "Title": "Man of Steel", "SmallPictureUrl": "http://content6.flixster.com/movie/11/17/13/11171304_mob.jpg" },
|
||||
{ "Id": 4, "Title": "Now You See Me", "SmallPictureUrl": "http://content6.flixster.com/movie/11/17/04/11170496_mob.jpg" },
|
||||
{ "Id": 5, "Title": "The Hobbit - The Desolation of Smaug", "SmallPictureUrl": "http://content7.flixster.com/movie/11/17/18/11171801_mob.jpg" },
|
||||
{ "Id": 6, "Title": "High School Musical", "SmallPictureUrl": "http://content9.flixster.com/movie/10/89/47/10894779_mob.jpg" }
|
||||
]
|
||||
}
|
|
@ -1,48 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>WebServiceBinding</title>
|
||||
|
||||
<!-- WinJS references -->
|
||||
<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
|
||||
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
|
||||
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
|
||||
|
||||
<!-- Telerik references -->
|
||||
<link href="///Telerik.UI/css/common.css" rel="stylesheet" />
|
||||
<link href="///Telerik.UI/css/dark.css" rel="stylesheet" />
|
||||
<script src="///Telerik.UI/js/jquery.js"></script>
|
||||
<script src="///Telerik.UI/js/ui.js"></script>
|
||||
|
||||
<!-- WebServiceBinding references -->
|
||||
<link href="/css/default.css" rel="stylesheet" />
|
||||
<script src="/js/default.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<section class="mainContent">
|
||||
<div id="dropdown1" data-win-control="Telerik.UI.RadDropDownList" data-win-options="{
|
||||
dataTextField: 'ProductName',
|
||||
dataValueField: 'ProductID',
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: 'http://services.odata.org/Northwind/Northwind.svc/Products',
|
||||
dataType: 'json'
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: 'd.results'
|
||||
},
|
||||
sort: { field: 'ProductName', dir: 'asc' }
|
||||
}
|
||||
}">
|
||||
</div>
|
||||
</section>
|
||||
<div class="info" data-win-control="WinJS.UI.HtmlControl" data-win-options="{
|
||||
uri: 'readme.html'
|
||||
}">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>WebServiceBinding</title>
|
||||
|
||||
<!-- WinJS references -->
|
||||
<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
|
||||
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
|
||||
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
|
||||
|
||||
<!-- Telerik references -->
|
||||
<link href="///Telerik.UI/css/common.css" rel="stylesheet" />
|
||||
<link href="///Telerik.UI/css/dark.css" rel="stylesheet" />
|
||||
<script src="///Telerik.UI/js/jquery.js"></script>
|
||||
<script src="///Telerik.UI/js/ui.js"></script>
|
||||
|
||||
<!-- WebServiceBinding references -->
|
||||
<link href="/css/default.css" rel="stylesheet" />
|
||||
<script src="/js/default.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<section class="mainContent">
|
||||
<div id="dropdown1" data-win-control="Telerik.UI.RadDropDownList" data-win-options="{
|
||||
dataTextField: 'ProductName',
|
||||
dataValueField: 'ProductID',
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: 'http://services.odata.org/Northwind/Northwind.svc/Products',
|
||||
dataType: 'json'
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: 'value'
|
||||
},
|
||||
sort: { field: 'ProductName', dir: 'asc' }
|
||||
}
|
||||
}">
|
||||
</div>
|
||||
</section>
|
||||
<div class="info" data-win-control="WinJS.UI.HtmlControl" data-win-options="{
|
||||
uri: 'readme.html'
|
||||
}">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,71 +1,84 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var grid = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://ebayodata.cloudapp.net/Items?$format=json&search='helsinki%20postcard'",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results",
|
||||
model: {
|
||||
fields: {
|
||||
Title: { type: "string" },
|
||||
GalleryUrl: { type: "string" },
|
||||
CurrentPrice: { type: "number" },
|
||||
ViewItemUrl: { type: "string" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{ field: "Title" },
|
||||
{ field: "GalleryUrl", title: "Picture", template: "<img src='#=GalleryUrl#'/>", sortable: false },
|
||||
{ field: "CurrentPrice", title: "Current Price", format: "{0:C}" },
|
||||
{ field: "ViewItemUrl", title: "Url", template: "<a href='#=ViewItemUrl#'>View item</a>", sortable: false }
|
||||
],
|
||||
sortable: "single, allowUnsort",
|
||||
height: 400
|
||||
});
|
||||
|
||||
grid.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
function getPhotoTemplate(emp) {
|
||||
var html;
|
||||
|
||||
MSApp.execUnsafeLocalFunction(function () {
|
||||
html = "<img src='" + emp.Photo + "' />";
|
||||
});
|
||||
return html;
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var grid = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Invoices",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value",
|
||||
model: {
|
||||
fields: {
|
||||
ShipName: { type: "string" },
|
||||
ShipCity: { type: "string" },
|
||||
ShipCountry: { type: "string" },
|
||||
ProductName: { type: "string" },
|
||||
Quantity: { type: "number" },
|
||||
UnitPrice: { type: "number" },
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{ field: "ShipName", title: "Ship Name", width: 275},
|
||||
{ field: "ShipCity", title: "Ship City" },
|
||||
{ field: "ShipCountry", title: "Ship Country" },
|
||||
{ field: "ProductName", title: "Product", width: 275 },
|
||||
{ field: "Quantity", width: 100 },
|
||||
{ field: "UnitPrice", title: "Unit Price", format: "{0:c0}", width: 100 }
|
||||
],
|
||||
sortable: "single, allowUnsort",
|
||||
height: 400
|
||||
});
|
||||
|
||||
grid.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -1,104 +1,104 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var grid = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Employees",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results",
|
||||
model: {
|
||||
fields: {
|
||||
FirstName: { type: "string" },
|
||||
LastName: { type: "string" },
|
||||
BirthDate: { type: "date" },
|
||||
Title: { type: "string" },
|
||||
PostalCode: { type: "string" },
|
||||
City: { type: "string" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
sortable: "single, allowUnsort",
|
||||
filterable: true,
|
||||
columns: [
|
||||
{
|
||||
title: "Picture",
|
||||
template: "<img src='http://demos.telerik.com/aspnet-ajax/salesdashboard/Images/#= FirstName #_#=LastName#.png' />"
|
||||
},
|
||||
{
|
||||
field: "FirstName",
|
||||
title: "First Name",
|
||||
filterable: false
|
||||
},
|
||||
{
|
||||
field: "LastName",
|
||||
title: "Last Name"
|
||||
},
|
||||
{
|
||||
field: "BirthDate",
|
||||
format: "{0:MMMM dd, yyyy}",
|
||||
title: "Birth Date"
|
||||
},
|
||||
{
|
||||
field: "Title",
|
||||
sortable: false,
|
||||
width: 200,
|
||||
attributes: { style: "font-weight: bold; text-align: center" },
|
||||
headerAttributes: { style: "text-align: center" }
|
||||
},
|
||||
{
|
||||
field: "PostalCode",
|
||||
sortable: false,
|
||||
title: "Postal Code",
|
||||
width: 140
|
||||
},
|
||||
{
|
||||
field: "City"
|
||||
}
|
||||
],
|
||||
height: 400
|
||||
});
|
||||
|
||||
grid.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var grid = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Employees",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value",
|
||||
model: {
|
||||
fields: {
|
||||
FirstName: { type: "string" },
|
||||
LastName: { type: "string" },
|
||||
BirthDate: { type: "date" },
|
||||
Title: { type: "string" },
|
||||
PostalCode: { type: "string" },
|
||||
City: { type: "string" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
sortable: "single, allowUnsort",
|
||||
filterable: true,
|
||||
columns: [
|
||||
{
|
||||
title: "Picture",
|
||||
template: "<img src='http://demos.telerik.com/aspnet-ajax/salesdashboard/Images/#= FirstName #_#=LastName#.png' />"
|
||||
},
|
||||
{
|
||||
field: "FirstName",
|
||||
title: "First Name",
|
||||
filterable: false
|
||||
},
|
||||
{
|
||||
field: "LastName",
|
||||
title: "Last Name"
|
||||
},
|
||||
{
|
||||
field: "BirthDate",
|
||||
format: "{0:MMMM dd, yyyy}",
|
||||
title: "Birth Date"
|
||||
},
|
||||
{
|
||||
field: "Title",
|
||||
sortable: false,
|
||||
width: 200,
|
||||
attributes: { style: "font-weight: bold; text-align: center" },
|
||||
headerAttributes: { style: "text-align: center" }
|
||||
},
|
||||
{
|
||||
field: "PostalCode",
|
||||
sortable: false,
|
||||
title: "Postal Code",
|
||||
width: 140
|
||||
},
|
||||
{
|
||||
field: "City"
|
||||
}
|
||||
],
|
||||
height: 400
|
||||
});
|
||||
|
||||
grid.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results",
|
||||
data: "value",
|
||||
model: {
|
||||
id: "ProductID",
|
||||
fields: {
|
||||
|
@ -85,7 +85,7 @@
|
|||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
dataTextField: "CategoryName",
|
||||
|
|
|
@ -1,97 +1,97 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function loadChildRecords(args) {
|
||||
var grid = args.target;
|
||||
var selectedRow = grid.selection;
|
||||
var dataItem = grid.dataItem(selectedRow);
|
||||
var filter = { field: "CategoryID", operator: 'eq', value: dataItem.CategoryID };
|
||||
|
||||
var childGrid = document.getElementById("grid2").winControl;
|
||||
childGrid.dataSource.filter = filter;
|
||||
childGrid.dataSource.read();
|
||||
}
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var masterGrid = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Categories",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{ field: "CategoryName", title: "Category Name" },
|
||||
{ field: "Description" }
|
||||
],
|
||||
selectable: "row",
|
||||
onchange: loadChildRecords
|
||||
});
|
||||
masterGrid.dataSource.addEventListener("error", webServiceError);
|
||||
|
||||
var detailGrid = new Telerik.UI.RadGrid(document.getElementById("grid2"), {
|
||||
autoBind: false,
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results",
|
||||
model: {
|
||||
fields: {
|
||||
OrderDate: { type: "date" }
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
columns: [
|
||||
{ field: "ProductID", title: "ID" },
|
||||
{ field: "ProductName", title: "Product Name" },
|
||||
{ field: "QuantityPerUnit", title: "Quantity" }
|
||||
]
|
||||
});
|
||||
detailGrid.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function loadChildRecords(args) {
|
||||
var grid = args.target;
|
||||
var selectedRow = grid.selection;
|
||||
var dataItem = grid.dataItem(selectedRow);
|
||||
var filter = { field: "CategoryID", operator: 'eq', value: dataItem.CategoryID };
|
||||
|
||||
var childGrid = document.getElementById("grid2").winControl;
|
||||
childGrid.dataSource.filter = filter;
|
||||
childGrid.dataSource.read();
|
||||
}
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var masterGrid = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Categories",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{ field: "CategoryName", title: "Category Name" },
|
||||
{ field: "Description" }
|
||||
],
|
||||
selectable: "row",
|
||||
onchange: loadChildRecords
|
||||
});
|
||||
masterGrid.dataSource.addEventListener("error", webServiceError);
|
||||
|
||||
var detailGrid = new Telerik.UI.RadGrid(document.getElementById("grid2"), {
|
||||
autoBind: false,
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value",
|
||||
model: {
|
||||
fields: {
|
||||
OrderDate: { type: "date" }
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
columns: [
|
||||
{ field: "ProductID", title: "ID" },
|
||||
{ field: "ProductName", title: "Product Name" },
|
||||
{ field: "QuantityPerUnit", title: "Quantity" }
|
||||
]
|
||||
});
|
||||
detailGrid.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|
|
@ -1,86 +1,86 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var grid = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Employees",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
}
|
||||
},
|
||||
columns: [{ title: 'Person Info' }, { title: 'Job Info' }],
|
||||
rowTemplate: Rows.rowTemplate,
|
||||
altRowTemplate: Rows.altRowTemplate,
|
||||
height: 500
|
||||
});
|
||||
|
||||
grid.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
||||
WinJS.Namespace.define("Rows", {
|
||||
rowTemplate: function (item) {
|
||||
var firstCell = ["<td><div class='pItem'>",
|
||||
"<img src='http://demos.telerik.com/aspnet-ajax/salesdashboard/Images/" + item.FirstName + "_" + item.LastName + ".png' />",
|
||||
item.FirstName + " " + item.LastName,
|
||||
"</div><div class='notes'>",
|
||||
item.Notes + "</div></td>"].join("");
|
||||
|
||||
var secondCell = ["<td><p>Position: ",
|
||||
item.Title + "</p><p>Works in: ",
|
||||
item.City + ", " + item.Country,
|
||||
"</p><p>Extension: " + item.Extension + "</p></td>"].join("");
|
||||
|
||||
var template = "<tr>" + firstCell + secondCell + "</tr>";
|
||||
|
||||
return template;
|
||||
},
|
||||
|
||||
altRowTemplate: function (item) {
|
||||
//get the regular template content
|
||||
var template = Rows.rowTemplate(item);
|
||||
//set the different class name for alt rows
|
||||
template = template.replace("<tr", "<tr class='altRow'");
|
||||
return template;
|
||||
}
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var grid = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Employees",
|
||||
dataType: "json"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
}
|
||||
},
|
||||
columns: [{ title: 'Person Info' }, { title: 'Job Info' }],
|
||||
rowTemplate: Rows.rowTemplate,
|
||||
altRowTemplate: Rows.altRowTemplate,
|
||||
height: 500
|
||||
});
|
||||
|
||||
grid.dataSource.addEventListener("error", webServiceError);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
||||
WinJS.Namespace.define("Rows", {
|
||||
rowTemplate: function (item) {
|
||||
var firstCell = ["<td><div class='pItem'>",
|
||||
"<img src='http://demos.telerik.com/aspnet-ajax/salesdashboard/Images/" + item.FirstName + "_" + item.LastName + ".png' />",
|
||||
item.FirstName + " " + item.LastName,
|
||||
"</div><div class='notes'>",
|
||||
item.Notes + "</div></td>"].join("");
|
||||
|
||||
var secondCell = ["<td><p>Position: ",
|
||||
item.Title + "</p><p>Works in: ",
|
||||
item.City + ", " + item.Country,
|
||||
"</p><p>Extension: " + item.Extension + "</p></td>"].join("");
|
||||
|
||||
var template = "<tr>" + firstCell + secondCell + "</tr>";
|
||||
|
||||
return template;
|
||||
},
|
||||
|
||||
altRowTemplate: function (item) {
|
||||
//get the regular template content
|
||||
var template = Rows.rowTemplate(item);
|
||||
//set the different class name for alt rows
|
||||
template = template.replace("<tr", "<tr class='altRow'");
|
||||
return template;
|
||||
}
|
||||
});
|
|
@ -1,76 +1,76 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var ds = new Telerik.Data.DataSource({
|
||||
transport: {
|
||||
read: {
|
||||
url: 'http://services.odata.org/Northwind/Northwind.svc/Order_Details',
|
||||
dataType: 'json'
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: 'd.results',
|
||||
total: Scrolling.total
|
||||
},
|
||||
pageSize: 10
|
||||
});
|
||||
|
||||
ds.addEventListener("error", webServiceError);
|
||||
|
||||
ds.read().then(function () {
|
||||
var grid2Ctrl = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: ds,
|
||||
scrollable: "virtual",
|
||||
columns: [
|
||||
{ field: "OrderID", title: "Order ID" },
|
||||
{ field: "ProductID", title: "Product ID" },
|
||||
{ field: "UnitPrice", title: "Unit Price" },
|
||||
{ field: "Quantity", title: "Quantity" },
|
||||
{ field: "Discount", title: "Discount" }
|
||||
],
|
||||
height: 400
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
||||
WinJS.Namespace.define("Scrolling", {
|
||||
total: function (response) {
|
||||
return response.d.results.length;
|
||||
}
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
function webServiceError() {
|
||||
var msg = Windows.UI.Popups.MessageDialog("Web service is currently down, try again later");
|
||||
msg.showAsync();
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
var ds = new Telerik.Data.DataSource({
|
||||
transport: {
|
||||
read: {
|
||||
url: 'http://services.odata.org/Northwind/Northwind.svc/Order_Details',
|
||||
dataType: 'json'
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: 'value',
|
||||
total: Scrolling.total
|
||||
},
|
||||
pageSize: 10
|
||||
});
|
||||
|
||||
ds.addEventListener("error", webServiceError);
|
||||
|
||||
ds.read().then(function () {
|
||||
var grid2Ctrl = new Telerik.UI.RadGrid(document.getElementById("grid1"), {
|
||||
dataSource: ds,
|
||||
scrollable: "virtual",
|
||||
columns: [
|
||||
{ field: "OrderID", title: "Order ID" },
|
||||
{ field: "ProductID", title: "Product ID" },
|
||||
{ field: "UnitPrice", title: "Unit Price" },
|
||||
{ field: "Quantity", title: "Quantity" },
|
||||
{ field: "Discount", title: "Discount" }
|
||||
],
|
||||
height: 400
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
||||
WinJS.Namespace.define("Scrolling", {
|
||||
total: function (response) {
|
||||
return response.value.length;
|
||||
}
|
||||
});
|
|
@ -1,7 +1,11 @@
|
|||
<p>This example shows a RadCustomHubTile displaying text and images coming from a remote point.</p>
|
||||
|
||||
<p>
|
||||
The scenario is achieved by making an xhr request to the eBay OData service to access the latest deal, and creating a hubtile populated with
|
||||
this data. The RadCustomHubTile is initialized after the response is returned and its back content template is populated with the already
|
||||
available information (only the image needs to be loaded from the given url).
|
||||
</p>
|
||||
<p>This example shows a RadCustomHubTile displaying data coming from a remote point.</p>
|
||||
|
||||
<p>
|
||||
The scenario is achieved by making an xhr request to the Northwind service to retrieve all of the products, and creating a hubtile populated with
|
||||
a random product from the data. The RadCustomHubTile is initialized after the response is returned and its back content template is populated with the already
|
||||
available information (We have the images locally and load them by a given id).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Additionally there is a button, that on click gets a new random product item and refreshes the hubtile with it.
|
||||
</p>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|AnyCPU">
|
||||
|
@ -55,6 +55,26 @@
|
|||
</AppxManifest>
|
||||
<Content Include="default.html" />
|
||||
<Content Include="images\logo.png" />
|
||||
<Content Include="images\Products\1.png" />
|
||||
<Content Include="images\Products\10.png" />
|
||||
<Content Include="images\Products\11.png" />
|
||||
<Content Include="images\Products\12.png" />
|
||||
<Content Include="images\Products\13.png" />
|
||||
<Content Include="images\Products\14.png" />
|
||||
<Content Include="images\Products\15.png" />
|
||||
<Content Include="images\Products\16.png" />
|
||||
<Content Include="images\Products\17.png" />
|
||||
<Content Include="images\Products\18.png" />
|
||||
<Content Include="images\Products\19.png" />
|
||||
<Content Include="images\Products\2.png" />
|
||||
<Content Include="images\Products\20.png" />
|
||||
<Content Include="images\Products\3.png" />
|
||||
<Content Include="images\Products\4.png" />
|
||||
<Content Include="images\Products\5.png" />
|
||||
<Content Include="images\Products\6.png" />
|
||||
<Content Include="images\Products\7.png" />
|
||||
<Content Include="images\Products\8.png" />
|
||||
<Content Include="images\Products\9.png" />
|
||||
<Content Include="images\smalllogo.png" />
|
||||
<Content Include="images\splashscreen.png" />
|
||||
<Content Include="images\storelogo.png" />
|
||||
|
@ -79,4 +99,4 @@
|
|||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
|
@ -1,46 +1,50 @@
|
|||
.mainContent {
|
||||
margin: 120px;
|
||||
height: 300px;
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
.info {
|
||||
color: #feef7a;
|
||||
margin-left: 120px;
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
/*tile appearance*/
|
||||
div.t-hubtile {
|
||||
width: 310px;
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
div.t-tile {
|
||||
background-color: #009D00;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.t-tile h2 {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: -ms-grid;
|
||||
-ms-grid-columns: 2;
|
||||
-ms-grid-rows: 1;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.cell1 {
|
||||
-ms-grid-column: 1;
|
||||
}
|
||||
|
||||
.cell2 {
|
||||
-ms-grid-column: 2;
|
||||
}
|
||||
|
||||
.smallerText {
|
||||
font-size: 10pt;
|
||||
}
|
||||
/*#endregion*/
|
||||
.mainContent {
|
||||
margin: 120px;
|
||||
height: 300px;
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
.info {
|
||||
color: #feef7a;
|
||||
margin-left: 120px;
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
/*tile appearance*/
|
||||
div.t-hubtile {
|
||||
width: 310px;
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
div.t-tile {
|
||||
background-color: #009D00;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.t-tile h2 {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: -ms-grid;
|
||||
-ms-grid-columns: 2;
|
||||
-ms-grid-rows: 1;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.cell1 {
|
||||
-ms-grid-column: 1;
|
||||
}
|
||||
|
||||
.cell2 {
|
||||
-ms-grid-column: 2;
|
||||
}
|
||||
|
||||
.smallerText {
|
||||
font-size: 10pt;
|
||||
}
|
||||
/*#endregion*/
|
||||
|
||||
#refreshBtn {
|
||||
display: block;
|
||||
}
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>ShowLiveDataWithCustomHubTile</title>
|
||||
|
||||
<!-- WinJS references -->
|
||||
<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
|
||||
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
|
||||
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
|
||||
|
||||
<!-- Telerik references -->
|
||||
<link href="///Telerik.UI/css/common.css" rel="stylesheet" />
|
||||
<link href="///Telerik.UI/css/dark.css" rel="stylesheet" />
|
||||
<script src="///Telerik.UI/js/jquery.js"></script>
|
||||
<script src="///Telerik.UI/js/ui.js"></script>
|
||||
|
||||
<!-- ShowingLiveDataWithCustomHubTile references -->
|
||||
<link href="/css/default.css" rel="stylesheet" />
|
||||
<script src="/js/default.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<section class="mainContent">
|
||||
<div id="hubTile"></div>
|
||||
</section>
|
||||
<div class="info" data-win-control="WinJS.UI.HtmlControl" data-win-options="{
|
||||
uri: 'readme.html'
|
||||
}">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>ShowLiveDataWithCustomHubTile</title>
|
||||
|
||||
<!-- WinJS references -->
|
||||
<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
|
||||
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
|
||||
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
|
||||
|
||||
<!-- Telerik references -->
|
||||
<link href="///Telerik.UI/css/common.css" rel="stylesheet" />
|
||||
<link href="///Telerik.UI/css/dark.css" rel="stylesheet" />
|
||||
<script src="///Telerik.UI/js/jquery.js"></script>
|
||||
<script src="///Telerik.UI/js/ui.js"></script>
|
||||
|
||||
<!-- ShowingLiveDataWithCustomHubTile references -->
|
||||
<link href="/css/default.css" rel="stylesheet" />
|
||||
<script src="/js/default.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<section class="mainContent">
|
||||
<div id="hubTile"></div>
|
||||
<input id="refreshBtn" type="button" value="Refresh Tile" />
|
||||
</section>
|
||||
<div class="info" data-win-control="WinJS.UI.HtmlControl" data-win-options="{
|
||||
uri: 'readme.html'
|
||||
}">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
После Ширина: | Высота: | Размер: 5.6 KiB |
После Ширина: | Высота: | Размер: 6.4 KiB |
После Ширина: | Высота: | Размер: 5.6 KiB |
После Ширина: | Высота: | Размер: 5.2 KiB |
После Ширина: | Высота: | Размер: 6.1 KiB |
После Ширина: | Высота: | Размер: 6.3 KiB |
После Ширина: | Высота: | Размер: 5.5 KiB |
После Ширина: | Высота: | Размер: 5.7 KiB |
После Ширина: | Высота: | Размер: 6.0 KiB |
После Ширина: | Высота: | Размер: 5.4 KiB |
После Ширина: | Высота: | Размер: 5.7 KiB |
После Ширина: | Высота: | Размер: 3.9 KiB |
После Ширина: | Высота: | Размер: 5.3 KiB |
После Ширина: | Высота: | Размер: 5.7 KiB |
После Ширина: | Высота: | Размер: 6.5 KiB |
После Ширина: | Высота: | Размер: 6.1 KiB |
После Ширина: | Высота: | Размер: 6.4 KiB |
После Ширина: | Высота: | Размер: 6.2 KiB |
После Ширина: | Высота: | Размер: 5.8 KiB |
После Ширина: | Высота: | Размер: 6.1 KiB |
|
@ -1,59 +1,74 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
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().then(function () {
|
||||
WinJS.xhr({
|
||||
url: "http://ebayodata.cloudapp.net/Deals?$format=json&$top=1",
|
||||
}).then(function (result) {
|
||||
//result is the JSON response from the service, we call JSON.parse to parse it into a JavaScript object
|
||||
var response = JSON.parse(result.response);
|
||||
//there is a single data item inside the d.results object in the parsed response
|
||||
var currentItem = response.d.results[0];
|
||||
//create the hub tile once the data is available
|
||||
var hubTile = new Telerik.UI.RadCustomHubTile(document.getElementById("hubTile"), {
|
||||
frontContentTemplate: '<h2> Newest Deal</h2>',
|
||||
backContentTemplate: LiveDataSample.getDeal(currentItem),
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
||||
WinJS.Namespace.define("LiveDataSample", {
|
||||
getDeal: WinJS.Utilities.markSupportedForProcessing(function (item) {
|
||||
var template = "<div class='grid'><div class='cell1'><p class='smallerText'>" +
|
||||
item.Title + "</p><p>Price: $" +
|
||||
item.ConvertedCurrentPrice + "</p></div><div class='cell2'><img height='120' src='" +
|
||||
item.Picture175Url + "' alt='Picture'/></div></div>";
|
||||
|
||||
return template;
|
||||
})
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
var app = WinJS.Application;
|
||||
var activation = Windows.ApplicationModel.Activation;
|
||||
|
||||
// defining the products and hubTile variables here, so we can use them in functions outside the processAll promise.
|
||||
var products, hubTile;
|
||||
|
||||
// generating a new random index and changing the content of the RadHubTile with the product at the new index
|
||||
function refreshHubTile() {
|
||||
var rndmItem = Math.floor(Math.random() * 20);
|
||||
var currentItem = products[rndmItem];
|
||||
|
||||
hubTile.backContentTemplate = LiveDataSample.getDeal(currentItem);
|
||||
}
|
||||
|
||||
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().then(function () {
|
||||
WinJS.xhr({
|
||||
url: "http://services.odata.org/V3/Northwind/Northwind.svc/Products?$format=json",
|
||||
}).then(function (result) {
|
||||
//result is the JSON response from the service, we call JSON.parse to parse it into a JavaScript object
|
||||
var response = JSON.parse(result.response);
|
||||
//there are 20 products inside the "value" object. We take one on random, so we can have a different one every time.
|
||||
products = response.value;
|
||||
var rndmItem = Math.floor(Math.random() * 20);
|
||||
var currentItem = products[rndmItem];
|
||||
//create the hub tile once the data is available
|
||||
hubTile = new Telerik.UI.RadCustomHubTile(document.getElementById("hubTile"), {
|
||||
frontContentTemplate: '<h2> Newest Deal</h2>',
|
||||
backContentTemplate: LiveDataSample.getDeal(currentItem),
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById("refreshBtn").addEventListener("click", refreshHubTile);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
||||
WinJS.Namespace.define("LiveDataSample", {
|
||||
getDeal: WinJS.Utilities.markSupportedForProcessing(function (item) {
|
||||
var template = ["<div class='grid'><div class='cell1'><p class='smallerText'>",
|
||||
item.ProductName, "</p><p>Price: $",
|
||||
item.UnitPrice, "</p></div><div class='cell2'><img height='120' src='/images/Products/",
|
||||
item.ProductID, ".png' alt='Picture'/></div></div>"].join("");
|
||||
|
||||
return template;
|
||||
})
|
||||
});
|
|
@ -1,51 +1,51 @@
|
|||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
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());
|
||||
}
|
||||
};
|
||||
|
||||
WinJS.Namespace.define("Filtering", {
|
||||
DataSource: new Telerik.Data.DataSource({
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "d.results"
|
||||
},
|
||||
sort: { field: "ProductName", dir: "asc" },
|
||||
onerror: function (e) { debugger; }
|
||||
})
|
||||
});
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
// For an introduction to the Blank template, see the following documentation:
|
||||
// http://go.microsoft.com/fwlink/?LinkId=232509
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
WinJS.Binding.optimizeBindingReferences = true;
|
||||
|
||||
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());
|
||||
}
|
||||
};
|
||||
|
||||
WinJS.Namespace.define("Filtering", {
|
||||
DataSource: new Telerik.Data.DataSource({
|
||||
transport: {
|
||||
read: {
|
||||
url: "http://services.odata.org/Northwind/Northwind.svc/Products",
|
||||
dataType: "json"
|
||||
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "value"
|
||||
},
|
||||
sort: { field: "ProductName", dir: "asc" },
|
||||
onerror: function (e) { debugger; }
|
||||
})
|
||||
});
|
||||
|
||||
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().
|
||||
};
|
||||
|
||||
app.start();
|
||||
})();
|
||||
|
|