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

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

namespace UVtools.WPF.Controls.Tools
{
    public class ToolDynamicLiftsControl : ToolControl
    {
        public OperationDynamicLifts Operation => BaseOperation as OperationDynamicLifts;
        public ToolDynamicLiftsControl()
        {
            InitializeComponent();
            BaseOperation = new OperationDynamicLifts(SlicerFile);
            if (!SlicerFile.HavePrintParameterPerLayerModifier(FileFormat.PrintParameterModifier.LiftHeight) ||
                !SlicerFile.HavePrintParameterPerLayerModifier(FileFormat.PrintParameterModifier.LiftSpeed))
            {
                App.MainWindow.MessageBoxInfo("Your printer/format does not support this tool.", "Dynamic lifts - Printer not supported");
                CanRun = false;
            }
        }

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

        public void ViewSmallestLayer(bool isBottom)
        {
            var layerFound = Operation.GetSmallestLayer(isBottom);
            if (layerFound is null) return;
            App.MainWindow.ActualLayer = layerFound.Index;
        }

        public void ViewLargestLayer(bool isBottom)
        {
            var layerFound = Operation.GetLargestLayer(isBottom);
            if (layerFound is null) return;
            App.MainWindow.ActualLayer = layerFound.Index;
        }
    }
}