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)

* Update SplashScreen.xaml.cs

* Update SplashScreen.xaml.cs
  • Loading branch information
zeusongit authored Jan 22, 2024
1 parent 843a18b commit a48b686
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,14 @@ 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 (string.IsNullOrEmpty(DynamoModel.HostAnalyticsInfo.HostName))
{
Expand Down Expand Up @@ -563,6 +568,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 @@ -572,7 +580,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 @@ -581,6 +594,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 @@ -604,5 +628,9 @@ public void CloseWindow()
{
RequestCloseWindow();
}
public void CloseWindowPreserve(bool isCheckboxChecked)
{
RequestCloseWindowPreserve(isCheckboxChecked);
}
}
}

0 comments on commit a48b686

Please sign in to comment.