WinRT and the Web: Keeping Windows Store Apps Alive and Connected

Jeremy Likness
Jeremy LiknessSr. Cloud Developer Advocate at Microsoft
Consulting/Training
WinRT and the Web: Keeping
Windows Store Apps Alive and
Connected
Consulting/Training
consulting
Wintellect helps you build better software,
faster, tackling the tough projects and solving
the software and technology questions that
help you transform your business.
 Architecture, Analysis and Design
 Full lifecycle software development
 Debugging and Performance tuning
 Database design and development
training
Wintellect's courses are written and taught by
some of the biggest and most respected names
in the Microsoft programming industry.
 Learn from the best. Access the same
training Microsoft’s developers enjoy
 Real world knowledge and solutions on
both current and cutting edge
technologies
 Flexibility in training options – onsite,
virtual, on demand
Founded by top experts on Microsoft – Jeffrey Richter, Jeff Prosise, and John Robbins – we pull
out all the stops to help our customers achieve their goals through advanced software-based
consulting and training solutions.
who we are
About Wintellect
Consulting/Training
Building Windows 8 Apps
http://bit.ly/win8design
“Getting Started Guide”
For the more in depth
“experts guide” wait for
WinRT by Example in
early 2014
Consulting/Training
 WinRT and .NET (and a note about Windows 8.1)
 WebView
 Simple: HTTP (REST)
 OData (WCF Data Services)
 Syndication
 SOAP
 WAMS
Agenda
Consulting/Training
 Most .NET network classes are
available to WinRT
 Some are being moved into WinRT (i.e.
the HttpClient)
 Others are proxies and generate pure
.NET code as a function of the IDE
 We’ll focus on C# but the WinRT
components are valid for C++ and
JavaScript too
WinRT and .NET
Consulting/Training
 Internet Explorer 10 (11 in 8.1) control
 In 8.1 it uses a Direct Composition surface
so it can be translated/transformed and
overlaid, in 8.0 – er, ouch, wait for 8.1
 Capable of rendering SVG and in 8.1
WebGL
 Interoperability with the Windows Store
app (can call to scripts on the page and
vice versa)
 Navigation methods (history, journal)
built-in
WebView Control
Consulting/Training
this.WebViewControl.Navigate(new Uri(JeremyBlog));
this.WebViewControl.Navigate(new
Uri("ms-appx-web:///Data/Ellipse.html"));
// can also navigate to streams with a special URI handler in 8.1
this.WebViewControl.NavigateToString(HtmlFragment);
var parameters = new[] { "p/biography.html" };
this.WebViewControl.InvokeScript(
"superSecretBiographyFunction",
parameters);
WebView Control
Consulting/Training
The Embedded Browser: Using WebView
Consulting/Training
 .NET for 8.0, WinRT for 8.1
 Pure control over HTTP
 Viable for REST i.e. serialize/deserialize
directly from JSON and/or XML
 Control headers and manage response
as text, stream, etc.
 GET, POST, PUT, and DELETE
 Using HttpRequestMessage for custom
verbs, etc.
 Base class for more specialized clients
HttpClient
Consulting/Training
private static readonly MediaTypeWithQualityHeaderValue Json = new
MediaTypeWithQualityHeaderValue("application/json");
string jsonResponse;
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(Json);
jsonResponse = await client.GetStringAsync(productsUri);
}
var json = JsonObject.Parse(jsonResponse);
HttpClient (and a little JSON help)
Consulting/Training
Parsing a REST service with HttpClient and JSON
Consulting/Training
 http://msdn.microsoft.com/en-
us/jj658961
 Add-on for Visual Studio 2012
 Allows right-click and add
reference for service
 Generates the proxy and
structures using a data context
(similar to Entity Framework /
WCF RIA)
OData (WCF Services)
Consulting/Training
OData (WCF Data Services)
Consulting/Training
ServiceBase = new Uri("http://services.odata.org/OData/OData.svc",
UriKind.Absolute);
var client = new ODataService.DemoService(ServiceBase);
var categoryQuery = client.Categories.AddQueryOption("$expand",
"Products");
var categories = await Task<IEnumerable<ODataService.Category>>
.Factory.FromAsync(
categoryQuery.BeginExecute(result => { }, client),
categoryQuery.EndExecute);
OData Client Proxy
Consulting/Training
Connecting to OData using WCF Data Services
Consulting/Training
 WinRT (mirrors the .NET equivalent
very closely)
 Parses Atom and RSS
 Suitable for both consuming and
publishing
 Also capable of converting
between formats (i.e. read an Atom
and serve an RSS)
Syndication (Atom/RSS)
Consulting/Training
private static readonly Uri CSharperImageUri = new Uri(
"http://feeds.feedburner.com/CSharperImage/", UriKind.Absolute);
var client = new SyndicationClient();
var feed = await client.RetrieveFeedAsync(CSharperImageUri);
var group = new DataFeed(feed.Id, feed.Title.Text, AuthorSignature,
feed.ImageUri.ToString(), feed.Subtitle.Text);
from item in feed.Items
let content =
Windows.Data.Html.HtmlUtilities.ConvertToText(item.Content.Text)
let summary = string.Format("{0} ...", content.Length > 255 ?
content.Substring(0, 255) : content)
Feed Syndication
Consulting/Training
Syndicating a Feed
Consulting/Training
 IDE provides similar interface to OData
 Uses WSDL to understand the shape of the service
 Considered a more complicated protocol but is
very widely used and has built-in security,
encryption, and other features that are beneficial
to the enterprise
 Generates a proxy (client) that is used to handle
the communications (RPC-based)
 Can also use channel factories to create clients
SOAP
Consulting/Training
SOAP
Consulting/Training
var proxy = new WeatherSoapClient();
var result = await proxy.GetWeatherInformationAsync();
foreach (var item in result.GetWeatherInformationResult)
{
this.weather.Add(item);
}
SOAP Proxy (Generated Client)
Consulting/Training
using (
var factory = new ChannelFactory<WeatherSoapChannel>(
new BasicHttpBinding(), new
EndpointAddress("http://wsf.cdyne.com/WeatherWS/Weather.asmx")))
{
var channel = factory.CreateChannel();
var forecast = await channel.GetCityForecastByZIPAsync(zipCode);
var result = forecast.AsWeatherForecast();
foreach (var day in result.Forecast)
{
day.ForecastUri = await this.GetImageUriForType(day.TypeId);
}
return result;
}
SOAP Proxy (Channel Factory)
Consulting/Training
Connecting to SOAP-based Web Services
Consulting/Training
 Affectionately referred to as WAMS
 Sample project generated by site; in Windows
8.1 it is literally right-click and “add Windows
Push Notification Service”
 Create simple CRUD and other types of services
using hosted SQL
 Create push notifications for live updates and
notifications within your app
Windows Azure Mobile Services
Consulting/Training
Windows Azure Mobile Services
Consulting/Training
Windows Azure Mobile Services
Consulting/Training
public static MobileServiceClient MobileService =
new MobileServiceClient(
"https://winrtbyexample.azure-mobile.net/",
"ThisIsASecretAndWillLookDifferentForYou"
);
private IMobileServiceTable<TodoItem> todoTable
= App.MobileService.GetTable<TodoItem>();
var results = await todoTable
.Where(todoItem => todoItem.Complete == false)
.ToListAsync();
items = new ObservableCollection<TodoItem>(results);
ListItems.ItemsSource = items;
Windows Azure Mobile Services
Consulting/Training
Tiles and Notifications
Consulting/Training
 WebView
 Simple: HTTP (REST)
 OData (WCF Data Services)
 Syndication
 SOAP
 WAMS
 Tiles and Notifications
 All source code:
http://winrtexamples.codeplex.com
Recap
Consulting/Training
Subscribers Enjoy
 Expert Instructors
 Quality Content
 Practical Application
 All Devices
Wintellect’s On-Demand
Video Training Solution
Individuals | Businesses | Enterprise Organizations
WintellectNOW.com
Authors Enjoy
 Royalty Income
 Personal Branding
 Free Library Access
 Cross-Sell
Opportunities
Try It Free!
Use Promo Code:
LIKNESS-13
Consulting/Training
Questions?
jlikness@Wintellect.com
1 of 31

Recommended

The Windows Runtime and the Web by
The Windows Runtime and the WebThe Windows Runtime and the Web
The Windows Runtime and the WebJeremy Likness
2.6K views37 slides
PHP Frameworks and CodeIgniter by
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterKHALID C
2.8K views53 slides
ASP .NET MVC Introduction & Guidelines by
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines Dev Raj Gautam
1.2K views31 slides
My XML is Alive! An Intro to XAML by
My XML is Alive! An Intro to XAMLMy XML is Alive! An Intro to XAML
My XML is Alive! An Intro to XAMLJeremy Likness
3K views32 slides
MSDN - ASP.NET MVC by
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVCMaarten Balliauw
6K views26 slides
ASP.NET MVC Presentation by
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC PresentationVolkan Uzun
5.4K views34 slides

More Related Content

What's hot

Introduction to ASP.NET MVC by
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVCLearnNowOnline
1.5K views112 slides
Mvc4 by
Mvc4Mvc4
Mvc4Muhammad Younis
8.5K views282 slides
Build Apps Using Dynamic Languages by
Build Apps Using Dynamic LanguagesBuild Apps Using Dynamic Languages
Build Apps Using Dynamic LanguagesWes Yanaga
347 views46 slides
Cakephp by
CakephpCakephp
CakephpLy Channa
576 views11 slides
ASP.NET MVC. by
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.Ni
1.1K views12 slides
Integrated Proposal (Vsts Sps Tfs) - MS stack by
Integrated Proposal   (Vsts Sps Tfs) - MS stackIntegrated Proposal   (Vsts Sps Tfs) - MS stack
Integrated Proposal (Vsts Sps Tfs) - MS stackBijoy Viswanadhan
1.8K views34 slides

What's hot(18)

Introduction to ASP.NET MVC by LearnNowOnline
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
LearnNowOnline1.5K views
Build Apps Using Dynamic Languages by Wes Yanaga
Build Apps Using Dynamic LanguagesBuild Apps Using Dynamic Languages
Build Apps Using Dynamic Languages
Wes Yanaga347 views
ASP.NET MVC. by Ni
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni 1.1K views
Integrated Proposal (Vsts Sps Tfs) - MS stack by Bijoy Viswanadhan
Integrated Proposal   (Vsts Sps Tfs) - MS stackIntegrated Proposal   (Vsts Sps Tfs) - MS stack
Integrated Proposal (Vsts Sps Tfs) - MS stack
Bijoy Viswanadhan1.8K views
ASP.NET MVC 3 by Buu Nguyen
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
Buu Nguyen6.2K views
Membangun Moderen UI dengan Vue.js by Froyo Framework
Membangun Moderen UI dengan Vue.jsMembangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.js
Froyo Framework157 views
Spring - Part 4 - Spring MVC by Hitesh-Java
Spring - Part 4 - Spring MVCSpring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVC
Hitesh-Java738 views
Best Practices for JSF, Gameduell 2013 by Edward Burns
Best Practices for JSF, Gameduell 2013Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013
Edward Burns4.9K views
Codeigniter Introduction by Ashfan Ahamed
Codeigniter IntroductionCodeigniter Introduction
Codeigniter Introduction
Ashfan Ahamed829 views
Introduction To CodeIgniter by schwebbie
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
schwebbie12K views

Viewers also liked

Janata july 5 2015 by
Janata july 5 2015Janata july 5 2015
Janata july 5 2015VIBHUTI PATEL
539 views16 slides
Home heating Energy Saving Ideas by
Home heating Energy Saving IdeasHome heating Energy Saving Ideas
Home heating Energy Saving IdeasPurchase.ie
550 views13 slides
Vow vioces of women 15 march 2015 by
Vow vioces of women 15 march 2015Vow vioces of women 15 march 2015
Vow vioces of women 15 march 2015VIBHUTI PATEL
500 views4 slides
Web security by
Web securityWeb security
Web securityJin Castor
542 views41 slides
Pricing and Marketing for Freelancers - How to? by
Pricing and Marketing for Freelancers - How to?Pricing and Marketing for Freelancers - How to?
Pricing and Marketing for Freelancers - How to?Brian Hogg
439 views21 slides
Vibhuti patel on a long battle for girl child epw 21 5-2001 by
Vibhuti patel on a long battle for girl child epw 21 5-2001Vibhuti patel on a long battle for girl child epw 21 5-2001
Vibhuti patel on a long battle for girl child epw 21 5-2001VIBHUTI PATEL
962 views3 slides

Viewers also liked(16)

Home heating Energy Saving Ideas by Purchase.ie
Home heating Energy Saving IdeasHome heating Energy Saving Ideas
Home heating Energy Saving Ideas
Purchase.ie550 views
Vow vioces of women 15 march 2015 by VIBHUTI PATEL
Vow vioces of women 15 march 2015Vow vioces of women 15 march 2015
Vow vioces of women 15 march 2015
VIBHUTI PATEL500 views
Web security by Jin Castor
Web securityWeb security
Web security
Jin Castor542 views
Pricing and Marketing for Freelancers - How to? by Brian Hogg
Pricing and Marketing for Freelancers - How to?Pricing and Marketing for Freelancers - How to?
Pricing and Marketing for Freelancers - How to?
Brian Hogg439 views
Vibhuti patel on a long battle for girl child epw 21 5-2001 by VIBHUTI PATEL
Vibhuti patel on a long battle for girl child epw 21 5-2001Vibhuti patel on a long battle for girl child epw 21 5-2001
Vibhuti patel on a long battle for girl child epw 21 5-2001
VIBHUTI PATEL962 views
Sterling for Windows Phone 7 by Jeremy Likness
Sterling for Windows Phone 7Sterling for Windows Phone 7
Sterling for Windows Phone 7
Jeremy Likness751 views
Union Budget 2015 16 through Gender Lens by Prof. Vibuti Patel 8-3-2015 esoci... by VIBHUTI PATEL
Union Budget 2015 16 through Gender Lens by Prof. Vibuti Patel 8-3-2015 esoci...Union Budget 2015 16 through Gender Lens by Prof. Vibuti Patel 8-3-2015 esoci...
Union Budget 2015 16 through Gender Lens by Prof. Vibuti Patel 8-3-2015 esoci...
VIBHUTI PATEL336 views
Success with informational texts.pptx by jsmalcolm
Success with informational texts.pptxSuccess with informational texts.pptx
Success with informational texts.pptx
jsmalcolm437 views
2012 Profession Portfolio of Allen J Cochran by Allen Cochran
2012 Profession Portfolio of Allen J Cochran2012 Profession Portfolio of Allen J Cochran
2012 Profession Portfolio of Allen J Cochran
Allen Cochran418 views
Intro to inbound marketing by Gaël Breton
Intro to inbound marketingIntro to inbound marketing
Intro to inbound marketing
Gaël Breton409 views
Women related issues and gender budgeting in ul bs 14 7-2015 by VIBHUTI PATEL
Women related issues and gender budgeting in ul bs  14 7-2015Women related issues and gender budgeting in ul bs  14 7-2015
Women related issues and gender budgeting in ul bs 14 7-2015
VIBHUTI PATEL425 views
OpenSpan for HealthCare: Four Member Service Representative Readiness Strateg... by Frank Wagman
OpenSpan for HealthCare: Four Member Service Representative Readiness Strateg...OpenSpan for HealthCare: Four Member Service Representative Readiness Strateg...
OpenSpan for HealthCare: Four Member Service Representative Readiness Strateg...
Frank Wagman786 views
Surviving Financial Distress1 by mwerling
Surviving Financial Distress1Surviving Financial Distress1
Surviving Financial Distress1
mwerling308 views

Similar to WinRT and the Web: Keeping Windows Store Apps Alive and Connected

Angular JS Basics by
Angular JS BasicsAngular JS Basics
Angular JS BasicsMounish Sai
115 views67 slides
Vijay Oscon by
Vijay OsconVijay Oscon
Vijay Osconvijayrvr
380 views36 slides
Tech Lead-Sachidanand Sharma by
Tech Lead-Sachidanand SharmaTech Lead-Sachidanand Sharma
Tech Lead-Sachidanand SharmaSachidanand Semwal
307 views6 slides
D22 portlet development with open source frameworks by
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworksSunil Patil
1K views68 slides
D22 Portlet Development With Open Source Frameworks by
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksSunil Patil
531 views68 slides
Online test management system by
Online test management systemOnline test management system
Online test management systemPrateek Agarwak
439 views23 slides

Similar to WinRT and the Web: Keeping Windows Store Apps Alive and Connected(20)

Angular JS Basics by Mounish Sai
Angular JS BasicsAngular JS Basics
Angular JS Basics
Mounish Sai115 views
Vijay Oscon by vijayrvr
Vijay OsconVijay Oscon
Vijay Oscon
vijayrvr380 views
D22 portlet development with open source frameworks by Sunil Patil
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
Sunil Patil1K views
D22 Portlet Development With Open Source Frameworks by Sunil Patil
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
Sunil Patil531 views
ASP.NET Presentation by Rasel Khan
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
Rasel Khan2.5K views
Web development concepts using microsoft technologies by Hosam Kamel
Web development concepts using microsoft technologiesWeb development concepts using microsoft technologies
Web development concepts using microsoft technologies
Hosam Kamel3.1K views
2014 q3-platform-update-v1.06.johnmathon by aaronwso2
2014 q3-platform-update-v1.06.johnmathon2014 q3-platform-update-v1.06.johnmathon
2014 q3-platform-update-v1.06.johnmathon
aaronwso2417 views
Actively looking for an opportunity to work as a challenging Dot Net Developer by Karthik Reddy
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
Karthik Reddy247 views
Actively looking for an opportunity to work as a challenging Dot Net Developer by Karthik Reddy
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
Karthik Reddy464 views
Chris Durkin Resume - Expert .NET Consultant 18 years experience by Chris Durkin
Chris Durkin Resume - Expert .NET Consultant 18 years experienceChris Durkin Resume - Expert .NET Consultant 18 years experience
Chris Durkin Resume - Expert .NET Consultant 18 years experience
Chris Durkin4.9K views
Software Development Life Cycle by Amber Carter
Software Development Life CycleSoftware Development Life Cycle
Software Development Life Cycle
Amber Carter3 views
Web API or WCF - An Architectural Comparison by Adnan Masood
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
Adnan Masood56.8K views
vCenter Orchestrator APIs by Pablo Roesch
vCenter Orchestrator APIsvCenter Orchestrator APIs
vCenter Orchestrator APIs
Pablo Roesch5.5K views
ASP.NET AJAX with Visual Studio 2008 by Caleb Jenkins
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008
Caleb Jenkins3.1K views
Satendra Gupta Sr DotNet Consultant by SATENDRA GUPTA
Satendra Gupta Sr  DotNet ConsultantSatendra Gupta Sr  DotNet Consultant
Satendra Gupta Sr DotNet Consultant
SATENDRA GUPTA236 views
Walther Aspnet4 by rsnarayanan
Walther Aspnet4Walther Aspnet4
Walther Aspnet4
rsnarayanan1.9K views

Recently uploaded

Evolving the Network Automation Journey from Python to Platforms by
Evolving the Network Automation Journey from Python to PlatformsEvolving the Network Automation Journey from Python to Platforms
Evolving the Network Automation Journey from Python to PlatformsNetwork Automation Forum
13 views21 slides
The details of description: Techniques, tips, and tangents on alternative tex... by
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
127 views24 slides
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf by
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdfDr. Jimmy Schwarzkopf
19 views29 slides
Microsoft Power Platform.pptx by
Microsoft Power Platform.pptxMicrosoft Power Platform.pptx
Microsoft Power Platform.pptxUni Systems S.M.S.A.
53 views38 slides
Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
56 views21 slides
STPI OctaNE CoE Brochure.pdf by
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdfmadhurjyapb
14 views1 slide

Recently uploaded(20)

The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada127 views
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf by Dr. Jimmy Schwarzkopf
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf
STPI OctaNE CoE Brochure.pdf by madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb14 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson85 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi127 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma39 views

WinRT and the Web: Keeping Windows Store Apps Alive and Connected

  • 1. Consulting/Training WinRT and the Web: Keeping Windows Store Apps Alive and Connected
  • 2. Consulting/Training consulting Wintellect helps you build better software, faster, tackling the tough projects and solving the software and technology questions that help you transform your business.  Architecture, Analysis and Design  Full lifecycle software development  Debugging and Performance tuning  Database design and development training Wintellect's courses are written and taught by some of the biggest and most respected names in the Microsoft programming industry.  Learn from the best. Access the same training Microsoft’s developers enjoy  Real world knowledge and solutions on both current and cutting edge technologies  Flexibility in training options – onsite, virtual, on demand Founded by top experts on Microsoft – Jeffrey Richter, Jeff Prosise, and John Robbins – we pull out all the stops to help our customers achieve their goals through advanced software-based consulting and training solutions. who we are About Wintellect
  • 3. Consulting/Training Building Windows 8 Apps http://bit.ly/win8design “Getting Started Guide” For the more in depth “experts guide” wait for WinRT by Example in early 2014
  • 4. Consulting/Training  WinRT and .NET (and a note about Windows 8.1)  WebView  Simple: HTTP (REST)  OData (WCF Data Services)  Syndication  SOAP  WAMS Agenda
  • 5. Consulting/Training  Most .NET network classes are available to WinRT  Some are being moved into WinRT (i.e. the HttpClient)  Others are proxies and generate pure .NET code as a function of the IDE  We’ll focus on C# but the WinRT components are valid for C++ and JavaScript too WinRT and .NET
  • 6. Consulting/Training  Internet Explorer 10 (11 in 8.1) control  In 8.1 it uses a Direct Composition surface so it can be translated/transformed and overlaid, in 8.0 – er, ouch, wait for 8.1  Capable of rendering SVG and in 8.1 WebGL  Interoperability with the Windows Store app (can call to scripts on the page and vice versa)  Navigation methods (history, journal) built-in WebView Control
  • 7. Consulting/Training this.WebViewControl.Navigate(new Uri(JeremyBlog)); this.WebViewControl.Navigate(new Uri("ms-appx-web:///Data/Ellipse.html")); // can also navigate to streams with a special URI handler in 8.1 this.WebViewControl.NavigateToString(HtmlFragment); var parameters = new[] { "p/biography.html" }; this.WebViewControl.InvokeScript( "superSecretBiographyFunction", parameters); WebView Control
  • 9. Consulting/Training  .NET for 8.0, WinRT for 8.1  Pure control over HTTP  Viable for REST i.e. serialize/deserialize directly from JSON and/or XML  Control headers and manage response as text, stream, etc.  GET, POST, PUT, and DELETE  Using HttpRequestMessage for custom verbs, etc.  Base class for more specialized clients HttpClient
  • 10. Consulting/Training private static readonly MediaTypeWithQualityHeaderValue Json = new MediaTypeWithQualityHeaderValue("application/json"); string jsonResponse; using (var client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Add(Json); jsonResponse = await client.GetStringAsync(productsUri); } var json = JsonObject.Parse(jsonResponse); HttpClient (and a little JSON help)
  • 11. Consulting/Training Parsing a REST service with HttpClient and JSON
  • 12. Consulting/Training  http://msdn.microsoft.com/en- us/jj658961  Add-on for Visual Studio 2012  Allows right-click and add reference for service  Generates the proxy and structures using a data context (similar to Entity Framework / WCF RIA) OData (WCF Services)
  • 14. Consulting/Training ServiceBase = new Uri("http://services.odata.org/OData/OData.svc", UriKind.Absolute); var client = new ODataService.DemoService(ServiceBase); var categoryQuery = client.Categories.AddQueryOption("$expand", "Products"); var categories = await Task<IEnumerable<ODataService.Category>> .Factory.FromAsync( categoryQuery.BeginExecute(result => { }, client), categoryQuery.EndExecute); OData Client Proxy
  • 15. Consulting/Training Connecting to OData using WCF Data Services
  • 16. Consulting/Training  WinRT (mirrors the .NET equivalent very closely)  Parses Atom and RSS  Suitable for both consuming and publishing  Also capable of converting between formats (i.e. read an Atom and serve an RSS) Syndication (Atom/RSS)
  • 17. Consulting/Training private static readonly Uri CSharperImageUri = new Uri( "http://feeds.feedburner.com/CSharperImage/", UriKind.Absolute); var client = new SyndicationClient(); var feed = await client.RetrieveFeedAsync(CSharperImageUri); var group = new DataFeed(feed.Id, feed.Title.Text, AuthorSignature, feed.ImageUri.ToString(), feed.Subtitle.Text); from item in feed.Items let content = Windows.Data.Html.HtmlUtilities.ConvertToText(item.Content.Text) let summary = string.Format("{0} ...", content.Length > 255 ? content.Substring(0, 255) : content) Feed Syndication
  • 19. Consulting/Training  IDE provides similar interface to OData  Uses WSDL to understand the shape of the service  Considered a more complicated protocol but is very widely used and has built-in security, encryption, and other features that are beneficial to the enterprise  Generates a proxy (client) that is used to handle the communications (RPC-based)  Can also use channel factories to create clients SOAP
  • 21. Consulting/Training var proxy = new WeatherSoapClient(); var result = await proxy.GetWeatherInformationAsync(); foreach (var item in result.GetWeatherInformationResult) { this.weather.Add(item); } SOAP Proxy (Generated Client)
  • 22. Consulting/Training using ( var factory = new ChannelFactory<WeatherSoapChannel>( new BasicHttpBinding(), new EndpointAddress("http://wsf.cdyne.com/WeatherWS/Weather.asmx"))) { var channel = factory.CreateChannel(); var forecast = await channel.GetCityForecastByZIPAsync(zipCode); var result = forecast.AsWeatherForecast(); foreach (var day in result.Forecast) { day.ForecastUri = await this.GetImageUriForType(day.TypeId); } return result; } SOAP Proxy (Channel Factory)
  • 24. Consulting/Training  Affectionately referred to as WAMS  Sample project generated by site; in Windows 8.1 it is literally right-click and “add Windows Push Notification Service”  Create simple CRUD and other types of services using hosted SQL  Create push notifications for live updates and notifications within your app Windows Azure Mobile Services
  • 27. Consulting/Training public static MobileServiceClient MobileService = new MobileServiceClient( "https://winrtbyexample.azure-mobile.net/", "ThisIsASecretAndWillLookDifferentForYou" ); private IMobileServiceTable<TodoItem> todoTable = App.MobileService.GetTable<TodoItem>(); var results = await todoTable .Where(todoItem => todoItem.Complete == false) .ToListAsync(); items = new ObservableCollection<TodoItem>(results); ListItems.ItemsSource = items; Windows Azure Mobile Services
  • 29. Consulting/Training  WebView  Simple: HTTP (REST)  OData (WCF Data Services)  Syndication  SOAP  WAMS  Tiles and Notifications  All source code: http://winrtexamples.codeplex.com Recap
  • 30. Consulting/Training Subscribers Enjoy  Expert Instructors  Quality Content  Practical Application  All Devices Wintellect’s On-Demand Video Training Solution Individuals | Businesses | Enterprise Organizations WintellectNOW.com Authors Enjoy  Royalty Income  Personal Branding  Free Library Access  Cross-Sell Opportunities Try It Free! Use Promo Code: LIKNESS-13

Editor's Notes

  1. Author Opportunity Passive incomeClear marketing commitments to help grow your personal brand and your coursesInternational presence &amp; exposureCross sell opportunities – instructor led classes, consulting opportunities, and conference speaking opportunitiesOpportunity to be the subject matter expert and to carve out a niche for yourself in this new businessAssociation with Wintellect