Index: DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs =================================================================== diff -u -r6355 -r6356 --- DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 6355) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 6356) @@ -732,46 +732,46 @@ string timeMessage; try { + Input localInput = null; DataEventPublisher.InvokeWithoutPublishingEvents(() => { Input input = FillXmlInputFromDamUi.CreateInput(damProject.DamProjectData); - + localInput = input; #if DEBUG const string inputFilename = "InputFile.xml"; - DamXmlSerialization.SaveInputAsXmlFile(inputFilename, input); + DamXmlSerialization.SaveInputAsXmlFile(inputFilename, localInput); #endif - string inputXml = DamXmlSerialization.SaveInputAsXmlString(input); + }); - var damEngineInterface = new EngineInterface(inputXml); - damEngineInterface.ProgressDelegate = progressDelegate; - string validationMessages = damEngineInterface.Validate(); + var damEngineInterface = new EngineInterface(localInput); + damEngineInterface.ProgressDelegate = progressDelegate; + string validationMessages = damEngineInterface.Validate(); - // now the validation messages should be deserialized. If any, they should be passed on to the Validator - // and checked for errors. IF errors are found, then no calculation. When no messages or only warnings then - // do calculate. For now, just check length - if (string.IsNullOrEmpty(validationMessages)) - { - // Temporarily disable multicore calculation - ThrowHelper.ThrowWhenConditionIsTrue( - "Multicore is currently not supported. Change number of cores to 1 in Tools menu.", () => damEngineInterface.DamProjectData.MaxCalculationCores > 1); + // now the validation messages should be deserialized. If any, they should be passed on to the Validator + // and checked for errors. IF errors are found, then no calculation. When no messages or only warnings then + // do calculate. For now, just check length + if (string.IsNullOrEmpty(validationMessages)) + { + // Temporarily disable multicore calculation + ThrowHelper.ThrowWhenConditionIsTrue( + "Multicore is currently not supported. Change number of cores to 1 in Tools menu.", () => damEngineInterface.DamProjectData.MaxCalculationCores > 1); - // only if validation is ok, then - string outputXml = damEngineInterface.Run(); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputXml); - FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProject.DamProjectData, output); - elapsedTime = DateTime.Now - startTimeCalculation; - timeMessage = String.Format(LocalizationManager.GetTranslatedText(this, "CalculationTime"), elapsedTime.ToString(@"dd\.hh\:mm\:ss")); - LocalizedMessageBox.ShowTranslatedText(mainForm, openingMessage + paragraphSepatator + timeMessage); + // only if validation is ok, then + string outputXml = damEngineInterface.Run(); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputXml); + FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProject.DamProjectData, output); + elapsedTime = DateTime.Now - startTimeCalculation; + timeMessage = String.Format(LocalizationManager.GetTranslatedText(this, "CalculationTime"), elapsedTime.ToString(@"dd\.hh\:mm\:ss")); + LocalizedMessageBox.ShowTranslatedText(mainForm, openingMessage + paragraphSepatator + timeMessage); #if DEBUG - const string outputFilename = "OutputFile.xml"; - DamXmlSerialization.SaveOutputAsXmlFile(outputFilename, output); + const string outputFilename = "OutputFile.xml"; + DamXmlSerialization.SaveOutputAsXmlFile(outputFilename, output); #endif - } - else - { - LogManager.Add(new LogMessage(LogMessageType.Error, typeof(EngineInterface), string.Format("{0}", validationMessages))); - } - }); + } + else + { + LogManager.Add(new LogMessage(LogMessageType.Error, typeof(EngineInterface), string.Format("{0}", validationMessages))); + } } catch (Exception e) {