diff options
Diffstat (limited to 'UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml.cs')
-rw-r--r-- | UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml.cs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml.cs b/UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml.cs index c342418..71c173d 100644 --- a/UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml.cs +++ b/UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml.cs @@ -1,4 +1,5 @@ -using Avalonia.Markup.Xaml; +using System; +using Avalonia.Markup.Xaml; using UVtools.Core.FileFormats; using UVtools.Core.Operations; @@ -6,10 +7,17 @@ namespace UVtools.WPF.Controls.Tools { public class ToolCalculatorControl : ToolControl { + private decimal _lightOffDelayPrintTimeHours; public OperationCalculator Operation => BaseOperation as OperationCalculator; public FileFormat SlicerFile => App.SlicerFile; + public decimal LightOffDelayPrintTimeHours + { + get => _lightOffDelayPrintTimeHours; + set => RaiseAndSetIfChanged(ref _lightOffDelayPrintTimeHours, value); + } + public ToolCalculatorControl() { InitializeComponent(); @@ -21,6 +29,19 @@ namespace UVtools.WPF.Controls.Tools (decimal)SlicerFile.LiftSpeed, (decimal)SlicerFile.BottomLiftSpeed, (decimal)SlicerFile.RetractSpeed, (decimal)SlicerFile.RetractSpeed) }; + + Operation.CalcLightOffDelay.PropertyChanged += (sender, e) => + { + if (e.PropertyName != nameof(Operation.CalcLightOffDelay.LightOffDelay) && + e.PropertyName != nameof(Operation.CalcLightOffDelay.BottomLightOffDelay)) return; + LightOffDelayPrintTimeHours = Math.Round( + (FileFormat.ExtraPrintTime + + SlicerFile.BottomLayerCount * (Operation.CalcLightOffDelay.BottomLightOffDelay + (decimal) SlicerFile.BottomExposureTime) + + SlicerFile.NormalLayerCount * (Operation.CalcLightOffDelay.LightOffDelay + (decimal)SlicerFile.ExposureTime)) + / 3600, 2); + }; + + _lightOffDelayPrintTimeHours = (decimal) SlicerFile.PrintTimeHours; } private void InitializeComponent() @@ -45,6 +66,8 @@ namespace UVtools.WPF.Controls.Tools SlicerFile.LayerOffTime = (float)Operation.CalcLightOffDelay.LightOffDelay; } + LightOffDelayPrintTimeHours = (decimal)SlicerFile.PrintTimeHours; + App.MainWindow.CanSave = true; } } |