Skip to content

Commit

Permalink
[DYN-6621] Save "Don't show again" setting on splash screen close (#1…
Browse files Browse the repository at this point in the history
…4866) (#15018)

* Update SplashScreen.xaml.cs

* Update SplashScreen.xaml.cs

Co-authored-by: Ashish Aggarwal <[email protected]>
  • Loading branch information
mjkkirschner and zeusongit authored Mar 15, 2024
1 parent 8f43cf7 commit cdf8c5a
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,15 @@ private static bool IsValidPreferencesFile(string filePath)
/// <summary>
/// If the user wants to close the window, we shutdown the application and don't launch Dynamo
/// </summary>
internal void CloseWindow()
/// <param name="isCheckboxChecked">If true, the user has chosen to not show splash screen on next run.</param>
internal void CloseWindow(bool isCheckboxChecked = false)
{
CloseWasExplicit = true;
if (viewModel != null && isCheckboxChecked)
{
viewModel.PreferenceSettings.EnableStaticSplashScreen = !isCheckboxChecked;
}

if (Application.Current != null)
{
Application.Current.Shutdown();
Expand Down Expand Up @@ -519,6 +525,9 @@ enum ImportStatus
success
}

/// <summary>
/// This class is used to expose the methods that can be called from the webview2 component, SplashScreen.
/// </summary>
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class ScriptObject
Expand All @@ -528,7 +537,12 @@ public class ScriptObject
readonly Func<bool> RequestSignIn;
readonly Func<bool> RequestSignOut;
readonly Action RequestCloseWindow;
readonly Action<bool> RequestCloseWindowPreserve;

/// <summary>
/// [Obsolete] Constructor for ScriptObject
/// </summary>
[Obsolete]
public ScriptObject(Action<bool> requestLaunchDynamo, Action<string> requestImportSettings, Func< bool> requestSignIn, Func<bool> requestSignOut, Action requestCloseWindow)
{
RequestLaunchDynamo = requestLaunchDynamo;
Expand All @@ -537,6 +551,17 @@ public ScriptObject(Action<bool> requestLaunchDynamo, Action<string> requestImpo
RequestSignOut = requestSignOut;
RequestCloseWindow = requestCloseWindow;
}
/// <summary>
/// Constructor for ScriptObject with an overload for close window method, to preserve "Don't show again" setting on splash screen on explicit close event.
/// </summary>
public ScriptObject(Action<bool> requestLaunchDynamo, Action<string> requestImportSettings, Func<bool> requestSignIn, Func<bool> requestSignOut, Action<bool> requestCloseWindow)
{
RequestLaunchDynamo = requestLaunchDynamo;
RequestImportSettings = requestImportSettings;
RequestSignIn = requestSignIn;
RequestSignOut = requestSignOut;
RequestCloseWindowPreserve = requestCloseWindow;
}

public void LaunchDynamo(bool showScreenAgain)
{
Expand All @@ -560,5 +585,9 @@ public void CloseWindow()
{
RequestCloseWindow();
}
public void CloseWindowPreserve(bool isCheckboxChecked)
{
RequestCloseWindowPreserve(isCheckboxChecked);
}
}
}

0 comments on commit cdf8c5a

Please sign in to comment.