Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ToolLayerRemoveControl.axaml.cs « Tools « Controls « UVtools.WPF - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f4be3b77fe8babe1384a300cc4f8629798e4d34a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using Avalonia.Markup.Xaml;
using UVtools.Core.Operations;

namespace UVtools.WPF.Controls.Tools
{
    public class ToolLayerRemoveControl : ToolControl
    {
        public OperationLayerRemove Operation => BaseOperation as OperationLayerRemove;

        public uint ExtraLayers => (uint)Math.Max(0, (int)Operation.LayerIndexEnd - Operation.LayerIndexStart + 1);

        public string InfoLayersStr
        {
            get
            {
                uint extraLayers = ExtraLayers;
                return $"Layers: {App.SlicerFile.LayerCount} → {App.SlicerFile.LayerCount - extraLayers} (- {extraLayers})";
            }
        }

        public string InfoHeightsStr
        {
            get
            {
                float extraHeight = (float)Math.Round(ExtraLayers * App.SlicerFile.LayerHeight, 2);
                return $"Height: {App.SlicerFile.PrintHeight}mm → {Math.Round(App.SlicerFile.PrintHeight - extraHeight, 2)}mm (- {extraHeight}mm)";
            }
        }

        public ToolLayerRemoveControl()
        {
            InitializeComponent();
            BaseOperation = new OperationLayerRemove();
            Operation.PropertyChanged += (sender, args) =>
            {
                RaisePropertyChanged(nameof(InfoLayersStr));
                RaisePropertyChanged(nameof(InfoHeightsStr));
            };

        }

        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);
        }
    }
}