diff --git a/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs b/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs index 44918de435b..db6b87d04a0 100644 --- a/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs +++ b/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs @@ -513,9 +513,14 @@ private static bool IsValidPreferencesFile(string filePath) /// /// If the user wants to close the window, we shutdown the application and don't launch Dynamo /// - internal void CloseWindow() + /// If true, the user has chosen to not show splash screen on next run. + internal void CloseWindow(bool isCheckboxChecked = false) { CloseWasExplicit = true; + if (viewModel != null && isCheckboxChecked) + { + viewModel.PreferenceSettings.EnableStaticSplashScreen = !isCheckboxChecked; + } if (string.IsNullOrEmpty(DynamoModel.HostAnalyticsInfo.HostName)) { @@ -563,6 +568,9 @@ enum ImportStatus success } + /// + /// This class is used to expose the methods that can be called from the webview2 component, SplashScreen. + /// [ClassInterface(ClassInterfaceType.AutoDual)] [ComVisible(true)] public class ScriptObject @@ -572,7 +580,12 @@ public class ScriptObject readonly Func RequestSignIn; readonly Func RequestSignOut; readonly Action RequestCloseWindow; + readonly Action RequestCloseWindowPreserve; + /// + /// [Obsolete] Constructor for ScriptObject + /// + [Obsolete] public ScriptObject(Action requestLaunchDynamo, Action requestImportSettings, Func< bool> requestSignIn, Func requestSignOut, Action requestCloseWindow) { RequestLaunchDynamo = requestLaunchDynamo; @@ -581,6 +594,17 @@ public ScriptObject(Action requestLaunchDynamo, Action requestImpo RequestSignOut = requestSignOut; RequestCloseWindow = requestCloseWindow; } + /// + /// Constructor for ScriptObject with an overload for close window method, to preserve "Don't show again" setting on splash screen on explicit close event. + /// + public ScriptObject(Action requestLaunchDynamo, Action requestImportSettings, Func requestSignIn, Func requestSignOut, Action requestCloseWindow) + { + RequestLaunchDynamo = requestLaunchDynamo; + RequestImportSettings = requestImportSettings; + RequestSignIn = requestSignIn; + RequestSignOut = requestSignOut; + RequestCloseWindowPreserve = requestCloseWindow; + } public void LaunchDynamo(bool showScreenAgain) { @@ -604,5 +628,9 @@ public void CloseWindow() { RequestCloseWindow(); } + public void CloseWindowPreserve(bool isCheckboxChecked) + { + RequestCloseWindowPreserve(isCheckboxChecked); + } } }