Index: DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs =================================================================== diff -u -r6352 -r6355 --- DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 6352) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 6355) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; +using System.Drawing; using System.IO; using System.Linq; using System.Text; @@ -731,43 +732,46 @@ string timeMessage; try { - Input input = FillXmlInputFromDamUi.CreateInput(damProject.DamProjectData); + DataEventPublisher.InvokeWithoutPublishingEvents(() => + { + Input input = FillXmlInputFromDamUi.CreateInput(damProject.DamProjectData); #if DEBUG - const string inputFilename = "InputFile.xml"; - DamXmlSerialization.SaveInputAsXmlFile(inputFilename, input); + const string inputFilename = "InputFile.xml"; + DamXmlSerialization.SaveInputAsXmlFile(inputFilename, input); #endif - string inputXml = DamXmlSerialization.SaveInputAsXmlString(input); + string inputXml = DamXmlSerialization.SaveInputAsXmlString(input); - var damEngineInterface = new EngineInterface(inputXml); - damEngineInterface.ProgressDelegate = progressDelegate; - string validationMessages = damEngineInterface.Validate(); + var damEngineInterface = new EngineInterface(inputXml); + 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) {