diff options
Diffstat (limited to 'UVtools.Core/Operations/OperationThreshold.cs')
-rw-r--r-- | UVtools.Core/Operations/OperationThreshold.cs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/UVtools.Core/Operations/OperationThreshold.cs b/UVtools.Core/Operations/OperationThreshold.cs index f3776a4..b85d6b4 100644 --- a/UVtools.Core/Operations/OperationThreshold.cs +++ b/UVtools.Core/Operations/OperationThreshold.cs @@ -47,6 +47,14 @@ namespace UVtools.Core.Operations } #endregion + #region Constructor + + public OperationThreshold() { } + + public OperationThreshold(FileFormat slicerFile) : base(slicerFile) { } + + #endregion + #region Properties public byte Threshold { @@ -71,17 +79,15 @@ namespace UVtools.Core.Operations #region Methods - public override bool Execute(FileFormat slicerFile, OperationProgress progress = null) + protected override bool ExecuteInternally(OperationProgress progress) { - progress ??= new OperationProgress(); - progress.Reset(ProgressAction, LayerRangeCount); Parallel.For(LayerIndexStart, LayerIndexEnd + 1, layerIndex => { if (progress.Token.IsCancellationRequested) return; - using (var mat = slicerFile[layerIndex].LayerMat) + using (var mat = SlicerFile[layerIndex].LayerMat) { Execute(mat); - slicerFile[layerIndex].LayerMat = mat; + SlicerFile[layerIndex].LayerMat = mat; } lock (progress.Mutex) @@ -89,9 +95,8 @@ namespace UVtools.Core.Operations progress++; } }); - progress.Token.ThrowIfCancellationRequested(); - return true; + return !progress.Token.IsCancellationRequested; } public override bool Execute(Mat mat, params object[] arguments) |