Skip to content

Commit

Permalink
Fix WinUI model viewer so it can be closed properly. #2048 (#2066)
Browse files Browse the repository at this point in the history
  • Loading branch information
holance authored Dec 6, 2023
1 parent a59d969 commit 63515f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Source/Examples/WinUI/ModelViewer/ModelViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.5" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231115000" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
</ItemGroup>

Expand Down
9 changes: 8 additions & 1 deletion Source/Examples/WinUI/ModelViewer/Views/ShellPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.UI.Xaml;
using HelixToolkit.SharpDX.Core;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
Expand Down Expand Up @@ -31,9 +32,15 @@ public ShellPage(ShellViewModel viewModel)
App.MainWindow.ExtendsContentIntoTitleBar = true;
App.MainWindow.SetTitleBar(AppTitleBar);
App.MainWindow.Activated += MainWindow_Activated;
App.MainWindow.Closed += MainWindow_Closed;
AppTitleBarText.Text = "AppDisplayName".GetLocalized();
}

private void MainWindow_Closed(object sender, WindowEventArgs args)
{
App.GetService<IEffectsManager>().Dispose();
}

private void OnLoaded(object sender, RoutedEventArgs e)
{
TitleBarHelper.UpdateTitleBar(RequestedTheme);
Expand Down

0 comments on commit 63515f6

Please sign in to comment.