Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYN-6774 cherry pick [DYN-6621] so that splash screen close works. #15018

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}
Loading