Subtract 2 is working well now and rebuilding

Cleaning up On Invalidate and rebuild

issue: MatterHackers/MCCentral#4965
Rebuild should directly call base.OnInvalidate to prevent re-entering this.OnInvalidate

issue: MatterHackers/MCCentral#4964
Rebuild should fire Invalidate if content is changed

issue: MatterHackers/MCCentral#4970
Consider if primitives should use background tasks in Rebuild

issue: MatterHackers/MCCentral#4966
async Rebuild calls must be awaited in Create methods
This commit is contained in:
Lars Brubaker 2019-02-12 15:56:28 -08:00
parent 7598c8bf9c
commit 51d7193bf0
18 changed files with 109 additions and 136 deletions

View file

@ -28,14 +28,11 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.DesignTools.Operations;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.DesignTools
@ -73,12 +70,12 @@ namespace MatterHackers.MatterControl.DesignTools
public double EndingAngle { get; set; } = 360;
public int LatitudeSides { get; set; } = 30;
public override void OnInvalidate(InvalidateArgs invalidateType)
public override async void OnInvalidate(InvalidateArgs invalidateType)
{
if (invalidateType.InvalidateType.HasFlag(InvalidateType.Properties)
&& invalidateType.Source == this)
{
Rebuild();
await Rebuild();
}
else
{
@ -128,13 +125,12 @@ namespace MatterHackers.MatterControl.DesignTools
}
}
Invalidate(InvalidateType.Mesh);
if (valuesChanged)
{
Invalidate(InvalidateType.DisplayValues);
}
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
return Task.CompletedTask;
}