This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof Windows != 'undefined') { | |
// Create the picker | |
var picker = new Windows.ApplicationModel.Contacts.ContactPicker(); | |
picker.desiredFieldsWithContactFieldType.append(Windows.ApplicationModel.Contacts.ContactFieldType.email); | |
// Open the picker for the user to select a contact | |
picker.pickContactAsync().done(function (contact) { | |
if (contact !== null) { | |
var output = "Selected contact:\n" + contact.displayName; | |
console.log(output); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(Windows !== 'undefined' && | |
Windows.UI !== 'undefined' && | |
Windows.UI.Notifications !== 'undefined') { | |
var notifications = Windows.UI.Notifications; | |
//Get the XML template where the notification content will be suplied | |
var template = notifications.ToastTemplateType.toastImageAndText01; | |
var toastXml = notifications.ToastNotificationManager.getTemplateContent(template); | |
//Supply the text to the XML content | |
var toastTextElements = toastXml.getElementsByTagName("text"); | |
toastTextElements[0].appendChild(toastXml.createTextNode(message)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof Windows !== 'undefined' && | |
typeof Windows.UI !== 'undefined' && | |
typeof Windows.UI.Popups !== 'undefined' ) { | |
// Create the message dialog and set its content | |
var msg = new Windows.UI.Popups.MessageDialog(message); | |
// Add commands | |
msg.commands.append(new Windows.UI.Popups.UICommand("Okay", systemAlertCommandInvokedHandler)); | |
// Set default command | |
msg.defaultCommandIndex = 0; | |
// Show the message dialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(Windows && Windows.ApplicationModel && Windows.ApplicationModel.Appointments) {} | |
// Create an Appointment that should be added the user's appointments provider app. | |
var appointment = new Windows.ApplicationModel.Appointments.Appointment(); | |
// Get the selection rect of the button pressed to add this appointment | |
var boundingRect = e.srcElement.getBoundingClientRect(); | |
var selectionRect = { x: boundingRect.left, y: boundingRect.top, width: boundingRect.width, height: boundingRect.height }; | |
// ShowAddAppointmentAsync returns an appointment id if the appointment given was added to the user's calendar. | |
// This value should be stored in app data and roamed so that the appointment can be replaced or removed in the future. | |
// An empty string return value indicates that the user canceled the operation before the appointment was added. | |
Windows.ApplicationModel.Appointments.AppointmentManager.showAddAppointmentAsync(appointment, selectionRect, Windows.UI.Popups.Placement.default) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createToast(message, imgUrl, imgAlt) { | |
// Namespace: Windows.UI.Notifications | |
if (typeof Windows.UI.Notifications === 'undefined') { | |
return; | |
} | |
// Setup variables for shorthand | |
var notifications = Windows.UI.Notifications, | |
templateType = notifications.ToastTemplateType.toastImageAndText01, | |
templateContent = notifications.ToastNotificationManager.getTemplateContent(templateType), | |
toastMessage = templateContent.getElementsByTagName('text'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This function expects two hexStrings and relies on hexStrToRGBA to convert | |
to a JSON object that represents RGBA for the underlying Windows API to | |
understand. | |
Examples of valid values: | |
setAppBarColors('#FFFFFF','#000000'); | |
setAppBarColors('#FFF','#000'); | |
setAppBarColors('FFFFFF','000000'); | |
setAppBarColors('FFF','000'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.hide { | |
display:none; | |
} | |
.show { | |
display:block; | |
} | |
.message { | |
font-family:'Segoe UI', Arial, Helvetica, sans-serif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
"use strict"; | |
function createToast(message, imgUrl, imgAlt) { | |
// Namespace: Windows.UI.Notifications | |
if (typeof Windows !== 'undefined' && | |
typeof Windows.UI !== 'undefined' && | |
typeof Windows.UI.Notifications !== 'undefined') { | |
// Setup variables for shorthand | |
var notifications = Windows.UI.Notifications, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rapid.onResponse(async (res) => { | |
const main = document.querySelector("main"); | |
if (!res) { | |
main.innerHTML = "<pre>Response is empty</pre>"; | |
return; | |
} | |
const data = await res.json(); | |
main.innerHTML = | |
`<div> ${data.results[0].name.first} ${data.results[0].name.last} </div> |
OlderNewer