Index: Application/Riskeer/src/Application.Riskeer/App.xaml.cs
===================================================================
diff -u -r3170342caedb06ec60b7f6944e8708d12f5033e8 -r606a620901f7ed35c8be6a23d27e57096fc5269d
--- Application/Riskeer/src/Application.Riskeer/App.xaml.cs (.../App.xaml.cs) (revision 3170342caedb06ec60b7f6944e8708d12f5033e8)
+++ Application/Riskeer/src/Application.Riskeer/App.xaml.cs (.../App.xaml.cs) (revision 606a620901f7ed35c8be6a23d27e57096fc5269d)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2021. All rights reserved.
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
//
// This file is part of Riskeer.
//
@@ -150,8 +150,6 @@
};
RunRiskeer();
-
- mainWindow.ShowStartScreen();
}
private void RunRiskeer()
Index: Core/Gui/src/Core.Gui/Forms/MainWindow/MainWindow.xaml.cs
===================================================================
diff -u -r3170342caedb06ec60b7f6944e8708d12f5033e8 -r606a620901f7ed35c8be6a23d27e57096fc5269d
--- Core/Gui/src/Core.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 3170342caedb06ec60b7f6944e8708d12f5033e8)
+++ Core/Gui/src/Core.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 606a620901f7ed35c8be6a23d27e57096fc5269d)
@@ -94,13 +94,6 @@
OpenLogFileCommand = new RelayCommand(OnOpenLogFile);
}
- public void ShowStartScreen()
- {
- var startScreen = new StartScreen();
- startScreen.Closed += (sender, args) => Close();
- startScreen.Show();
- }
-
///
/// Gets the .
///
@@ -190,7 +183,6 @@
applicationSelection = gui;
BackstageViewModel = new BackstageViewModel(settings.FixedSettings, SettingsHelper.Instance.ApplicationVersion);
-
}
///
@@ -441,7 +433,7 @@
CloseBackstage();
}
}
-
+
private void CloseBackstage()
{
if (BackstageDockPanel.Visibility == Visibility.Visible)
Index: Core/Gui/src/Core.Gui/GuiCore.cs
===================================================================
diff -u -rc15e5afd6206771891eb4295392897b9772a84be -r606a620901f7ed35c8be6a23d27e57096fc5269d
--- Core/Gui/src/Core.Gui/GuiCore.cs (.../GuiCore.cs) (revision c15e5afd6206771891eb4295392897b9772a84be)
+++ Core/Gui/src/Core.Gui/GuiCore.cs (.../GuiCore.cs) (revision 606a620901f7ed35c8be6a23d27e57096fc5269d)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2021. All rights reserved.
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
//
// This file is part of Riskeer.
//
@@ -50,7 +50,6 @@
using log4net;
using log4net.Appender;
using log4net.Repository.Hierarchy;
-using SplashScreen = Core.Gui.Forms.SplashScreen.SplashScreen;
using WindowsApplication = System.Windows.Forms.Application;
namespace Core.Gui
@@ -69,9 +68,10 @@
private ISelectionProvider currentSelectionProvider;
private bool isExiting;
- private bool runFinished;
- private SplashScreen splashScreen;
+ private StartScreen startScreen;
+ private bool startScreenShown;
+
///
/// Initializes a new instance of the class.
///
@@ -169,17 +169,17 @@
ConfigureLogging();
- ShowSplashScreen();
-
- InitializeProjectFromPath(projectPath);
-
Initialize();
log.InfoFormat(Resources.GuiCore_Run_Started_in_0_f2_sec, (DateTime.Now - startTime).TotalSeconds);
- runFinished = true;
+ ShowStartScreen();
- HideSplashScreen();
+ bool isPathGiven = !string.IsNullOrWhiteSpace(projectPath);
+ if (isPathGiven)
+ {
+ StorageCommands.OpenExistingProject(projectPath);
+ }
MessageWindowLogAppender.Instance.Enabled = true;
}
@@ -278,8 +278,6 @@
DocumentViewController = null;
}
- splashScreen = null;
-
MessageWindowLogAppender.Instance.MessageWindow = null;
RemoveLogging();
@@ -338,15 +336,29 @@
isAlreadyRunningInstanceOfIGui = false;
}
- private void InitializeProjectFromPath(string projectPath)
+ private void ShowStartScreen()
{
- bool isPathGiven = !string.IsNullOrWhiteSpace(projectPath);
- if (isPathGiven)
- {
- StorageCommands.OpenExistingProject(projectPath);
- }
+ startScreen = new StartScreen();
+ startScreen.Closed += OnStartScreenClosed;
+ startScreen.Show();
+
+ startScreenShown = true;
}
+ private void OnStartScreenClosed(object sender, EventArgs e)
+ {
+ ExitApplication();
+ }
+
+ private void ShowMainWindow()
+ {
+ startScreen.Closed -= OnStartScreenClosed;
+ startScreen.Close();
+ startScreenShown = false;
+
+ mainWindow.Show();
+ }
+
private void DeactivatePlugin(PluginBase plugin)
{
try
@@ -370,6 +382,11 @@
projectObserver.Observable = newProject;
UpdateProjectData();
mainWindow.UpdateProjectExplorer();
+
+ if (startScreenShown)
+ {
+ ShowMainWindow();
+ }
}
private void ApplicationBeforeProjectOpened(IProject oldProject)
@@ -406,35 +423,6 @@
InitializePlugins();
}
- private void ShowSplashScreen()
- {
- splashScreen = new SplashScreen
- {
- VersionText = SettingsHelper.Instance.ApplicationVersion
- };
-
- splashScreen.IsVisibleChanged += delegate
- {
- if (splashScreen.IsVisible)
- {
- return;
- }
-
- if (!runFinished) // splash screen was closed before gui started.
- {
- log.Info(Resources.GuiCore_ShowSplashScreen_User_has_canceled_start_Exiting);
- Environment.Exit(1);
- }
- };
-
- splashScreen.Show();
- }
-
- private void HideSplashScreen()
- {
- splashScreen.Shutdown();
- }
-
private void InitializeMainWindow()
{
mainWindow.Loaded += delegate