diff --git a/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs b/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
index a77a4d5ad49..10ebfb3326a 100644
--- a/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
+++ b/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
@@ -90,8 +90,6 @@ public DynamoView DynamoView
return;
}
viewModel = value.DataContext as DynamoViewModel;
- // When view model is closed, we need to close the splash screen if it is displayed.
- viewModel.RequestClose += SplashScreenRequestClose;
authManager = viewModel.Model.AuthenticationManager;
}
}
@@ -229,18 +227,6 @@ private void WebView_NavigationCompleted(object sender, CoreWebView2NavigationCo
}
}
- ///
- /// Request to close SplashScreen.
- ///
- private void SplashScreenRequestClose(object sender, EventArgs e)
- {
- //This is only called when shutdownparams.closeDynamoView = true
- //which is during tests or an exit command
- //which is used rarely, but it is used when the Revit document is lost and Dynamo is open.
- CloseWindow();
- viewModel.RequestClose -= SplashScreenRequestClose;
- }
-
///
/// Import setting file from chosen path
///
@@ -399,7 +385,7 @@ protected override async void OnContentRendered(EventArgs e)
webView.NavigateToString(htmlString);
webView.CoreWebView2.AddHostObjectToScript("scriptObject",
- new ScriptObject(RequestLaunchDynamo, RequestImportSettings, RequestSignIn, RequestSignOut, CloseWindow));
+ new ScriptObject(RequestLaunchDynamo, RequestImportSettings, RequestSignIn, RequestSignOut));
}
catch (ObjectDisposedException ex)
{
@@ -578,41 +564,6 @@ private static bool IsValidPreferencesFile(string filePath)
}
}
- ///
- /// If the user wants to close the window, we shutdown the application and don't launch Dynamo
- ///
- /// If true, the user has chosen to not show splash screen on next run.
- internal void CloseWindow(bool isCheckboxChecked = false)
- {
- CloseWasExplicit = true;
- currentCloseMode = CloseMode.ByCloseButton;
-
- if (viewModel != null && isCheckboxChecked)
- {
- viewModel.PreferenceSettings.EnableStaticSplashScreen = !isCheckboxChecked;
- }
-
- if (string.IsNullOrEmpty(DynamoModel.HostAnalyticsInfo.HostName))
- {
- Application.Current?.Shutdown();
- Analytics.TrackEvent(Actions.Close, Categories.SplashScreenOperations);
- }
- // If Dynamo is launched from an integrator host, user should be able to close the splash screen window.
- // Additionally, we will have to shutdown the ViewModel which will close all the services and dispose the events.
- // RequestUpdateLoadBarStatus event needs to be unsubscribed when the splash screen window is closed, to avoid populating the info on splash screen.
- else
- {
- Close();
- if (viewModel != null)
- {
- viewModel.RequestClose -= SplashScreenRequestClose;
- }
-
- DynamoView?.Close();
- DynamoView = null;
- }
- }
-
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
@@ -653,31 +604,17 @@ public class ScriptObject
readonly Action RequestImportSettings;
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)
+ public ScriptObject(Action requestLaunchDynamo, Action requestImportSettings, Func< bool> requestSignIn, Func requestSignOut)
{
RequestLaunchDynamo = requestLaunchDynamo;
RequestImportSettings = requestImportSettings;
RequestSignIn = requestSignIn;
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;
}
[DynamoJSInvokable]
public void LaunchDynamo(bool showScreenAgain)
@@ -700,16 +637,5 @@ public bool SignOut()
{
return RequestSignOut();
}
- [Obsolete]
- [DynamoJSInvokable]
- public void CloseWindow()
- {
- RequestCloseWindow();
- }
- [DynamoJSInvokable]
- public void CloseWindowPreserve(bool isCheckboxChecked)
- {
- RequestCloseWindowPreserve(isCheckboxChecked);
- }
}
}
diff --git a/test/DynamoCoreWpfTests/SplashScreenTests.cs b/test/DynamoCoreWpfTests/SplashScreenTests.cs
index 088e2ec64c2..7c28cb5a5c2 100644
--- a/test/DynamoCoreWpfTests/SplashScreenTests.cs
+++ b/test/DynamoCoreWpfTests/SplashScreenTests.cs
@@ -10,25 +10,6 @@
namespace DynamoCoreWpfTests
{
- [TestFixture]
- class SplashScreenViewTests: DynamoTestUIBase
- {
- [Test]
- public void SplashScreen_ClosePersistSetsPrefs()
- {
- var ss = new Dynamo.UI.Views.SplashScreen();
- ss.DynamoView = View;
- var oldPref = ViewModel.PreferenceSettings.EnableStaticSplashScreen;
- Assert.IsTrue(oldPref);
-
- ss.CloseWindow(true);
- var newPref = ViewModel.PreferenceSettings.EnableStaticSplashScreen;
- Assert.False(newPref);
-
- Assert.IsTrue(ss.CloseWasExplicit);
- }
- }
-
[TestFixture]
internal class SplashScreenTests
{
@@ -58,34 +39,7 @@ public void CleanUp()
{
TestUtilities.WebView2Tag = string.Empty;
}
-
- [Test]
- public void SplashScreen_CloseExplicitPropIsCorrect1()
- {
- var ss = new Dynamo.UI.Views.SplashScreen();
- ss.RequestLaunchDynamo(true);
- Assert.IsFalse(ss.CloseWasExplicit);
-
- ss.CloseWindow();
- }
-
- [Test]
- public void SplashScreen_CloseExplicitPropIsCorrect2()
- {
- var ss = new Dynamo.UI.Views.SplashScreen();
- Assert.IsFalse(ss.CloseWasExplicit);
-
- ss.CloseWindow();
- }
-
- [Test]
- public void SplashScreen_CloseExplicitPropIsCorrect3()
- {
- var ss = new Dynamo.UI.Views.SplashScreen();
- ss.CloseWindow();
- Assert.IsTrue(ss.CloseWasExplicit);
- }
-
+
[Test]
//note that this test sends a windows close message directly to the window
//but skips the JS interop that users rely on to close the window - so that is not tested by this test.