Index: DamClients/DamUI/trunk/src/Dam/Forms/DikePropertyControl.cs =================================================================== diff -u -r6436 -r6759 --- DamClients/DamUI/trunk/src/Dam/Forms/DikePropertyControl.cs (.../DikePropertyControl.cs) (revision 6436) +++ DamClients/DamUI/trunk/src/Dam/Forms/DikePropertyControl.cs (.../DikePropertyControl.cs) (revision 6759) @@ -19,10 +19,15 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Windows.Forms; using Deltares.Dam.Data; +using Deltares.Standard; +using Deltares.Standard.Calculate; +using Deltares.Standard.EventPublisher; using Deltares.Standard.Forms; using Deltares.Standard.Forms.DExpress; +using ProgressDelegate = Deltares.DamEngine.Data.Standard.Calculation.ProgressDelegate; namespace Deltares.Dam.Forms { @@ -37,10 +42,55 @@ BindSupport.BindTextAndValue(this, NameLabel, NameTextEdit, typeof(Dike), "Name"); BindSupport.BindTextAndValue(this, DescriptionLabel, DescriptionTextEdit, typeof(Dike), "Description"); - LocalizationSupport.Register(typeof(Dike), groupControl1); + DataEventPublisher.OnAfterChange += DataEventPublisher_OnAfterChange; + LocalizationSupport.Register(typeof(Dike), CalculationGroup, groupControl1); FormsSupport.RepairRightAnchoredControls(this); } + public void DoProgress(double progress) + { + if (InvokeRequired) + { + Invoke(new ProgressDelegate(DoProgress), progress); + } + else + { + CalculationProgressBar.EditValue = Math.Round(100 * progress); + + if (!CalculationGroup.Visible && progress < 1) + { + CalculationGroup.Visible = true; + } + + Refresh(); + } + } + + private void DataEventPublisher_OnAfterChange(object sender, PublishEventArgs e) + { + if (InvokeRequired) + { + Invoke(new DataEventPublisherEventDelegate(DataEventPublisher_OnAfterChange), sender, e); + } + else + { + if (sender is CalculationManager) + { + bool running = ((CalculationManager) sender).IsRunning; + CalculationGroup.Visible = running; + + if (!running) + { + CalculationProgressBar.EditValue = 0; + } + } + else if (sender == dike) + { + DataEventPublisher.AfterChange(this); + } + } + } + public object SelectedObject { get @@ -65,7 +115,7 @@ dike = dikeJob.Dike; } } - + CalculationGroup.Visible = false; BindSupport.Assign(this, dike); NameTextEdit.Enabled = false; }