“Thanks guys for a great information packed day. head is spinning!” “Well done guys. Intense sessions” “This is the best ever JumpStart that I have.

Slides:



Advertisements
Similar presentations
Staying in Sync with Cloud 2 Device Messaging. About Me Chris Risner Twitter: chrisrisner.
Advertisements

Extending SharePoint Online met Windows 8 apps. Voorstellen.
ASP.NET Best Practices Dawit Wubshet Park University.
APIWP7.1WP8W8 System.Net.WebClient  System.Net.HttpWebRequest (async only) System.Net.Http.HttpClient (NuGet) Windows.Web.Syndication.SyndicationClient.
Msdevcon.ru#msdevcon. Windows Phone 8 Networking Survival Kit Andy Wigley Microsoft UK.
Check Disk. Disk Defragmenter Using Disk Defragmenter Effectively Run Disk Defragmenter when the computer will receive the least usage. Educate users.
User signs in to WindowsUser is signed in to your app 12.
Role based Security in.NET By By Aasia Riasat Aasia RiasatCS-795.
Developing Windows 8 Store Apps using HTML5 Refresh / Exam Prep M2: Storage, Networking, and Security Michael Palermo Microsoft Technical Evangelist.
Charles Petzold Navigation.
Introducing Xamarin 2.0 Introducing Xamarin 2.0 Michael Hutchinson
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
CVSQL 2 The Design. System Overview System Components CVSQL Server –Three network interfaces –Modular data source provider framework –Decoupled SQL parsing.
Connected Experiences
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
JavaScript & jQuery the missing manual Chapter 11
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
Google Cloud Messaging for Android (GCM) is a free service that helps developers send data from servers to their Android.
Agenda Windows Phone History WP 7.0 Silverlight WP 7.5 Silverlight WP 8.0 Silverlight WP 8.1 Silverlight WP 8.1 WinRT.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
DUE Hello World on the Android Platform.
Troubleshooting Windows Vista Security Chapter 4.
Reaching your customers in new and unique ways Mobile “Devices” led to revolutionary Experiences “Bring the experience with you” Came with many constraints.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Securing a Microsoft ASP.NET Web Application.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Online Service 1. Authorization Request (Start URL) 2. Login page 3. Credentials 4. Authorization page 5. User decision 6. Authorization.
Presentation. Recap A multi layer architecture powered by Spring Framework, ExtJS, Spring Security and Hibernate. Taken advantage of Spring’s multi layer.
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.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Getting Started with OPC.NET OPC.NET Software Client Interface Client Base Server Base OPC Wrapper OPC COM Server Server Interface WCF Alternate.
.  A multi layer architecture powered by Spring Framework, ExtJS, Spring Security and Hibernate.  Taken advantage of Spring’s multi layer injection.
Enterprise Library Extensibility Brian Button VP of Engineering Asynchrony Solutions, Inc.
IAsyncResult ar = BeginSomething(…); // Do other work, checking ar.IsCompleted int result = EndSomething(ar);
API Crash Course CWU Startup Club. OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an.
Building a Web API for browser/JSON clients.
Five great reasons to use the new HttpClient API
ICM – API Server & Forms Gary Ratcliffe.
Simplicity Tile Update Notification Service Tile Update Notification Service SOAP Windows Communication Foundation Windows Web Services SOAP.
Chris Adams Solutions Architect Microsoft Corporation SESSION CODE: MGT303 Brian Copps Service Engineering, Mgr Microsoft Corporation.
Poster Print Size: This poster template is 50” high by 30” wide and is printed at 120% for a 60” high by 36” wide poster. It can be used to print any poster.
Web Technologies Lecture 11 Implementing RESTful services.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Overview of Previous Lesson(s) Over View  ASP is a technology that enables scripts in web pages to be executed by an Internet server.  ASP.NET is a.
Integral Users will interact with your app on a big screen with keyboard and mouse.
App Package Folder App data Folders Local Roaming Temp Removable Storage (SD Card) Cloud Credential Locker B/ground Transfer Publishers Shared Folder.
1 Low Level ADO.NET Operations II Microsoft Visual C# 2008 Step by Step Chapter 25.
Exploring Mobile Device Networking Lesson 4. Exam Objective Matrix Skills/ConceptsMTA Exam Objectives Understanding Networking for Mobile Devices Network.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
JavaScript, Sixth Edition Chapter 11 Updating Web Pages with Ajax.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED INTERSTAGE BPM API DEVELOPMENT.
© 2014 IBM Corporation Mobile Customization & Administration IBM Connections 5.0 Workshop Author: Paul Godby IBM Ecosystem Development Duration: 30 minutes.
Exploring Networked Data and Data Stores Lesson 3.
Data in Windows 10 UWP Andy Wigley XML, JSON, SQLite or EF Core ?
Vaughan Knight App Ecosystem Lead Microsoft FileOpenPicke r, FileSavePicker Read/Write access to SD card Appointments /Calendar API enhancements Appointments.
Yochay Kiriaty Senior Technical Evangelist Microsoft® Corporation
Data Virtualization Tutorial… CORS and CIS
XMLHttp Object.
Customizing your device experience with assigned access
Data Storage, Backup and Roaming
CSE 154 Lecture 22: AJAX.
Tips and tricks for developing Metro style apps using XAML
A Developer's Guide to Windows 10 Andy & Jerry
The 1st International Open Science Conference
Office 365 Development.
Networking, Mobile Services and Authentication
4/9/ | Contracts © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
03 | Async Programming & Networking Intro
Presentation transcript:

“Thanks guys for a great information packed day. head is spinning!” “Well done guys. Intense sessions” “This is the best ever JumpStart that I have attended (seven so far). THANK YOU!”

private async System.Threading.Tasks.Task InsertToDoItem() { IMobileServiceTable TodoTable = App.TaskMasterDemoClient.GetTable (); TodoItem t = new TodoItem(); t.Title = titleTextBox.Text; t.Description = descriptionTextBox.Text; t.DueDate = dueDatePicker.Date.ToString(); t.AssignedTo = assignedToTextBox.Text; try { await TodoTable.InsertAsync(t); } catch (Exception) { /* TODO: Insert error handling code */ } } 13

15

18

WP 8.1 App – PFN RoamingLocalTemp Windows App – PFN RoamingLocalTemp PFN 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

private void name_TextChanged(object sender, TextChangedEventArgs e) { Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings; roamingSettings.Values["userName"] = name.Text; }

Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings; if (roamingSettings.Values.ContainsKey("userName")) { name.Text = roamingSettings.Values["userName"].ToString(); }

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

23

try { // Create the HttpClient HttpClient httpClient = new HttpClient(); // Optionally, define HTTP headers httpClient.DefaultRequestHeaders.Accept.TryParseAdd("application/json"); // Make the call string responseText = await httpClient.GetStringAsync( new Uri(" } catch (Exception ex) {... }

try { var client = new HttpClient(); var uri = new Uri(" var response = await client.GetAsync(uri); // code and results var statusCode = response.StatusCode; // EnsureSuccessStatusCode throws exception if not HTTP 200 response.EnsureSuccessStatusCode(); var responseText = await response.Content.ReadAsStringAsync(); } catch (Exception ex) {... }

try { var client = new HttpClient(); var uri = new Uri(" var response = await client.GetAsync(uri); // display headers foreach (var header in response.Headers) { HeadersText.Text += header.Key + " = " + header.Value + "\n" ; } ResultsText.Text = await response.Content.ReadAsStringAsync(); } catch (Exception ex) {...}

HeaderAccess Acceptread/write collection AcceptEncodingread/write collection AcceptLanguageread/write collection Authorizationread/write CacheControlread/write collection Connectionread/write collection Cookieread/write collection Dateread/write Expectread/write collection Fromread/write Hostread/write IfModifiedSinceread/write IfUnmodifiedSinceread/write MaxForwardsread/write ProxyAuthorizationread/write Refererread/write TransferEncodingread/write collection UserAgentread/write collection

try { var client = new HttpClient(); // we're sending a delete request var request = new HttpRequestMessage(HttpMethod.Delete, uri); // we don't expect a response, but we'll snag it anyway var response = await client.SendRequestAsync(request); // display result code HeadersText.Text = "Status: " + response.StatusCode + "\n"; } catch (Exception ex) { … }

REST / Web Service HttpClient GetAsync GetBufferAsync GetInputStreamAsync GetStringAsync PostAsync PutAsync SendRequestAsync HttpRequestMessage HttpResponseMessage Http Base Protocol Filter Has in-depth settings HttpContent String Stream Buffer Multipart FormUrlEncoded Your code This is also a filter

HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter(); // When AutomaticDecompression is true (the default), the Accept-Encoding header is added // to the headers and set to allow gzip and compress filter.AutomaticDecompression = true; PasswordCredential creds = new PasswordCredential("JumpStart", userName, password); filter.ServerCredential = creds; filter.ProxyCredential = creds; // Create the HttpClient HttpClient httpClient = new HttpClient(filter); // Make the call string responseText = await httpClient.GetStringAsync(uri);...

Mobile devices are often connected to poor quality network connections Best chance of success in network data transfers achieved by: Keep data volumes as small as possible Use the most compact data serialization available (use JSON instead of XML) Avoid large data transfers Avoid transferring redundant data Design your protocol to only transfer precisely the data you need and no more

Wire Serialization FormatSize in Bytes ODATA XML73786 ODATA JSON34030 JSON ‘Lite’15540 JSON ‘Lite’ GZip8680

41 private bool IsOnWiFi() { ConnectionProfile InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); if (internetConnectionProfile == null) return false; return InternetConnectionProfile.IsWlanConnectionProfile; } private bool IsConnectedtoDataRoaming() { bool isRoaming = false; ConnectionProfile internetConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); if (internetConnectionProfile != null && internetConnectionProfile.IsWwanConnectionProfile) { ConnectionCost cc = internetConnectionProfile.GetConnectionCost(); isRoaming = cc.Roaming; // See if user is currently roaming } return isRoaming; } private void AddEventHandlers() { // NetworkStatusChanged fires when the network status changes for a connection NetworkInformation.NetworkStatusChanged += OnNetworkStatusChanged; }

42

ConnectionProfile internetConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); if (internetConnectionProfile != null) { if (internetConnectionProfile.IsWlanConnectionProfile) { // connected on WiFi interface; double check it is not a metered WiFi hotspot ConnectionCost cc = internetConnectionProfile.GetConnectionCost(); if ((NetworkCostType.Unknown == cc.NetworkCostType) || (NetworkCostType.Unrestricted == cc.NetworkCostType)) { // assume free network; connect and start streaming content } else if (internetConnectionProfile.IsWwanConnectionProfile) {...

46 else if (InternetConnectionProfile.IsWwanConnectionProfile) { ConnectionCost cc = InternetConnectionProfile.GetConnectionCost(); // check the type of data plan - make sure user is not currently roaming if (!cc.Roaming) { if ((NetworkCostType.Unknown == cc.NetworkCostType) || (NetworkCostType.Unrestricted == cc.NetworkCostType)) { // assume free network; connect and start streaming content } else if (NetworkCostType.Fixed == cc.NetworkCostType) { // make sure user not currently over limit or near limit if ((!cc.OverDataLimit) && (!cc.ApproachingDataLimit)) { // connect and start streaming content }

App A App B

MSA

void SaveCredential(string username, string password) { PasswordVault vault = new PasswordVault(); PasswordCredential cred = new PasswordCredential("MyAppResource", username, password); vault.Add(cred); } IReadOnlyList RetrieveCredential(string resource) { PasswordVault vault = new PasswordVault(); return vault.FindAllByResource(resource); }

Online service 1. Authorization Request (Start URL) 2. Login page 3. Credentials 4. Authorization page 5. User decision 6. Authorization token (Redirect URL) 7. Data access User

Web auth broker Online service 1. Authorization request (Start URL) 2. Login page 3. Credentials 4. Authorization page 5. User decision 6. Authorization token (Redirect URL) WinRT Dialog User Windows Phone 8.1 app 7. Data access App

// Authenticate using WAB async void Authenticate() { WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync( WebAuthenticationOptions.None, startUri, endUri); if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success) { // Parse the returned data to get the token out // token is used in requests to online service GetToken(WebAuthenticationResult.ResponseData); } else { // handle failures (user cancel, HTTP error) } //Initiate authentication using WAB void Authenticate() { WebAuthenticationBroker.AuthenticateAndContinue( startUri, endUri); } { // Code runs on reactivation to handle response from WAB }

protected override async void OnActivated(IActivatedEventArgs args) { if (args is WebAuthenticationBrokerContinuationEventArgs) { Frame rootFrame = Window.Current.Content as Frame; // Do standard logic to create the Frame if necessary and restore state if (rootFrame == null) { rootFrame = new Frame(); SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { try { await SuspensionManager.RestoreAsync(); } catch (SuspensionManagerException) { } } // Place the frame in the current Window. Window.Current.Content = rootFrame; }...

if (rootFrame.Content == null) { if (!rootFrame.Navigate(typeof(MyPageThatDoesAuth))) { throw new Exception("Failed to create target page"); } // Pass the continuation event args to the target page var p = rootFrame.Content as MyPageThatDoesAuth; // ContinuationArgs is a property that we’ve added to MyPageThatDoesAuth p.ContinuationArgs = (WebAuthenticationBrokerContinuationEventArgs)args; // Ensure the current window is active Window.Current.Activate(); }

private WebAuthenticationBrokerContinuationEventArgs _continuationArgs = null; public WebAuthenticationBrokerContinuationEventArgs ContinuationArgs { get { return _continuationArgs; } set { _continuationArgs = value; ContinueWebAuthentication(_continuationArgs); } } public async void ContinueWebAuthentication(WebAuthenticationBrokerContinuationEventArgs args) { WebAuthenticationResult result = args.WebAuthenticationResult; if (result.ResponseStatus == WebAuthenticationStatus.Success) { String outputToken = result.ResponseData.ToString(); await DoSomethingWithTheTokenAsync(outputToken); } else { /* handle failures (user cancel, HTTP error) */ } }

Contoso Authenticate Authorize app Consent Credentials pre-populated if any app previously authenticated to this provider

Picture Contact cards URLs Videos Transit passes Enterprise access control Mobile Payments (Credit/debit cards etc)

Familiarity & Extensibility

as above, or… --> You cannot modify the Bluetooth GATT device capability using the Manifest editor in Microsoft Visual Studio. You must right-click the Package.appxmanifest file in Solution Explorer and select Open With..., and then XML (Text) Editor.

async void Initialize() { var themometerServices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync( GattDeviceService.GetDeviceSelectorFromUuid( GattServiceUuids.HealthThermometer), null); GattDeviceService firstThermometerService = await GattDeviceService.FromIdAsync(themometerServices[0].Id); Debug.WriteLine("Using service: " + themometerServices[0].Name); GattCharacteristic thermometerCharacteristic = firstThermometerService.GetCharacteristics(GattCharacteristicUuids.TemperatureMeasurement)[0]; thermometerCharacteristic.ValueChanged += temperatureMeasurementChanged; await thermometerCharacteristic.WriteClientCharacteristicConfigurationDescriptorAsync( GattClientCharacteristicConfigurationDescriptorValue.Notify); }

void temperatureMeasurementChanged(GattCharacteristic sender, GattValueChangedEventArgs eventArgs) { byte[] temperatureData = new byte[eventArgs.CharacteristicValue.Length]; Windows.Storage.Streams.DataReader.FromBuffer(eventArgs.CharacteristicValue).ReadBytes(temperatureData); var temperatureValue = convertTemperatureData(temperatureData); temperatureTextBlock.Text = temperatureValue.ToString(); } double convertTemperatureData(byte[] temperatureData) { // Read temperature data in IEEE floating point format // temperatureData[0] contains flags about optional data - not used UInt32 mantissa = ((UInt32)temperatureData[3] << 16) | ((UInt32)temperatureData[2] << 8) | ((UInt32)temperatureData[1]); Int32 exponent = (Int32)temperatureData[4]; return mantissa * Math.Pow(10.0, exponent); }