Skip to content

Commit

Permalink
DYN-6897 Dynamo Button Disabled Revit
Browse files Browse the repository at this point in the history
When opening Dynamo in Revit2025 and closing the SplashScreen using the Windows TaskBar the Dynamo button is disabled (there is no way to re-enable it) so you need to close Revit to be able to see the Dynamo button enabled again.
So in this fix I'm handling the case of re-enable the Dynamo button in Revit when the SplashScreen is closed using the Windows TaskBar (CloseMode.ByOther).
  • Loading branch information
RobertGlobant20 committed Dec 12, 2024
1 parent 7bcdb04 commit 5f46d23
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 5f46d23

Please sign in to comment.