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

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

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

        public ToolLayerArithmeticControl()
        {
            BaseOperation = new OperationLayerArithmetic(SlicerFile);
            if (!ValidateSpawn()) return;
            InitializeComponent();
        }

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

        public override void Callback(ToolWindow.Callbacks callback)
        {
            switch (callback)
            {
                case ToolWindow.Callbacks.Init:
                case ToolWindow.Callbacks.Loaded:
                    ParentWindow.ButtonOkEnabled = !string.IsNullOrWhiteSpace(Operation.Sentence);
                    Operation.PropertyChanged += (sender, e) =>
                    {
                        if (e.PropertyName == nameof(Operation.Sentence))
                        {
                            ParentWindow.ButtonOkEnabled = !string.IsNullOrWhiteSpace(Operation.Sentence);
                        }
                    };
                    break;
            }
        }
    }
}