SlideShare une entreprise Scribd logo
1  sur  31
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

Contenu connexe

Tendances

Tendances (18)

Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Mvc4
Mvc4Mvc4
Mvc4
 
Build Apps Using Dynamic Languages
Build Apps Using Dynamic LanguagesBuild Apps Using Dynamic Languages
Build Apps Using Dynamic Languages
 
Cakephp
CakephpCakephp
Cakephp
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
 
Integrated Proposal (Vsts Sps Tfs) - MS stack
Integrated Proposal   (Vsts Sps Tfs) - MS stackIntegrated Proposal   (Vsts Sps Tfs) - MS stack
Integrated Proposal (Vsts Sps Tfs) - MS stack
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
Jsf
JsfJsf
Jsf
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Weblogic deployment
Weblogic deploymentWeblogic deployment
Weblogic deployment
 
SP2010 Developer Tools
SP2010 Developer ToolsSP2010 Developer Tools
SP2010 Developer Tools
 
Membangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.jsMembangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.js
 
Spring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVCSpring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVC
 
Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013
 
Development Session
Development SessionDevelopment Session
Development Session
 
Codeigniter Introduction
Codeigniter IntroductionCodeigniter Introduction
Codeigniter Introduction
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
Spring Framework -I
Spring Framework -ISpring Framework -I
Spring Framework -I
 

En vedette

Vow vioces of women 15 march 2015
Vow vioces of women 15 march 2015Vow vioces of women 15 march 2015
Vow vioces of women 15 march 2015
VIBHUTI PATEL
 
Pricing and Marketing for Freelancers - How to?
Pricing and Marketing for Freelancers - How to?Pricing and Marketing for Freelancers - How to?
Pricing and Marketing for Freelancers - How to?
Brian Hogg
 
Success with informational texts.pptx
Success with informational texts.pptxSuccess with informational texts.pptx
Success with informational texts.pptx
jsmalcolm
 
2012 Profession Portfolio of Allen J Cochran
2012 Profession Portfolio of Allen J Cochran2012 Profession Portfolio of Allen J Cochran
2012 Profession Portfolio of Allen J Cochran
Allen Cochran
 
Intro to inbound marketing
Intro to inbound marketingIntro to inbound marketing
Intro to inbound marketing
Gaël Breton
 
Women related issues and gender budgeting in ul bs 14 7-2015
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 PATEL
 

En vedette (16)

Janata july 5 2015
Janata july 5 2015Janata july 5 2015
Janata july 5 2015
 
Home heating Energy Saving Ideas
Home heating Energy Saving IdeasHome heating Energy Saving Ideas
Home heating Energy Saving Ideas
 
Vow vioces of women 15 march 2015
Vow vioces of women 15 march 2015Vow vioces of women 15 march 2015
Vow vioces of women 15 march 2015
 
Web security
Web securityWeb security
Web security
 
Pricing and Marketing for Freelancers - How to?
Pricing and Marketing for Freelancers - How to?Pricing and Marketing for Freelancers - How to?
Pricing and Marketing for Freelancers - How to?
 
Vibhuti 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 on a long battle for girl child epw 21 5-2001
Vibhuti patel on a long battle for girl child epw 21 5-2001
 
WORLD WATCH 2013 - check in now.
WORLD WATCH 2013 - check in now.WORLD WATCH 2013 - check in now.
WORLD WATCH 2013 - check in now.
 
Gee reception
Gee receptionGee reception
Gee reception
 
Sterling for Windows Phone 7
Sterling for Windows Phone 7Sterling for Windows Phone 7
Sterling for Windows Phone 7
 
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...
Union Budget 2015 16 through Gender Lens by Prof. Vibuti Patel 8-3-2015 esoci...
 
Success with informational texts.pptx
Success with informational texts.pptxSuccess with informational texts.pptx
Success with informational texts.pptx
 
2012 Profession Portfolio of Allen J Cochran
2012 Profession Portfolio of Allen J Cochran2012 Profession Portfolio of Allen J Cochran
2012 Profession Portfolio of Allen J Cochran
 
Intro to inbound marketing
Intro to inbound marketingIntro to inbound marketing
Intro to inbound marketing
 
Women related issues and gender budgeting in ul bs 14 7-2015
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
 
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...
OpenSpan for HealthCare: Four Member Service Representative Readiness Strateg...
 
Surviving Financial Distress1
Surviving Financial Distress1Surviving Financial Distress1
Surviving Financial Distress1
 

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

D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
Sunil Patil
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
Sunil Patil
 
Satendra Gupta Sr DotNet Consultant
Satendra Gupta Sr  DotNet ConsultantSatendra Gupta Sr  DotNet Consultant
Satendra Gupta Sr DotNet Consultant
SATENDRA GUPTA
 

Similaire à WinRT and the Web: Keeping Windows Store Apps Alive and Connected (20)

Angular JS Basics
Angular JS BasicsAngular JS Basics
Angular JS Basics
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Oscon
 
Tech Lead-Sachidanand Sharma
Tech Lead-Sachidanand SharmaTech Lead-Sachidanand Sharma
Tech Lead-Sachidanand Sharma
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
 
Online test management system
Online test management systemOnline test management system
Online test management system
 
Getting Started with API Management
Getting Started with API ManagementGetting Started with API Management
Getting Started with API Management
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
Web development concepts using microsoft technologies
Web development concepts using microsoft technologiesWeb development concepts using microsoft technologies
Web development concepts using microsoft technologies
 
2014 q3-platform-update-v1.06.johnmathon
2014 q3-platform-update-v1.06.johnmathon2014 q3-platform-update-v1.06.johnmathon
2014 q3-platform-update-v1.06.johnmathon
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
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
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
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
 
ASP.NET OVERVIEW
ASP.NET OVERVIEWASP.NET OVERVIEW
ASP.NET OVERVIEW
 
Chris Durkin Resume - Expert .NET Consultant 18 years experience
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
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
 
vCenter Orchestrator APIs
vCenter Orchestrator APIsvCenter Orchestrator APIs
vCenter Orchestrator APIs
 
SeniorNET Bhanu Resume
SeniorNET Bhanu ResumeSeniorNET Bhanu Resume
SeniorNET Bhanu Resume
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008
 
Satendra Gupta Sr DotNet Consultant
Satendra Gupta Sr  DotNet ConsultantSatendra Gupta Sr  DotNet Consultant
Satendra Gupta Sr DotNet Consultant
 
Walther Aspnet4
Walther Aspnet4Walther Aspnet4
Walther Aspnet4
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

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

Notes de l'éditeur

  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