Index: Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs =================================================================== diff -u -r96fff35cedc43c8be2da620efa3d1b9cb3e42238 -r81fe6a7333c95776d8312b396a32ec045ea34bd1 --- Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 96fff35cedc43c8be2da620efa3d1b9cb3e42238) +++ Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 81fe6a7333c95776d8312b396a32ec045ea34bd1) @@ -39,6 +39,7 @@ using Core.Common.Gui.Appenders; using Core.Common.Gui.Forms.MainWindow; using Core.Common.Gui.Settings; +using Core.Common.Utils; using Core.Plugins.CommonTools; using Core.Plugins.DotSpatial; using Core.Plugins.OxyPlot; @@ -80,7 +81,7 @@ log.Info(Core.Common.Gui.Properties.Resources.App_App_Starting_Ringtoets); } - public static void RunRingtoets() + public static void RunRingtoets(string file) { log.Info(Core.Common.Gui.Properties.Resources.App_RunRingtoets_Starting_Ringtoets_Gui); @@ -101,7 +102,7 @@ // handle exception from all threads except UI AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException; - gui.Run(); + gui.Run(file); // Ringtoets started, clean-up all possible memory GC.Collect(); @@ -120,6 +121,7 @@ private void App_Startup(object sender, StartupEventArgs e) { ParseArguments(e.Args); + var file = GetFileArgument(e.Args); WaitForPreviousInstanceToExit(); if (ShutdownIfNotFirstInstance()) @@ -164,11 +166,29 @@ } }; - RunRingtoets(); + RunRingtoets(file); mainWindow.Show(); } + private string GetFileArgument(string[] args) + { + string potentialPath = null; + if(args.Length > 0) + { + potentialPath = args.Last(); + try + { + FileUtils.ValidateFilePath(potentialPath); + } + catch (ArgumentException) + { + potentialPath = null; + } + } + return potentialPath; + } + /// /// app.config has been configured to use /// to write log files to the ringtoets user data folder. This method deletes the old log files