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

ToolLayerReHeightControl.axaml.cs « Tools « Controls « UVtools.WPF - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 09d3ebbefae47bf9fa16133677f9a0abe62a0c33 (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
using Avalonia.Markup.Xaml;
using UVtools.Core.Operations;
using UVtools.WPF.Extensions;

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

        public OperationLayerReHeight.OperationLayerReHeightItem[] Presets => OperationLayerReHeight.GetItems(
            App.SlicerFile.LayerCount,
            (decimal)App.SlicerFile.LayerHeight);

        public string CurrentLayers => $"Current layers: {App.SlicerFile.LayerCount} at {App.SlicerFile.LayerHeight}mm";

        public ToolLayerReHeightControl()
        {
            InitializeComponent();
            BaseOperation = new OperationLayerReHeight();

            if (Presets.Length == 0)
            {
                App.MainWindow.MessageBoxInfo("No valid configuration to be able to re-height.\n" +
                                              "As workaround clone first or last layer and try re run this tool.", "Not possible to re-height");
                CanRun = false;
            }
            else
            {
                Operation.Item = Presets[0];
            }
        }

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