Download presentation
Presentation is loading. Please wait.
Published byDonald Richard Modified over 9 years ago
5
The Windows Runtime (WinRT) is the shared runtime and API space used by store apps across the Windows platform (phone and client) 5 Common WinRT APIs Phone-specific WinRT APIs Windows-specific WinRT APIs Dramatic convergence in 8.1 Goal is 100% convergence for dev scenarios In 8.0, we had ~30% API convergence With 8.1, we move well past 90%+ convergence
6
HTML Win32 JavaScript Code WinRT C++ CodeC#/VB Code HTMLXAML Windows Runtime XAML WinJS.NET for Windows Store C#/VB Code Silverlight XAML Silverlight.NET Windows Phone Silverlight XAML
10
Windows Phone 8.1 AppWindows 8.1 App XAML View Phone UI XAML View Windows UI Shared Code, Images, Files WinRT
12
Windows Phone 8.1 AppWindows 8.1 App XAML View XAML UI XAML View XAML UI Logic Data ? Logic Data
21
Windows 8.1Windows Phone 8.1 some common APIs may have different behaviour across Windows/Phone Windows Only WinRT e.g. search contract e.g. multiple windows e.g. resizable windows e.g. printing support Phone Only WinRT e.g. action center e.g. status bar e.g. back key handling
22
files & settings: local, temp, roaming, pickers… network: http, websockets, sockets… notifications: tiles, toasts, badges, push store: app purchases, receipts… sensors: gps, geofencing, gyro, compass… lifecycle: launch, suspend, resume, background tasks localisation: resource resolution from XAML/code…
23
//Create the picker object FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; // Users expect to have a filtered view of their folders openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".png"); // Open the picker for the user to pick a file StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { // Do something with the file... } //Create the picker object FileOpenPicker openPicker = new FileOpenPicker(); // On Windows Phone, setting Filtering to image types // causes Picker to show Camera Roll openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".png"); // Open the picker for the user to pick a file openPicker.PickSingleFileAndContinue();
24
100% No: Location (Windows) vs. Geopoint (WP) No: Bing Maps (Windows) vs. WinRT Map control (WP)
26
#if WINDOWS_PHONE_APP Windows.Phone.UI.Input.HardwareButtons.BackPressed += this.HardwareButtons_BackPressed ; #endif
29
/// /// DataSource.cs /// public partial class DataSource :IDataSource { public async Task > RetrieveFolders(IFolder root) {... // other logic var folders = await LoadFolders(root);... // other logic return folders } /// /// DataSource.WP.cs /// public partial class DataSource { private async Task > LoadFolders(IFolder root) {... }
32
HERE maps on Windows (8.1)/Phone (8.0)
33
common, same rendering Button Slider ToggleSwitch ProgressBar etc (many more) common, different content Hub ListView GridView etc. common, different rendering DatePicker TimePicker CommandBar AppBar etc. unique SearchBox Pivot ContentDialog AutoSuggestBox etc.
34
#if WINDOWS_APP var result = VisualStateManager.GoToState(this, "Windows", false); #elif WINDOWS_PHONE_APP var result = VisualStateManager.GoToState(this, "WindowsPhone", false); #endif
35
<Application x:Class="FlickrSearch.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:FlickrSearch">
36
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:FlickrSearch"> <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:FlickrSearch"> <FlipView ItemsSource="{Binding Items}" ItemTemplate="{StaticResource APhotoTemplate}">
39
WP 8.1 App – PFN 12345 RoamingLocalTemp Windows App – PFN 12345 RoamingLocalTemp PFN 12345 Roaming folder App writes data using standard file/settings APIs. Sync engine transfers data periodically based on triggers (user idle, battery, network, etc.) OneDrive stores up to 100kb of roaming data per app (not included in user quota). If app exceeds the limit, sync stops. Other clients are notified of updated data via Windows Notification Service. If app is running when sync occurs, an event is raised. Roaming settings
40
Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings; // saving settings... roamingSettings.Values["userName"] = someData; // fetching settings... if (roamingSettings.Values.ContainsKey("userName")) { userName = roamingSettings.Values["userName"].ToString(); }
41
Windows.Storage.ApplicationData.Current.DataChanged += Current_DataChanged;... void Current_DataChanged(ApplicationData sender, object args) { // Refresh your settings... } The event is only fired if the application is active at the time of the change You should still load up all your data when your app starts
48
www.microsoft.com/learning http://microsoft.com/msdn http://microsoft.com/technet http://channel9.msdn.com/Events/TechEd
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.