6. View Metro style Apps Desktop Apps
XAML HTML / CSS
Controller
C C# JavaScript
Model
HTML C C#
C++ VB (Chakra) JavaScrip
t C++ VB
WinRT APIs
System Services
Communication Graphics & Devices &
& Data Media Printing
Application Model Internet .NET
Explorer
Win32 / SL
Core
Windows Core OS Services
7. The Sweet Spot for C++…
Power,
Performance
and Portability.
16. Key Bindings Feature Summary
1. Data Types ref class Reference type
value class Value type
interface class Interface
property Property with get/set
event “Delegate property” with add/remove/raise
delegate Type-safe function pointer
generic Type-safe generics
2. Allocation ref new Reference-counted allocation
3. Pointer & ^ Strong pointer (“hat” or “handle”)
Reference % Strong reference
27. generic<typename T, typename U> ref class PairStringUri:
public interface class IPair { IPair<String^, Uri^> {
property T First; public:
property U Second; property String^ First;
}; property Uri^ Second;
};
IPair<String^, Uri^>^ uri = GetUri();
auto first = uri->First; // type is String^
auto second = uri->Second; // type is Uri^
28. template<typename T, typename U>
ref class Pair: IPair<T, U>
{
public:
property T First;
property U Second;
Pair(T first, U second) { First = first; Second = second; }
};
IPair<String^, Uri^>^ pair = ref new Pair<String^, Uri^>(
“//BUILD/”, ref new Uri(“http://www.buildwindows.com”));
32. using namespace Platform;
Vector<String^>^ items = ref new Vector<String^>();
items->Append(“Hello”);
• Returning a read-only view of the vector
IVectorView<String^>^ GetItems () {
return items->GetView();
}
items->VectorChanged +=
ref new VectorChangedEventHandler<String^>
(this, &MyClass::VectorChanged);
33. using namespace Platform;
Map<String^, Uri^> favorites = ref new Map<String^, Uri^>();
favorites->Insert(“MSDN”, ref new Uri(“http://msdn.com”));
if (favorites->HasKey(“MSDN”))
favorites->Remove(“MSDN”);
34. Begin()/End()
std::vector<int> v;
begin() end() v.push_back(10);
auto items = ref new Vector<int>(v);
IVector<int>^ v = GetItems();
int sum = 0; Vector<int>^ items = …;
std::for_each( begin(v), end(v), std::vector<int> v = to_vector(items);
[&sum](int element) {
sum += element;
} );
35.
36. Building your first Windows Metro style app
Roadmap for creating Metro style apps
Tour of the IDE
• XAML designer
C++ Reference for Windows Runtime
Windows Runtime Components in C++
Asynchronous Programming in C++ Using PPL
37. (Since 10th of January 2012)
http://BeCPP.org/
Aim? quarterly meetings
Audience? free for everyone
Where? At Microsoft offices in Zaventem or at sponsor company
locations (we’re still looking for hosts / sponsors!)
Announcements? subscribe to our blog to stay up-to-date
Questions? BeCPP@BeCPP.org
or visit the TechDays MEET Corner during breaks
38. MICROSOFTC++
2012
PARTICIPATE IN C++
MICROSOFT
DEVELOPER
DIVISION
DEVELOPMENT USER DESIGN
RESEARCH
RESEARCH
SIGN UP ONLINE AT
http://bit.ly/cppdeveloper