SlideShare a Scribd company logo
1 of 45
DllImport "avicap32.dll"            "capCreateCaptureWindow"
static extern int
  string                  int
  int    int    int           int
  int             int

 DllImport "avicap32.dll"
static extern bool
  int
   MarshalAs UnmanagedType          ref string
  int
   MarshalAs UnmanagedType          ref string
  int

// more and more of the same
Manually
Your Managed                   Traditional
                Generated
    Code                      Windows API
               Interop Code
using Windows.Media.Capture;

var         new CameraCaptureUI
                                         new Size

var           await                     CameraCaptureUIMode

if

      var             new BitmapImage
                          await              FileAccessMode
Metro style app
                                                       Language Support
                                                      (CLR, WinJS, CRT)
             Language Projection

               UI       Pickers    Controls   Media
                                                      Web Host (HTML,
                                                      CSS, JavaScript))
 Windows      XAML      Storage    Network     …
Metadata &
Namespace
                     Windows Runtime Core              Runtime Broker


                          Windows Core
Your Managed   Windows
                         Windows 8 API
    Code       Runtime
You already have the skills to build
 Metro style apps with C# and VB
• The relationship between .NET and the Windows
  Runtime
• Using Windows Runtime APIs from C# and Visual
  Basic
• Building Window Runtime Components in C# and
  Visual Basic
C# and Visual Basic influenced
    the Windows Runtime
Using the Windows Runtime
  feels natural and familiar
 from C# and Visual Basic
var         new CameraCaptureUI
                                         new Size

var           await                     CameraCaptureUIMode

if

      var             new BitmapImage
                          await              FileAccessMode
try
{
   var     new CameraCaptureUI
                                 new Size

catch (Exception e)
{
   //Exception handling code
}
                                            ComException
var picker = new FileOpenPicker();
picker.FileTypeFilter.Add("*");
var files = await picker.PickMultipleFilesAsync();
foreach (var file in files)
{
    lbFiles.Items.Add(file.FileName);
}
         PickMultipleFilesOperation PickMultipleFilesAsync();


    public sealed class PickMultipleFilesOperation :
      IAsyncOperation<IReadOnlyList<StorageFile>>, IAsyncInfo
var picker = new FileOpenPicker();
picker.FileTypeFilter.Add("*");
var files = await picker.PickMultipleFilesAsync();
foreach (StorageFile file in files)
{
    lbFiles.Items.Add(file.FileName);
}
                 System.Collections.Generic.IReadOnlyList
                     <Windows.Storage.StorageFile>
var picker = new FileOpenPicker();
picker.FileTypeFilter.Add("*");
var files = await picker.PickMultipleFilesAsync();
foreach (StorageFile file in files)
{
    lbFiles.Items.Add(file.FileName);
}
                 System.Collections.Generic.IReadOnlyList
                 Windows.Foundation.Collections.IVectorView
                     <Windows.Storage.StorageFile>
                     <Windows.Storage.StorageFile>
FileOpenPicker picker = new FileOpenPicker();
picker.FileTypeFilter.Add("*");

StorageFile file = await picker.PickSingleFileAsync();


Windows.Storage.Streams.IInputStream inputStream =
    await file.OpenForReadAsync();


System.IO.Stream stream = inputStream.AsStream();
System.IO.StreamReader reader = new StreamReader(stream);

string contents = reader.ReadToEnd();
internal async void ProtectBytes(byte[] data, BinaryWriter output)
{
   DataProtectionProvider dpp = new DataProtectionProvider();

    IBuffer result = await dpp.ProtectAsync(data.AsBuffer());
    byte[] protectedData;
    int start = 0;
    if (result.TryGetUnderlyingData(out protectedData, out start))
       output.Write(protectedData);
    else
       throw new InvalidOperationException();
}
You can write your own
Windows Runtime components
    in C# or Visual Basic
You should build a Windows Runtime
component when you want your code to
            be used from
         JS, C++, C# and VB
ComVisible(true), Guid("06D7901C-9045-4241-B8A0-39A1AC0F8618")]
public interface IWindowsApiSample
{
    string HelloWorld();
}

[ComVisible(true), [ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(IWindowsApiSample))]
public class WindowsApiSample : IWindowsApiSample
{
    public string HelloWorld() {
         return "Hello, World!";
    }
}
public sealed class MyClassLibrary
{
    public string HelloWorld()
    {
         return "Hello, World!";
    }
}
By adhering to a few simple rules, you can
                   build
a managed Windows Runtime component
   that projects into C++ or JavaScript
Only the public types and members
 in your managed Windows Runtime
component project need to follow the
            simple rules
public sealed class ManagedLibrary
{
    public List<int> GetNumbers()
    {
        List<int> numbers = new List<int>();
        numbers.AddRange(new int[] {0,1,1,2,3});
        return numbers;
    }
}
public sealed class ManagedLibrary
{
    public IList<int> GetNumbers()
    {
        List<int> numbers = new List<int>();
        numbers.AddRange(new int[] {0,1,1,2,3});
        return numbers;
    }
}
private async Task<string> GetTweetTaskAsync()
{
    string url = "http://api.twitter.com/1/statuses/" +
                     "user_timeline.xml?screen_name=bldwin";
    var http = new HttpClient();
    var resp = await http.GetAsync(url);
    var xml = XDocument.Load(resp.Content.ContentReadStream);
    var str = xml.Descendants("text")
                .Select(x => x.Value).First();
    return str;
}
public IAsyncOperation<string> GetTweetAsync()
{
    return AsyncInfoFactory.Create(
               () => this.GetTweetTaskAsync());
}
Visual Studio has built-in support for
               managed
Windows Runtime component projects
You already have the skills to build
 Metro style apps with C# and VB
Influenced by C# and VB

Feels natural and familiar from
     C# and Visual Basic

  Build your own managed
Windows Runtime components
WinRT Holy COw

More Related Content

What's hot

Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Christian Schneider
 
9781305078444 ppt ch10
9781305078444 ppt ch109781305078444 ppt ch10
9781305078444 ppt ch10
Terry Yoast
 
Javascript session 01 - Introduction to Javascript
Javascript session 01 - Introduction to JavascriptJavascript session 01 - Introduction to Javascript
Javascript session 01 - Introduction to Javascript
Livingston Samuel
 

What's hot (20)

#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)
 
Solid NodeJS with TypeScript, Jest & NestJS
Solid NodeJS with TypeScript, Jest & NestJSSolid NodeJS with TypeScript, Jest & NestJS
Solid NodeJS with TypeScript, Jest & NestJS
 
JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
 
Dynamic virtual evironments
Dynamic virtual evironmentsDynamic virtual evironments
Dynamic virtual evironments
 
Gdg dev fest hybrid apps your own mini-cordova
Gdg dev fest hybrid apps  your own mini-cordovaGdg dev fest hybrid apps  your own mini-cordova
Gdg dev fest hybrid apps your own mini-cordova
 
Lightweight Xtext Editors as SWT Widgets
Lightweight Xtext Editors as SWT WidgetsLightweight Xtext Editors as SWT Widgets
Lightweight Xtext Editors as SWT Widgets
 
9781305078444 ppt ch10
9781305078444 ppt ch109781305078444 ppt ch10
9781305078444 ppt ch10
 
Thug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclientThug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclient
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
Javascript session 01 - Introduction to Javascript
Javascript session 01 - Introduction to JavascriptJavascript session 01 - Introduction to Javascript
Javascript session 01 - Introduction to Javascript
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug Class
 
Java script tutorial
Java script tutorialJava script tutorial
Java script tutorial
 
JS Event Loop
JS Event LoopJS Event Loop
JS Event Loop
 
Andrzej Ludwikowski - Event Sourcing - co może pójść nie tak?
Andrzej Ludwikowski -  Event Sourcing - co może pójść nie tak?Andrzej Ludwikowski -  Event Sourcing - co może pójść nie tak?
Andrzej Ludwikowski - Event Sourcing - co może pójść nie tak?
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you powned
 

Viewers also liked

Theatre metaphor
Theatre metaphorTheatre metaphor
Theatre metaphor
epgober
 
Our classroom policies
Our classroom policiesOur classroom policies
Our classroom policies
fowler210
 
Medea: Final Light Design
Medea: Final Light DesignMedea: Final Light Design
Medea: Final Light Design
epgober
 
FINAL MEDEA LIGHT DESIGN
FINAL MEDEA LIGHT DESIGNFINAL MEDEA LIGHT DESIGN
FINAL MEDEA LIGHT DESIGN
epgober
 
Design tools
Design toolsDesign tools
Design tools
epgober
 
Inspirational research medea
Inspirational research medeaInspirational research medea
Inspirational research medea
epgober
 
Medea: Set Design
Medea: Set DesignMedea: Set Design
Medea: Set Design
epgober
 
Final collage
Final collageFinal collage
Final collage
epgober
 
Final Medea Set Design
Final Medea Set DesignFinal Medea Set Design
Final Medea Set Design
epgober
 
Medea: elements and principles
Medea: elements and principlesMedea: elements and principles
Medea: elements and principles
epgober
 
Medea: Costume design
Medea: Costume designMedea: Costume design
Medea: Costume design
epgober
 
Mnrega & clotehes as a scenario
Mnrega & clotehes as a scenarioMnrega & clotehes as a scenario
Mnrega & clotehes as a scenario
hyderali123
 
Internal appraisal of the firm
Internal appraisal of the firmInternal appraisal of the firm
Internal appraisal of the firm
hyderali123
 

Viewers also liked (19)

AngularJS: Good parts
AngularJS: Good partsAngularJS: Good parts
AngularJS: Good parts
 
Theatre metaphor
Theatre metaphorTheatre metaphor
Theatre metaphor
 
Our classroom policies
Our classroom policiesOur classroom policies
Our classroom policies
 
Medea: Final Light Design
Medea: Final Light DesignMedea: Final Light Design
Medea: Final Light Design
 
FINAL MEDEA LIGHT DESIGN
FINAL MEDEA LIGHT DESIGNFINAL MEDEA LIGHT DESIGN
FINAL MEDEA LIGHT DESIGN
 
Design tools
Design toolsDesign tools
Design tools
 
Inspirational research medea
Inspirational research medeaInspirational research medea
Inspirational research medea
 
Medea: Set Design
Medea: Set DesignMedea: Set Design
Medea: Set Design
 
Welcome to Health Managing Group
Welcome to Health Managing GroupWelcome to Health Managing Group
Welcome to Health Managing Group
 
Final collage
Final collageFinal collage
Final collage
 
Angular.JS: Do it right
Angular.JS: Do it rightAngular.JS: Do it right
Angular.JS: Do it right
 
Final Medea Set Design
Final Medea Set DesignFinal Medea Set Design
Final Medea Set Design
 
Medea: elements and principles
Medea: elements and principlesMedea: elements and principles
Medea: elements and principles
 
How to be a good frontend developer
How to be a good frontend developerHow to be a good frontend developer
How to be a good frontend developer
 
Medea: Costume design
Medea: Costume designMedea: Costume design
Medea: Costume design
 
Что там в summary
Что там в summaryЧто там в summary
Что там в summary
 
Mnrega & clotehes as a scenario
Mnrega & clotehes as a scenarioMnrega & clotehes as a scenario
Mnrega & clotehes as a scenario
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Internal appraisal of the firm
Internal appraisal of the firmInternal appraisal of the firm
Internal appraisal of the firm
 

Similar to WinRT Holy COw

Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
FIWARE
 
Yogesh kumar kushwah represent’s
Yogesh kumar kushwah represent’sYogesh kumar kushwah represent’s
Yogesh kumar kushwah represent’s
Yogesh Kushwah
 
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
GeeksLab Odessa
 
WebRTC & Firefox OS - presentation at Google
WebRTC & Firefox OS - presentation at GoogleWebRTC & Firefox OS - presentation at Google
WebRTC & Firefox OS - presentation at Google
Robert Nyman
 
Introduction to the New Asynchronous API in the .NET Driver
Introduction to the New Asynchronous API in the .NET DriverIntroduction to the New Asynchronous API in the .NET Driver
Introduction to the New Asynchronous API in the .NET Driver
MongoDB
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
Fermin Galan
 
Integrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight ApplicationsIntegrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight Applications
Dan Wahlin
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
Chui-Wen Chiu
 

Similar to WinRT Holy COw (20)

Dot Net Framework
Dot Net FrameworkDot Net Framework
Dot Net Framework
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
Titanium appcelerator my first app
Titanium appcelerator my first appTitanium appcelerator my first app
Titanium appcelerator my first app
 
2310 b 03
2310 b 032310 b 03
2310 b 03
 
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO ExtendedJetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO Extended
 
OpenCMIS Part 1
OpenCMIS Part 1OpenCMIS Part 1
OpenCMIS Part 1
 
Yogesh kumar kushwah represent’s
Yogesh kumar kushwah represent’sYogesh kumar kushwah represent’s
Yogesh kumar kushwah represent’s
 
Csharp dot net
Csharp dot netCsharp dot net
Csharp dot net
 
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
 
WebRTC & Firefox OS - presentation at Google
WebRTC & Firefox OS - presentation at GoogleWebRTC & Firefox OS - presentation at Google
WebRTC & Firefox OS - presentation at Google
 
Hybrid apps - Your own mini Cordova
Hybrid apps - Your own mini CordovaHybrid apps - Your own mini Cordova
Hybrid apps - Your own mini Cordova
 
Asp.net
Asp.netAsp.net
Asp.net
 
Introduction to the New Asynchronous API in the .NET Driver
Introduction to the New Asynchronous API in the .NET DriverIntroduction to the New Asynchronous API in the .NET Driver
Introduction to the New Asynchronous API in the .NET Driver
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
Introduction to Windows 8 Development
Introduction to Windows 8 Development
Introduction to Windows 8 Development
Introduction to Windows 8 Development
 
Integrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight ApplicationsIntegrating Security Roles into Microsoft Silverlight Applications
Integrating Security Roles into Microsoft Silverlight Applications
 
Ajax toolkit framework
Ajax toolkit frameworkAjax toolkit framework
Ajax toolkit framework
 
Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)
 
.Net 3.5
.Net 3.5.Net 3.5
.Net 3.5
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
 

More from Eugene Zharkov

Angular 2.0: Brighter future?
Angular 2.0: Brighter future?Angular 2.0: Brighter future?
Angular 2.0: Brighter future?
Eugene Zharkov
 
SignalR: Add real-time to your applications
SignalR: Add real-time to your applicationsSignalR: Add real-time to your applications
SignalR: Add real-time to your applications
Eugene Zharkov
 
Roslyn compiler as a service
Roslyn compiler as a serviceRoslyn compiler as a service
Roslyn compiler as a service
Eugene Zharkov
 
Creating windows store java script apps
Creating windows store java script appsCreating windows store java script apps
Creating windows store java script apps
Eugene Zharkov
 
Big Bang Theory of JavaScript Metro Applications
Big Bang Theory of JavaScript Metro ApplicationsBig Bang Theory of JavaScript Metro Applications
Big Bang Theory of JavaScript Metro Applications
Eugene Zharkov
 
Windows 8 app java script dark side
Windows 8 app java script dark sideWindows 8 app java script dark side
Windows 8 app java script dark side
Eugene Zharkov
 

More from Eugene Zharkov (20)

Monorepo: React + React Native. React Alicante
Monorepo:  React + React Native. React Alicante Monorepo:  React + React Native. React Alicante
Monorepo: React + React Native. React Alicante
 
Monorepo: React Web & React Native
Monorepo: React Web & React NativeMonorepo: React Web & React Native
Monorepo: React Web & React Native
 
Create React Native App vs Expo vs Manually
Create React Native App vs Expo vs ManuallyCreate React Native App vs Expo vs Manually
Create React Native App vs Expo vs Manually
 
Build automation with Fastlane
Build automation with FastlaneBuild automation with Fastlane
Build automation with Fastlane
 
GraphQL and/or REST
GraphQL and/or RESTGraphQL and/or REST
GraphQL and/or REST
 
React Native Animation
React Native AnimationReact Native Animation
React Native Animation
 
React Native: Hurdle Race
React Native: Hurdle RaceReact Native: Hurdle Race
React Native: Hurdle Race
 
Burn your grass with react native
Burn your grass with react nativeBurn your grass with react native
Burn your grass with react native
 
Фронтенд сказки
Фронтенд сказкиФронтенд сказки
Фронтенд сказки
 
Cycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveCycle.js: Functional and Reactive
Cycle.js: Functional and Reactive
 
Switch to React.js from AngularJS developer
Switch to React.js from AngularJS developerSwitch to React.js from AngularJS developer
Switch to React.js from AngularJS developer
 
Mobile applications in a new way with React Native
Mobile applications in a new way with React NativeMobile applications in a new way with React Native
Mobile applications in a new way with React Native
 
Angular 2: Всех переиграл
Angular 2: Всех переигралAngular 2: Всех переиграл
Angular 2: Всех переиграл
 
Angular 2.0: Brighter future?
Angular 2.0: Brighter future?Angular 2.0: Brighter future?
Angular 2.0: Brighter future?
 
Как объяснить на платьях процесс разработки?
Как объяснить на платьях процесс разработки?Как объяснить на платьях процесс разработки?
Как объяснить на платьях процесс разработки?
 
SignalR: Add real-time to your applications
SignalR: Add real-time to your applicationsSignalR: Add real-time to your applications
SignalR: Add real-time to your applications
 
Roslyn compiler as a service
Roslyn compiler as a serviceRoslyn compiler as a service
Roslyn compiler as a service
 
Creating windows store java script apps
Creating windows store java script appsCreating windows store java script apps
Creating windows store java script apps
 
Big Bang Theory of JavaScript Metro Applications
Big Bang Theory of JavaScript Metro ApplicationsBig Bang Theory of JavaScript Metro Applications
Big Bang Theory of JavaScript Metro Applications
 
Windows 8 app java script dark side
Windows 8 app java script dark sideWindows 8 app java script dark side
Windows 8 app java script dark side
 

Recently uploaded

Recently uploaded (20)

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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 

WinRT Holy COw

  • 1.
  • 2.
  • 3. DllImport "avicap32.dll" "capCreateCaptureWindow" static extern int string int int int int int int int DllImport "avicap32.dll" static extern bool int MarshalAs UnmanagedType ref string int MarshalAs UnmanagedType ref string int // more and more of the same
  • 4. Manually Your Managed Traditional Generated Code Windows API Interop Code
  • 5. using Windows.Media.Capture; var new CameraCaptureUI new Size var await CameraCaptureUIMode if var new BitmapImage await FileAccessMode
  • 6. Metro style app Language Support (CLR, WinJS, CRT) Language Projection UI Pickers Controls Media Web Host (HTML, CSS, JavaScript)) Windows XAML Storage Network … Metadata & Namespace Windows Runtime Core Runtime Broker Windows Core
  • 7. Your Managed Windows Windows 8 API Code Runtime
  • 8. You already have the skills to build Metro style apps with C# and VB
  • 9. • The relationship between .NET and the Windows Runtime • Using Windows Runtime APIs from C# and Visual Basic • Building Window Runtime Components in C# and Visual Basic
  • 10. C# and Visual Basic influenced the Windows Runtime
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Using the Windows Runtime feels natural and familiar from C# and Visual Basic
  • 18.
  • 19. var new CameraCaptureUI new Size var await CameraCaptureUIMode if var new BitmapImage await FileAccessMode
  • 20.
  • 21.
  • 22. try { var new CameraCaptureUI new Size catch (Exception e) { //Exception handling code } ComException
  • 23. var picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*"); var files = await picker.PickMultipleFilesAsync(); foreach (var file in files) { lbFiles.Items.Add(file.FileName); } PickMultipleFilesOperation PickMultipleFilesAsync(); public sealed class PickMultipleFilesOperation : IAsyncOperation<IReadOnlyList<StorageFile>>, IAsyncInfo
  • 24. var picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*"); var files = await picker.PickMultipleFilesAsync(); foreach (StorageFile file in files) { lbFiles.Items.Add(file.FileName); } System.Collections.Generic.IReadOnlyList <Windows.Storage.StorageFile>
  • 25. var picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*"); var files = await picker.PickMultipleFilesAsync(); foreach (StorageFile file in files) { lbFiles.Items.Add(file.FileName); } System.Collections.Generic.IReadOnlyList Windows.Foundation.Collections.IVectorView <Windows.Storage.StorageFile> <Windows.Storage.StorageFile>
  • 26.
  • 27.
  • 28. FileOpenPicker picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*"); StorageFile file = await picker.PickSingleFileAsync(); Windows.Storage.Streams.IInputStream inputStream = await file.OpenForReadAsync(); System.IO.Stream stream = inputStream.AsStream(); System.IO.StreamReader reader = new StreamReader(stream); string contents = reader.ReadToEnd();
  • 29. internal async void ProtectBytes(byte[] data, BinaryWriter output) { DataProtectionProvider dpp = new DataProtectionProvider(); IBuffer result = await dpp.ProtectAsync(data.AsBuffer()); byte[] protectedData; int start = 0; if (result.TryGetUnderlyingData(out protectedData, out start)) output.Write(protectedData); else throw new InvalidOperationException(); }
  • 30. You can write your own Windows Runtime components in C# or Visual Basic
  • 31. You should build a Windows Runtime component when you want your code to be used from JS, C++, C# and VB
  • 32. ComVisible(true), Guid("06D7901C-9045-4241-B8A0-39A1AC0F8618")] public interface IWindowsApiSample { string HelloWorld(); } [ComVisible(true), [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(IWindowsApiSample))] public class WindowsApiSample : IWindowsApiSample { public string HelloWorld() { return "Hello, World!"; } }
  • 33. public sealed class MyClassLibrary { public string HelloWorld() { return "Hello, World!"; } }
  • 34. By adhering to a few simple rules, you can build a managed Windows Runtime component that projects into C++ or JavaScript
  • 35. Only the public types and members in your managed Windows Runtime component project need to follow the simple rules
  • 36.
  • 37. public sealed class ManagedLibrary { public List<int> GetNumbers() { List<int> numbers = new List<int>(); numbers.AddRange(new int[] {0,1,1,2,3}); return numbers; } }
  • 38. public sealed class ManagedLibrary { public IList<int> GetNumbers() { List<int> numbers = new List<int>(); numbers.AddRange(new int[] {0,1,1,2,3}); return numbers; } }
  • 39. private async Task<string> GetTweetTaskAsync() { string url = "http://api.twitter.com/1/statuses/" + "user_timeline.xml?screen_name=bldwin"; var http = new HttpClient(); var resp = await http.GetAsync(url); var xml = XDocument.Load(resp.Content.ContentReadStream); var str = xml.Descendants("text") .Select(x => x.Value).First(); return str; }
  • 40. public IAsyncOperation<string> GetTweetAsync() { return AsyncInfoFactory.Create( () => this.GetTweetTaskAsync()); }
  • 41. Visual Studio has built-in support for managed Windows Runtime component projects
  • 42.
  • 43. You already have the skills to build Metro style apps with C# and VB
  • 44. Influenced by C# and VB Feels natural and familiar from C# and Visual Basic Build your own managed Windows Runtime components