Index: Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r7e20649afed3f6e23febb57c28bfc32fa75fedc6
--- Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 7e20649afed3f6e23febb57c28bfc32fa75fedc6)
@@ -50,6 +50,7 @@
using MessageBox = System.Windows.MessageBox;
#if INCLUDE_DEMOPROJECT
using Demo.Ringtoets.GUIs;
+
#endif
namespace Application.Ringtoets
@@ -69,6 +70,7 @@
private static RingtoetsGui gui;
private static int waitForProcessId = -1;
+ private static string fileToOpen = String.Empty;
private static Mutex singleInstanceMutex;
@@ -78,13 +80,14 @@
log.Info(Core.Common.Base.Properties.Resources.App_App_Ringtoets_Copyright);
- log.Info(Core.Common.Gui.Properties.Resources.App_App_Starting_Ringtoets);
+ log.Info(Core.Common.Gui.Properties.Resources.App_Starting_Ringtoets);
}
- public static void RunRingtoets(string file)
+ ///
+ /// Runs the main Ringtoets application.
+ ///
+ public static void RunRingtoets()
{
- log.Info(Core.Common.Gui.Properties.Resources.App_RunRingtoets_Starting_Ringtoets_Gui);
-
var loaderDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
if (loaderDirectory != null)
{
@@ -102,7 +105,7 @@
// handle exception from all threads except UI
AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;
- gui.Run(file);
+ gui.Run(fileToOpen);
// Ringtoets started, clean-up all possible memory
GC.Collect();
@@ -121,7 +124,6 @@
private void App_Startup(object sender, StartupEventArgs e)
{
ParseArguments(e.Args);
- var file = GetFileArgument(e.Args);
WaitForPreviousInstanceToExit();
if (ShutdownIfNotFirstInstance())
@@ -166,27 +168,24 @@
}
};
- RunRingtoets(file);
+ RunRingtoets();
mainWindow.Show();
}
- private string GetFileArgument(string[] args)
+ private static bool ParseFileArgument(string potentialPath)
{
- string potentialPath = null;
- if(args.Length > 0)
+ if (potentialPath.Length > 0)
{
- potentialPath = args.Last();
try
{
FileUtils.ValidateFilePath(potentialPath);
+ fileToOpen = potentialPath;
+ return true;
}
- catch (ArgumentException)
- {
- potentialPath = null;
- }
+ catch (ArgumentException) {}
}
- return potentialPath;
+ return false;
}
///
@@ -368,6 +367,11 @@
break;
}
}
+
+ if (ParseFileArgument(arg))
+ {
+ break;
+ }
}
}
Index: Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r7e20649afed3f6e23febb57c28bfc32fa75fedc6
--- Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision 7e20649afed3f6e23febb57c28bfc32fa75fedc6)
@@ -134,32 +134,6 @@
return true;
}
- ///
- /// Loads the project from the .
- ///
- /// The path to load a from.
- /// The loaded from or null if the project
- /// could not be loaded from .
- private Project LoadProjectFromStorage(string filePath)
- {
- Project loadedProject = null;
-
- try
- {
- loadedProject = projectPersistor.LoadProject(filePath);
- }
- catch (StorageException e)
- {
- log.Error(e.Message, e.InnerException);
- }
- catch (ArgumentException e)
- {
- log.Error(e.Message, e.InnerException);
- }
-
- return loadedProject;
- }
-
public void CloseProject()
{
if (projectOwner.Project == null)
@@ -236,6 +210,29 @@
}
///
+ /// Loads the project from the .
+ ///
+ /// The path to load a from.
+ /// The loaded from or null if the project
+ /// could not be loaded from .
+ /// is invalid.
+ private Project LoadProjectFromStorage(string filePath)
+ {
+ Project loadedProject = null;
+
+ try
+ {
+ loadedProject = projectPersistor.LoadProject(filePath);
+ }
+ catch (StorageException e)
+ {
+ log.Error(e.Message, e.InnerException);
+ }
+
+ return loadedProject;
+ }
+
+ ///
/// Prompts a new to select a location for saving the Ringtoets project file.
///
/// A string containing the file name selected in the file dialog box.
Index: Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs
===================================================================
diff -u -r5774b9c9fd8cc22fc2196ec871431631133e6221 -r7e20649afed3f6e23febb57c28bfc32fa75fedc6
--- Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5774b9c9fd8cc22fc2196ec871431631133e6221)
+++ Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7e20649afed3f6e23febb57c28bfc32fa75fedc6)
@@ -97,15 +97,6 @@
}
///
- /// Looks up a localized string similar to Ringtoets wordt gestart....
- ///
- public static string App_App_Starting_Ringtoets {
- get {
- return ResourceManager.GetString("App_App_Starting_Ringtoets", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to Onbekende kritieke fout opgetreden..
///
public static string App_AppDomain_UnhandledException_Unknown_exception_ {
@@ -133,21 +124,21 @@
}
///
- /// Looks up a localized string similar to Ringtoets wordt gestart....
+ /// Looks up a localized string similar to Kan niet meerdere instanties van Ringtoets starten. Sluit eerst de andere instantie..
///
- public static string App_RunRingtoets_Starting_Ringtoets_Gui {
+ public static string App_ShutdownIfNotFirstInstance_Cannot_start_multiple_instances_of_Ringtoets_Please_close_the_other_instance_first {
get {
- return ResourceManager.GetString("App_RunRingtoets_Starting_Ringtoets_Gui", resourceCulture);
+ return ResourceManager.GetString("App_ShutdownIfNotFirstInstance_Cannot_start_multiple_instances_of_Ringtoets_Pleas" +
+ "e_close_the_other_instance_first", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Kan niet meerdere instanties van Ringtoets starten. Sluit eerst de andere instantie..
+ /// Looks up a localized string similar to Ringtoets wordt gestart....
///
- public static string App_ShutdownIfNotFirstInstance_Cannot_start_multiple_instances_of_Ringtoets_Please_close_the_other_instance_first {
+ public static string App_Starting_Ringtoets {
get {
- return ResourceManager.GetString("App_ShutdownIfNotFirstInstance_Cannot_start_multiple_instances_of_Ringtoets_Pleas" +
- "e_close_the_other_instance_first", resourceCulture);
+ return ResourceManager.GetString("App_Starting_Ringtoets", resourceCulture);
}
}
Index: Core/Common/src/Core.Common.Gui/Properties/Resources.resx
===================================================================
diff -u -r5774b9c9fd8cc22fc2196ec871431631133e6221 -r7e20649afed3f6e23febb57c28bfc32fa75fedc6
--- Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 5774b9c9fd8cc22fc2196ec871431631133e6221)
+++ Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 7e20649afed3f6e23febb57c28bfc32fa75fedc6)
@@ -382,7 +382,7 @@
Help
-
+
Ringtoets wordt gestart...
@@ -556,9 +556,6 @@
Berekenen activiteit of model is beschikbaar in het project.
-
- Ringtoets wordt gestart...
-
Kon de gevraagde 'dock' opmaak niet laden. De instellingen zijn ongeldig en zullen teruggezet worden naar de standaardinstellingen.