29
Creare applicazioni Windows Store data-centric con C# e XAML Ken Casada Technical Evangelist, Microsoft Switzerland [email protected]

Creare applicazioni Windows Store data-centric con C# e XAML

  • Upload
    angie

  • View
    42

  • Download
    0

Embed Size (px)

DESCRIPTION

Creare applicazioni Windows Store data-centric con C# e XAML. Ken Casada Technical Evangelist, Microsoft Switzerland [email protected]. Line of Business apps. control density data visualization data analysis CRUD for the enterprise business logic n-tier - PowerPoint PPT Presentation

Citation preview

Page 1: Creare applicazioni Windows Store data-centric con C# e XAML

Creare applicazioni Windows Store data-centric con C# e XAML

Ken CasadaTechnical Evangelist, Microsoft [email protected]

Page 2: Creare applicazioni Windows Store data-centric con C# e XAML

data driven

domain specific

existing patterns & frameworks

for the enterprise

control density

data visualization

data analysis CRUD for the enterprise

business logic n-tier

MVVM

test-driven development

Line of Business apps

Page 3: Creare applicazioni Windows Store data-centric con C# e XAML

Demo Intro

Page 4: Creare applicazioni Windows Store data-centric con C# e XAML
Page 5: Creare applicazioni Windows Store data-centric con C# e XAML

Demo

Page 6: Creare applicazioni Windows Store data-centric con C# e XAML

Demo Summary

Working with services to access data No direct communication with server-side DB Communication is done asynchrounous only Task-based methods are available (no blocking calls) No XML config file is being created Configuration done in code

use the ConfigureEndpoint partial method

Your app needs to adapt in order to bring the best possible experience XAML Controls are designed for touch Apps on a table device can resize an re-orient

Page 7: Creare applicazioni Windows Store data-centric con C# e XAML

Services

Windows Store apps supports all kinds of services ASMX WCF REST (JSON/XML) RSS oData services WCF RIA Services support

Page 8: Creare applicazioni Windows Store data-centric con C# e XAML

WCF

Which Bindings are supported? BasicHttpBinding NetTcpBinding NetHttpBinding CustomBinding WSHttpBinding

Documentation: Accessing WCF Services with a Windows Store client app

Page 9: Creare applicazioni Windows Store data-centric con C# e XAML

WCF and Security

Securing the communication… Authentication WinRT supports sending credentials

In case my service requires credentials (server-side code sample)

BasicHttpBinding basicBinding = new

BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);//Using domain credentialsbasicBinding.Security.Transport.ClientCredentialType =

HttpClientCredentialType.Windows;

the generated proxy class will reflect this (have a look at Reference.cs) the default domain credentials will be provided to the service by default (no code required by the developer!!)

Use HTTPS in order to encrypt communication!!!!

Page 10: Creare applicazioni Windows Store data-centric con C# e XAML

REST services

Using HttpClient object It’s an object for sending HTTP Requests / for accessing content from an HTTP Server Works with async Implements HTTP VERBS: Get(Async), Put(Async), Post(Async), Delete(Async) RESTful

Parse the response (XML/JSON) XML

Linq to XML xmlReader/xmlWriter xmlSerializer

JSON Use Objects (like JsonObject) and methods available within namespace Windows.Data.Json DataContractJsonSerializer

Page 11: Creare applicazioni Windows Store data-centric con C# e XAML

HttpClient and Security

In case authentication is required… WinRT supports sending default credentials (domain credentials)

HttpClientHandler handler = new HttpClientHandler();handler.UseDefaultCredentials = true;HttpClient httpclient = new HttpClient(handler);

WinRT supports sending custom credentials

HttpClientHandler handler = new HttpClientHandler();handler.Credentials = new NetworkCredential("username", "pw",

"domain"); HttpClient httpclient = new HttpClient(handler);

Use HTTPS in order to encrypt communication!!!!

Page 12: Creare applicazioni Windows Store data-centric con C# e XAML
Page 13: Creare applicazioni Windows Store data-centric con C# e XAML

Collecting user credentials

CredentialPicker and CredentialPickerOptionsCredentialPickerOptions credentialPickerOptions = new CredentialPickerOptions();credentialPickerOptions.CredentialSaveOption = CredentialSaveOption.Selected;credentialPickerOptions.CallerSavesCredential = false;credentialPickerOptions.AlwaysDisplayDialog = true;credentialPickerOptions.AuthenticationProtocol = AuthenticationProtocol.Basic ;credentialPickerOptions.TargetName = "myTargetComputer";credentialPickerOptions.Message = "Please enter your credentials";

CredentialPickerResults credPickerResults = await CredentialPicker.PickAsync(credentialPickerOptions);

Credential Picker Sample: http://code.msdn.microsoft.com/windowsapps/Credential-picker-sample-30fcba2e

Also have a look at the Credential Locker Sample!!! for storing user credentials!!!

(http://code.msdn.microsoft.com/windowsapps/PasswordVault-f01be74a)

Page 14: Creare applicazioni Windows Store data-centric con C# e XAML

oData Services / WCF Data ServicesBuilds on top of HTTP and REST

Consuming oData Services Download and Install Odata Client Tools for Windows Store apps

http://msdn.microsoft.com/en-us/jj658961 Support for Add Service Reference within Visual Studio 2012

Page 15: Creare applicazioni Windows Store data-centric con C# e XAML

Enterprise Authentication capability

To be used only when your app requires programmatic access!!!

Page 16: Creare applicazioni Windows Store data-centric con C# e XAML

Getting access to data…

Remote database vs Local Database Relational databases should be behind a service

working with services is preferred in most cases!

Local databases for offline or occasionally connected systems no out-of-the-box database built into WinRT (no SQLCE support)

the only option you have is SQLite (using SQLite in Windows Store apps)

the requirements can be satisfied using the Application Data API!!!!!

Windows.Storage.ApplicationData.Current

Tip: https://metrostoragehelper.codeplex.com/ (helper for reading/writing/deleting structured data in Isolated Storage)

Page 17: Creare applicazioni Windows Store data-centric con C# e XAML

Background Transfers

Why? Only 1 single application can run at a time Can be annoying if you want to implement specific scenario (download/upload of a file, …)

How? Managed through separate process: BackgroundTransferHost.exe

Keeps running in the background, also when your app get suspended

Have a look at the BackgroundTransfer API: BackgroundDownloader object BackgroundUploader object

Documentation / Sample

Page 18: Creare applicazioni Windows Store data-centric con C# e XAML

Background Tasks

Lock screen triggers (AC or battery power) UserPresent, UserAway, TimeTrigger

System triggers (AC power, non-lock screen) InternetAvailable, NetworkStateChange for connectivity, …

Maintenance triggers (AC power, non-lock screen) Run periodically on AC power

All taks subject to CPU and networking activity quotas

Being productive in the background

Page 19: Creare applicazioni Windows Store data-centric con C# e XAML

Demo: Background Tasks

Page 20: Creare applicazioni Windows Store data-centric con C# e XAML

In-Box Controls for Windows 8 AppsButton

Checkbox Radio Button

Hyperlink Combo Box

Context Menu

Flyout

List BoxFlip View

App Bar

Panning Indicator

Grid View

List View Semantic Zoom

Text Box

Progress Ring Progress Bar

Clear ButtonSpell Checking

Password Reveal Button

Rating Radio Button

Scroll Bar

Toggle Switch Tooltip

Page 21: Creare applicazioni Windows Store data-centric con C# e XAML

Third Party Controls

Page 22: Creare applicazioni Windows Store data-centric con C# e XAML

Third Party Controls VendorsComponentOne http://apps.microsoft.com/webpdp/app/23b1c950-b54c-4dbd-95d0-db75438cd57f

DevExpress http://apps.microsoft.com/webpdp/app/519d8870-6661-4bd9-9e41-d395c6389b47

Telerik http://apps.microsoft.com/webpdp/app/7cdb9bc0-e3a7-47b5-b6d6-658d88d4125d

Mindscape http://apps.microsoft.com/webpdp/app/c68cfba7-a24a-4ac9-86c3-be10167e8b1d

Perpetuum http://www.perpetuumsoft.com/Windows8-UI-Controls.aspx

Syncfusion https://www.syncfusion.com/products/winrt?src=winrtxamltoolkit

OhZee http://apps.microsoft.com/webpdp/app/34dcb5b8-b54f-4a1b-a79f-8aaa228359c0

Actipro http://apps.microsoft.com/webpdp/app/a36f2163-4d44-4ed9-b19f-d1fe1007c3c6

Page 23: Creare applicazioni Windows Store data-centric con C# e XAML

Demo: Chart controlhttp://modernuitoolkit.codeplex.com/

Page 24: Creare applicazioni Windows Store data-centric con C# e XAML

App deployment

Consumer Business

LOB ISV

Windows Store or Side-loaded

Consumer

Windows Store

B2C

Windows Store

Custom LOB

Side-loaded

Examples

Used by

Distribution

Page 25: Creare applicazioni Windows Store data-centric con C# e XAML

Sideloading step by step

1) The app must be signed with an enterprise code-signing certificate that is trusted by devices.

Where do I get them?

Option 1: purchase from a Public CA (Verisign, Geotrust etc.).Microsoft Root Certificate Program Member List

Option 2: create your own using the company’s Internal CA, who’s Root Certificate is linked to a Public CA (Verisign, Geotrust etc.).

Option 3: create you own using the company’s Internal CA. The devices you are deploying the app to, must have appropriate root certificate installed (company’s internal CA certificate) to be able to trust the code signing certificate (Certificate chain) code-signing certificate is chained to a trusted root certificate!!!

Page 26: Creare applicazioni Windows Store data-centric con C# e XAML

Sideloading step by step

2) Devices must be enabled for sideloading to install and launch apps

How to enable devices for sideloading?

• Windows 8 Enterprise, domain joinedsideloading automatically enabled

(group policy must be set to “Allow trusted apps to install”)

• Windows 8 Enterprise, not domain joinedWindows 8 Prosideloading product activation keyWindows RT

(*) available via Volume Licensing (provided for free if you have Software Assurance)

Page 27: Creare applicazioni Windows Store data-centric con C# e XAML

Resources

Windows store app sampleshttp://code.msdn.microsoft.com/windowsappsDeveloping Windows Store apps: Start Here!http://msdn.microsoft.com/en-us/windows/apps/jj679957Design case study: Enterprise line of business Windows Store apphttp://msdn.microsoft.com/en-us/library/windows/apps/jj659079.aspxEnterprise CA: Active Directory Certificate Services Overview http://technet.microsoft.com/library/hh831740Enterprise CA: Active Directory Certification Authority Guidance http://technet.microsoft.com/en-us/library/hh831574.aspx

Page 28: Creare applicazioni Windows Store data-centric con C# e XAML

Q&A

Page 29: Creare applicazioni Windows Store data-centric con C# e XAML

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a

commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.