Skip to content

Commit 09926e1

Browse files
adpa-msAdib Parkar
andauthored
Remove unnecessary explicit Close (#347)
Co-authored-by: Adib Parkar <[email protected]>
1 parent 6f0fe43 commit 09926e1

File tree

1 file changed

+6
-3
lines changed
  • Samples/Islands/DrawingIsland/DrawingCppTestApp

1 file changed

+6
-3
lines changed

Samples/Islands/DrawingIsland/DrawingCppTestApp/WinMain.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,27 @@ int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int)
2424
auto compositor = winrt::Compositor();
2525
auto island = winrt::DrawingIsland(compositor).Island();
2626

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.
2729
auto window = winrt::AppWindow::Create();
2830
window.AssociateWithDispatcherQueue(queue);
2931
window.Closing(
30-
[island, queue](auto&&, auto&&)
32+
[queue](auto&&, auto&&)
3133
{
32-
island.Close();
34+
// Ensure the DispatcherQueue exits the event loop on close.
3335
queue.EnqueueEventLoopExit();
3436
});
3537

3638
window.Title(L"Drawing C++ TestApp");
3739
window.Show();
3840

41+
// Create a ContentSiteBridge and connect the ContentIsland to it.
3942
auto siteBridge = winrt::DesktopChildSiteBridge::Create(compositor, window.Id());
4043
siteBridge.ResizePolicy(winrt::ContentSizePolicy::ResizeContentToParentWindow);
4144
siteBridge.Show();
4245
siteBridge.Connect(island);
4346

44-
// Move initial focus to the island.
47+
// Move initial focus to the ContentIsland.
4548
auto focusNavigationHost = winrt::InputFocusNavigationHost::GetForSiteBridge(siteBridge);
4649
focusNavigationHost.NavigateFocus(winrt::FocusNavigationRequest::Create(
4750
winrt::FocusNavigationReason::Programmatic));

0 commit comments

Comments
 (0)