From c3201c8e37578d32f1d3fc90fd0731d0e04696a6 Mon Sep 17 00:00:00 2001 From: Ashish Aggarwal Date: Fri, 19 Jan 2024 12:28:30 -0500 Subject: [PATCH] Update SplashScreen.xaml.cs --- .../Views/SplashScreen/SplashScreen.xaml.cs | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs b/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs index e2f35abbb8c..db6b87d04a0 100644 --- a/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs +++ b/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs @@ -568,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 @@ -576,9 +579,14 @@ public class ScriptObject readonly Action RequestImportSettings; readonly Func RequestSignIn; readonly Func RequestSignOut; - readonly Action RequestCloseWindow; + readonly Action RequestCloseWindow; + readonly Action RequestCloseWindowPreserve; - public ScriptObject(Action requestLaunchDynamo, Action requestImportSettings, Func< bool> requestSignIn, Func requestSignOut, Action requestCloseWindow) + /// + /// [Obsolete] Constructor for ScriptObject + /// + [Obsolete] + public ScriptObject(Action requestLaunchDynamo, Action requestImportSettings, Func< bool> requestSignIn, Func requestSignOut, Action requestCloseWindow) { RequestLaunchDynamo = requestLaunchDynamo; RequestImportSettings = requestImportSettings; @@ -586,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) { @@ -605,9 +624,13 @@ public bool SignOut() { return RequestSignOut(); } - public void CloseWindow(bool isCheckboxChecked) + public void CloseWindow() + { + RequestCloseWindow(); + } + public void CloseWindowPreserve(bool isCheckboxChecked) { - RequestCloseWindow(isCheckboxChecked); + RequestCloseWindowPreserve(isCheckboxChecked); } } }