Skip to content

Commit

Permalink
Update SplashScreen.xaml.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzart90 committed Jan 17, 2024
1 parent 396be7e commit 56dbe7e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
Expand Down Expand Up @@ -37,6 +38,9 @@ public partial class SplashScreen : Window
// Timer used for Splash Screen loading
internal Stopwatch loadingTimer;

// Indicates if the SplashScren close button has already been hit.
private bool closeCalled;

/// <summary>
/// Total loading time for the Dynamo loading tasks in milliseconds
/// </summary>
Expand Down Expand Up @@ -156,6 +160,19 @@ public SplashScreen(bool enableSignInButton = true)
this.enableSignInButton = enableSignInButton;
}

protected override void OnClosing(CancelEventArgs e)
{
if (!closeCalled)
{
closeCalled = true;

// In case the splash screen's close button is hit multiple times,
// so we need to call the Window.Closing event only one time.
// (if we call this multiple times, webview2.IsVisible setter can be called after webview2.Dispose resulting in a crash)
base.OnClosing(e);
}
}

private void DynamoModel_LanguageDetected()
{
SetLabels();
Expand Down

0 comments on commit 56dbe7e

Please sign in to comment.