Index: DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs =================================================================== diff -u -r1400 -r1434 --- DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 1400) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 1434) @@ -75,7 +75,7 @@ private readonly Panel calculationSpecificationPanel = new Panel(); private readonly Panel stabilityKernelTypeSpecificationPanel = new Panel(); private readonly Panel sensorPanel = new Panel(); - private ProgressDelegate progressDelegate = null; + private Deltares.DamEngine.Data.Standard.Calculation.ProgressDelegate progressDelegate = null; private bool initial = true; private DAMNewProjectData damNewProjectData = null; @@ -660,7 +660,11 @@ LogManager.Clear(); damProject.DamProjectData.ClearResults(); }); - + var startTimeCalculation = DateTime.Now; + TimeSpan elapsedTime; + string openingMessage = LocalizationManager.GetTranslatedText(this, "CalculationFinished"); + string paragraphSepatator = Environment.NewLine + Environment.NewLine; + string timeMessage; try { Input input = FillXmlInputFromDamUi.CreateInput(damProject.DamProjectData); @@ -672,17 +676,22 @@ string inputXml = DamXmlSerialization.SaveInputAsXmlString(input); var damEnginInterface = new EngineInterface(inputXml); + damEnginInterface.ProgressDelegate = this.progressDelegate; string validationMessages = damEnginInterface.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)) { + // only if validation is ok, then string outputXml = damEnginInterface.Run(); var 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(openingMessage + paragraphSepatator + timeMessage); #if DEBUG const string outputFilename = "OutputFile.xml"; DamXmlSerialization.SaveOutputAsXmlFile(outputFilename, output); @@ -691,10 +700,11 @@ } catch (Exception e) { + elapsedTime = DateTime.Now - startTimeCalculation; + timeMessage = String.Format(LocalizationManager.GetTranslatedText(this, "CalculationTime"), elapsedTime.ToString(@"dd\.hh\:mm\:ss")); LogManager.Add(new LogMessage(LogMessageType.FatalError, typeof(EngineInterface), string.Format("{0}", e.Message))); - string openingMessage = LocalizationManager.GetTranslatedText(this, "CalculationFailed"); - string paragraphSepatator = Environment.NewLine + Environment.NewLine; - LocalizedMessageBox.ShowTranslatedText(openingMessage + paragraphSepatator + e.Message); + openingMessage = LocalizationManager.GetTranslatedText(this, "CalculationFailed"); + LocalizedMessageBox.ShowTranslatedText(openingMessage + paragraphSepatator + timeMessage + paragraphSepatator + e.Message); } this.damProject.SaveXMLProject(this.damProject.ProjectFileName, this.damProject); @@ -1220,7 +1230,7 @@ DataSourceManager.StartListening(); this.damProject.Import(damProjectFolder, dataSourceContainer, this.damNewProjectData.SelectedDikeRingIds, this.damNewProjectData.DamType, - this.damNewProjectData.DamProjectType, this.progressDelegate); + this.damNewProjectData.DamProjectType, null);//this.progressDelegate); // Importing data creates a new DamProjectData object so the values set in the dialog have to be reset. damProject.DamProjectData.DamProjectType = projectType;