Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1

2

3

4

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

7

8

9

10 Windows Phone 8.1 AppWindows 8.1 App XAML View Phone UI XAML View Windows UI Shared Code, Images, Files WinRT

11

12 Windows Phone 8.1 AppWindows 8.1 App XAML View XAML UI XAML View XAML UI Logic Data ? Logic Data

13

14

15

16

17

18

19

20

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)

25

26 #if WINDOWS_PHONE_APP Windows.Phone.UI.Input.HardwareButtons.BackPressed += this.HardwareButtons_BackPressed ; #endif

27

28

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) {... }

30

31

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}">

37

38

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

42

43

44

45

46

47

48 www.microsoft.com/learning http://microsoft.com/msdn http://microsoft.com/technet http://channel9.msdn.com/Events/TechEd

49

50

51


Download ppt "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."

Similar presentations


Ads by Google