Skip to content

Commit

Permalink
DYN-6897 Dynamo Button Disabled Revit (#15722)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGlobant20 authored Jan 3, 2025
1 parent 57ecd2f commit cb8159a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public partial class SplashScreen : Window
// Used to ensure that OnClosing is called only once.
private bool IsClosing = false;

internal enum CloseMode { ByStartingDynamo, ByCloseButton, ByOther };

internal CloseMode currentCloseMode = CloseMode.ByOther;

// Timer used for Splash Screen loading
internal Stopwatch loadingTimer;

Expand Down Expand Up @@ -162,6 +166,7 @@ public SplashScreen(bool enableSignInButton = true)
RequestSignIn = SignIn;
RequestSignOut = SignOut;
this.enableSignInButton = enableSignInButton;
currentCloseMode = CloseMode.ByOther;
}

protected override void OnClosing(CancelEventArgs e)
Expand All @@ -172,6 +177,11 @@ protected override void OnClosing(CancelEventArgs e)
// webview2.Dispose => webview2.Visible.Set receives windows message => crash because object got disposed.
if (!IsClosing)
{
//Means that the SplashScreen was closed by other way for example by using the Windows Task Bar
if(currentCloseMode == CloseMode.ByOther)
{
CloseWasExplicit = true;
}
// First call to OnClosing
IsClosing = true;
}
Expand Down Expand Up @@ -283,6 +293,7 @@ private void LaunchDynamo(bool isCheckboxChecked)
{
viewModel.PreferenceSettings.EnableStaticSplashScreen = !isCheckboxChecked;
}
currentCloseMode = CloseMode.ByStartingDynamo;
Close();
dynamoView?.Show();
dynamoView?.Activate();
Expand Down Expand Up @@ -574,6 +585,8 @@ private static bool IsValidPreferencesFile(string filePath)
internal void CloseWindow(bool isCheckboxChecked = false)
{
CloseWasExplicit = true;
currentCloseMode = CloseMode.ByCloseButton;

if (viewModel != null && isCheckboxChecked)
{
viewModel.PreferenceSettings.EnableStaticSplashScreen = !isCheckboxChecked;
Expand Down

0 comments on commit cb8159a

Please sign in to comment.