Skip to content

Commit 5d3b8c0

Browse files
committed
Merge branch 'user/jessecol/calc-app-compactoverlay' of https://github.com/microsoft/WindowsAppSDK-Samples into user/jessecol/calc-app-compactoverlay
2 parents 41c6b9c + 4233559 commit 5d3b8c0

31 files changed

+769
-1464
lines changed

Samples/Islands/DrawingIsland/DrawingCppTestApp/WinMain.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,30 @@ int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int)
2121
auto controller{ winrt::DispatcherQueueController::CreateOnCurrentThread() };
2222
auto queue = controller.DispatcherQueue();
2323

24+
auto compositor = winrt::Compositor();
25+
auto island = winrt::DrawingIsland(compositor).Island();
26+
27+
// Associating the AppWindow with the DispatcherQueue on which the ContentIsland is created
28+
// will ensure that the ContentIsland is Closed when the AppWindow closes.
2429
auto window = winrt::AppWindow::Create();
2530
window.AssociateWithDispatcherQueue(queue);
26-
window.Closing([&](auto&&, auto&&)
31+
window.Closing(
32+
[queue](auto&&, auto&&)
2733
{
34+
// Ensure the DispatcherQueue exits the event loop on close.
2835
queue.EnqueueEventLoopExit();
2936
});
3037

3138
window.Title(L"Drawing C++ TestApp");
3239
window.Show();
3340

34-
auto compositor = winrt::Compositor();
35-
auto drawing = winrt::DrawingIsland(compositor);
36-
41+
// Create a ContentSiteBridge and connect the ContentIsland to it.
3742
auto siteBridge = winrt::DesktopChildSiteBridge::Create(compositor, window.Id());
3843
siteBridge.ResizePolicy(winrt::ContentSizePolicy::ResizeContentToParentWindow);
3944
siteBridge.Show();
40-
siteBridge.Connect(drawing.Island());
45+
siteBridge.Connect(island);
4146

42-
// Move initial focus to the island.
47+
// Move initial focus to the ContentIsland.
4348
auto focusNavigationHost = winrt::InputFocusNavigationHost::GetForSiteBridge(siteBridge);
4449
focusNavigationHost.NavigateFocus(winrt::FocusNavigationRequest::Create(
4550
winrt::FocusNavigationReason::Programmatic));
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)