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

ToolArithmeticControl.axaml.cs « Tools « Controls « UVtools.WPF - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 623633eec496529cca27cb52a75dc23daa5cc71d (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.Windows;

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

        public ToolArithmeticControl()
        {
            InitializeComponent();
            BaseOperation = new OperationArithmetic();
            Operation.PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == nameof(Operation.Sentence))
                {
                    ParentWindow.ButtonOkEnabled = !string.IsNullOrWhiteSpace(Operation.Sentence);
                }
            };
        }

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

        public override void Callback(ToolWindow.Callbacks callback)
        {
            switch (callback)
            {
                case ToolWindow.Callbacks.Init:
                    ParentWindow.ButtonOkEnabled = false;
                    break;
            }
        }
    }
}