Apps are notified when they have been resumed Includes databases (SQLite, IndexedDB, ESE/Jet) and other facilities built on appdata (HTML AppCache, local.

Download Report

Transcript Apps are notified when they have been resumed Includes databases (SQLite, IndexedDB, ESE/Jet) and other facilities built on appdata (HTML AppCache, local.

Apps are notified when
they have been resumed
Includes databases (SQLite, IndexedDB, ESE/Jet) and other facilities built on appdata
(HTML AppCache, local storage, third-party libraries)
Windows.Storage.AccessCache (modified by WinRT API)
Windows.Storage.PasswordVault (modified by WinRT API), sync’d to cloud
using Windows.Storage;
// Create a simple setting
ApplicationDataContainer localSettings =
ApplicationData.Current.LocalSettings;
localSettings.Values["message"] = "Hello World";
Object value = localSettings.Values["message"];
// Create a setting in a container
ApplicationDataContainer container = localSettings.CreateContainer(
"exampleContainer", ApplicationDataCreateDisposition.Always);
localSettings.Containers["exampleContainer"].Values["message"] = "Hello World";
Object value = localSettings.Containers["exampleContainer"].Values["message"];
using Windows.Storage;
// Write a file
StorageFolder roamingFolder = ApplicationData.Current.roamingFolder;
StorageFile file = await roamingFolder.CreateFileAsync(filename,
CreationCollisionOption.ReplaceExisting);
await FileIO.WriteTextAsync(file, counter.ToString());
// Read a file
StorageFile file = await roamingFolder.GetFileAsync(filename);
string text = await FileIO.ReadTextAsync(file);
using Windows.Storage;
ApplicationDataContainer roamingSettings =
ApplicationData.Current.RoamingSettings;
ApplicationDataCompositeValue composite =
new ApplicationDataCompositeValue();
composite["readerSet"] = "Liam's Books";
composite["page"] = 524;
roamingSettings.Values["HighPriority"] = composite;
using Windows.Storage;
// DataChanged is fired when new data has been roamed to this device
applicationData.DataChanged += new TypedEventHandler<ApplicationData, object>
(DataChangedHandler);
async void DataChangedHandler(Windows.Storage.ApplicationData appData, object o)
{
// DataChangeHandler may be invoked on a background thread, so use the
// Dispatcher to invoke the UI-related code on the UI thread. Not needed
// in JavaScript.
await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
// Handle new data
});
}
using Windows.Storage;
using Windows.Storage.AccessCache;
// First permission granted by folder picker
StorageFolder folder = await folderPicker.PickSingleFolderAsync();
if (folder != null)
{
// Remember permission for future access to the folder
// (including other sub-folder contents)
StorageApplicationPermissions.FutureAccessList.AddOrReplace(
"PickedFolderToken", folder);
}
// Retrieve cached permission (in a later session)
StorageFolder folder2 = await StorageApplicationPermissions.FutureAccessList
.getFolderAsync("PickedFolderToken");
http://bit.ly/OUr8LC
using Windows.Security.Credentials;
using Windows.Security.Credentials.UI;
CredentialPickerOptions credPickerOptions = new CredentialPickerOptions();
// Set options like captions, messages, protocol, etc.
var res = await CredentialPicker.PickAsync(credPickerOptions);
PasswordVault vault = new PasswordVault();
// Password typically encrypted already from UI...but this is good for plain text
PasswordCredential c = new PasswordCredential("myCreds",
,
);
vault.Add(c);
// To retrieve later on
PasswordCredential cred = vault.Retrieve("myCreds", userName);
http://bit.ly/MuzL1e
http://bit.ly/ToslcK
http://bit.ly/RyT9uk
http://bit.ly/P5H292
http://www.w3.org/TR/webstorage/
http://dev.w3.org/html5/spec/offline.html
Application data sample
Launching, resuming, and
multitasking
Background task sample
Programming Windows 8 Apps
in HTML, CSS, and JavaScript
http://msdn.microsoft.com/enUS/windows/apps/br229512
http://design.windows.com/
http://code.msdn.microsoft.com/windows
apps/Windows-8-Modern-Style-AppSamples
http://channel9.msdn.com/Windows
http://aka.ms/BuildSessions