Разработка Windows 8 приложений на С++ Сергей Байдачный Специалист по разработке программного обеспечения Microsoft Ukraine.

Slides:



Advertisements
Similar presentations
Christophe Pichaud Microsoft Architect Sogeti France
Advertisements

Introduction to the Windows Runtime (WinRT) Ben Dewey Tallan, Inc.
Dinko Jakovljević Microsoft Student Partner | BambooLab
Platform for building Windows Store Apps Agu Suur Frontend Developer Axinom.
IEG3080 Tutorial 3 Prepared by Ryan. Outline Object Oriented Programming Concepts Encapsulation Inheritance Polymorphism Delegation Course Project.
Trey Mack James Moore Osa Osar-Emokpae
Why COM and.Net? Jim Fawcett CSE775 – Distributed Objects Spring 2005.
C# Programming: From Problem Analysis to Program Design1 Advanced Object-Oriented Programming Features C# Programming: From Problem Analysis to Program.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Windows 8 and WinRT from a C++ perspective
Windows reimagined A new UI where touch is a first-class citizen along with full mouse-and-keyboard support.
Windows Core OS Services JavaScript (Chakra) C C++ C# VB Metro style apps Communication & Data Application Model Devices & Printing WinRT APIs Graphics.
How to Create Your First
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Platform for Metro Style Apps Michael Platt Senior Director Microsoft Corp.
1 Introduction to.NET Framework. 2.NETFramework Internet COM+ Orchestration Orchestration Windows.NET Enterprise ServersBuildingBlockServices Visual Studio.NET.
Building Windows 8 Apps with HTML & JavaScript Jaime Rodriguez Principal
Effective WinRT with C++ Tips and tricks for developing WinRT applications in C++
Overview of UI Development for Windows Store Apps
Beautiful Sites and Apps Easy-to-build, Touch-First Interactivity Engaging Page Layouts Better Client/Server Data Transfer Powerful Local Data and Offline.
CIS NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials.
.NET Framework & C#.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
An Introduction to Silverlight Matt Harrington Developer Evangelist, Microsoft October 20, 2011.
Web Services Week 2 Aims: Getting started with creating simple C# applications within Visual Studio.NET Objectives: –An introduction to the syntax of C#.NET.
C# Events and WPF #W5. Horizontal Prototype WPF Designed for rapid user interface design Used for many devices: Windows Phone, Tablets, PCs,
Session 08: Architecture Controllers or Managers Graphical User Interface (GUI) FEN AK - IT Softwarekonstruktion.
Jeff From 5 to 8 building Windows 8 Apps with HTML5 and JavaScript.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Lecture 2 COM - Example. Integrate the web Webcam functionality using.Net and COM First let's explain what we should do exactly. First let's explain what.
Module 3: Working with Components. Overview An Introduction to Key.NET Framework Development Technologies Creating a Simple.NET Framework Component Creating.
Windows 8 Apps Guy Burstein Technical Evangelist, Microsoft
Introduction to Building Windows 8.1 & Windows Phone Applications.
Introduction to TypeScript Sergey Barskiy Architect Level: Introductory.
Sample Application Multi Layered Architecture (n-tier): –Graphical User Interface (GUI): Forms, components, controls The Visual Designer in Visual Studio.
Windows Core OS Services JavaScript (Chakra) C C++ C# VB Metro style apps Communication & Data Application Model Devices & Printing WinRT APIs Graphics.
Windows Runtime Deep Dive Brendan Forster Senior Developer, ASP.NET/IIS DEV317.
Build advanced touch apps in Windows 8
Developer Day Welcome to TechDays Lausanne, Ronnie Saurenmann Technology Evangelist, Microsoft Switzerland.
Async everywhere: creating responsive APIs & apps
Introduction to Writing Metro Style Apps in Native C++ Marc Grégoire Software Architect
Windows Store apps… lots of choices Windows Store Apps Communication & Data Application Model Devices & Printing WinRT APIs Graphics & Media JavaScript.
Overview Windows Core OS Services JavaScript (Chakra) C C++ C# VB Metro style Apps Communication & Data Application Model Devices & Printing WinRT.
Windows 10 UWP MVVM In Depth
PerlNET: The Camel Talks.NET Jan Dubois The Perl Conference 6 San Diego, July 26 th 2002.
Windows 8 Ronnie Saurenmann Technical Evangelist Microsoft Switzerland
Building Windows Runtime Components in C++ Harry Pierson Program Manager, Windows Runtime Experience Team Microsoft Corporation.
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
DEV394.NET Framework: Migrating To Managed Code Adam Nathan QA Lead Richard Lander Program Manager Microsoft Corporation.
INTRODUCTION CHAPTER #1 Visual Basic.NET. VB.Net General features It is an object oriented language  In the past VB had objects but focus was not placed.
Metro Style Applications Metro style design and Inspirations.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
Communication & Data Devices & Printing WinRT APIs DirectX & Media Windows 8 Desktop Apps C C++ Win32 C# VB. NET SL HTML JavaScrip t Internet Explorer.
Windows 8: XAML or HTML? Karl Davies-Barrett CEE DPE Tech Lead, Microsoft 
What is the Windows Runtime? Devices Sensor s Geolocation Portabl e NFC Communications & Data Contracts XML Web SMS Networking Notifications Local.
Andy Wigley Device Application Development MVP APPA Mundi Ltd SESSION CODE: WEM309.
50 Performance Tricks to Make your HTML5 apps and sites Faster
Platform for Metro Style Apps
Jim Fawcett CSE775 – Distributed Objects Spring 2012
Building beautiful and interactive apps with HTML5 & CSS3
XAML User Interface Creation in C#
Using the Windows Runtime from JavaScript
.NET and .NET Core 7. XAML Pan Wuming 2017.
Metro style apps using XAML: What you need to know
Using C++ in your Windows Phone Applications Talk will be repeated tomorrow morning at 8:30 in 33/McKinley Peter Torr, Program Manager.
Windows Runtime internals: understanding "Hello World"
Platform for Metro style Apps
Microsoft Consumer Channels and Central Marketing Group
Native Integration Module #3 of 6.
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2006
Presentation transcript:

Разработка Windows 8 приложений на С++ Сергей Байдачный Специалист по разработке программного обеспечения Microsoft Ukraine

Платформа для разработчика Windows Core OS Services JavaScript (Chakra) C C++ C# VB Windows Store Apps Communication & Data Application Model Devices & Printing WinRT APIs Graphics & Media XAML HTML / CSS HTML JavaScript C C++ C# VB Desktop Apps Win32. NET / SL Internet Explorer System Services View Model Controller Core

Что такое WinRT API COM

.winmd metadata.winmd files Contain the metadata representation of WinRT types To consume a winmd file: Right click on project in Solution Explorer > References > Add New Reference… Or #using Make sure the winmd and implementation dll is packaged together with your application To produce a.winmd file: Start from the “C++ WinRT Component Dll” template Define public types (ref classes, interfaces, delegates, etc.) Tip: C++ WinRT components can be consumed from C++, JS or C#

Windows 8 APIs Windows Core OS Services

Язык программирования С#

Язык программирования С++

C++ reimagined C++ 11 auto shared_ptr decltype C++/CX The Windows Runtime language extensions lets you use the power and performance of C++ to build Windows 8 apps

C++ Component Extensions Key Bindings FeatureSummary 1. Data Types ref classReference type value classValue type interface classInterface propertyProperty with get/set event“Delegate property” with add/remove/raise delegateType-safe function pointer genericType-safe generics 2. Allocation gcnewGarbage-collected allocation ref newReference-counted allocation 3. Pointer & Reference ^Strong pointer (“hat” or “handle”) %Strong reference

WinRT Types: For Cross- Language Use Module Internals written in C++ Module Internals written in C++ WinRT External Surface for WinRT callers/callees C/C++ External Surface for native callers/callees

Runtime Class Defining public ref class Person { public: Person(String^ name, String^ ); void Greet(Person^ other); internal: ~Person(); void SetPassword(const std::wstring& passwd); }; ABI-safe cross-language class Public methods restricted to WinRT typed parameters Private/internal methods can use any legal C++ type parameters Using Person^ p = ref new Person(“John Surname”); p->Greet(ref new Person(“Jim Surename”);

Lifetime Management Handle (^) is a pointer to a Windows Runtime object for which the compiler performs automatic reference counting ref new instantiates or activates a Windows Runtime class. Person^ p; { Person^ p2 = ref new Person(); // refcount = 1 p2->Name = “John”; // refcount = 1 p = p2; // refcount = 2 } // refcount = 1 p = nullptr; // refcount = 0; ~Person()

Interface Inheriting public interface class IFeline : IAnimal { void Scratch(); }; Implementing ref class Cat : IFeline { public: virtual void Play(); virtual void Scratch(); }; Public inheritance only Defining public interface class IAnimal { void Play(); }; Methods are implicitly public Using IAnimal^ animal = ref new Cat(); animal->Play();

Property Defining Trivial properties (with private backing store) public: property String^ Name; User defined properties public: property Person^ Sibling { Person^ get() { InitSiblings(); return _sibling; } void set(Person^ value) { _sibling = value; NotifySibling(); } } private: Person^ _sibling; Using Person^ p = ref new Person(“John”); p->Sibling = ref new Person(p->Name);

Delegate Declaring: like a function public delegate void PropertyChanged( String^ propName, String^ propValue ); Instantiating: like a class From lambda: auto p = ref new PropertyChanged( [](String^ pn, String^ pv) { cout << pn << ” = “ << pv; } ); From free-function auto p = ref new PropertyChanged( UIPropertyChanged ); From class-member auto p = ref new PropertyChanged( this, MainPage::OnPropertyChanged ); Invoking: like a function p( “Visible”, false );

Event Defining Trivial event (with private backing store) public: event PropertyChanged^ OnPropertyChanged; User defined event public: event PropertyChanged^ OnNetworkChanged { EventRegistrationToken add(PropertyChanged^); void remove(EventRegistrationToken t); void raise(String^, String^); } Using Subscribing person->OnPropertyChanged += propertyChangedDelegate; auto token = person- >OnPropertyChanged::add(propertyChangedDelegate); Unsubscribing person->OnPropertyChanged -= token; person->OnPropertyChanged::remove(token);

Exception Signaling an error case: throw exception throw ref new InvalidArgumentException(); throw ref new COMException(E_*); Handling an error case: catch exception try { … } catch (OutOfMemoryException^ ex) { … } Access HRESULT value via ex->HResult Notes on exceptions: catch (Platform::Exception^) catches all WinRT exceptions Exceptions don’t carry any state and don’t travel across modules Deriving from an exception class is ill-formed HRESULTException E_OUTOFMEMORY OutOfMemoryExceptio n E_INVALIDARG InvalidArgumentExcepti on E_NOINTERFACEInvalidCastException E_POINTERNullReferenceException E_NOTIMPL NotImplementedExcept ion E_ACCESSDENIEDAccessDeniedException E_FAILFailureException E_BOUNDSOutOfBoundsException E_CHANGED_STATEChangedStateException REGDB_E_CLASSNO TREG ClassNotRegisteredExce ption E_DISCONNECTEDDisconnectedException E_ABORTOperationCanceledExce ption

Generics Implementing ref class PairStringUri: IPair { public: property String^ First; property Uri^ Second; }; Defining generic public interface class IPair { property T First; property U Second; }; Using IPair ^ uri = GetUri(); auto first = uri->First; // type is String^ auto second = uri->Second; // type is Uri^

Partial Runtime Class Partial class definition private partial ref class MainPage: UserControl, IComponentConnector { public: void InitializeComponent(); void Connect() { btn1->Click += ref new EventHandler(this, &MainPage::Button_Click); } }; Class definition ref class MainPage { public: MainPage() { InitializeComponent(); } void Button_Click(Object^ sender, RoutedEventArgs^ e); };

Нужно ли мне выбирать С++?

Вопросы?