blob: 5e01d2b6bc79d49c6a7274d1e47ed8b2cc427e4c (
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
49
50
51
52
53
54
55
56
|
using Avalonia.Markup.Xaml;
using UVtools.Core.Operations;
using UVtools.WPF.Windows;
namespace UVtools.WPF.Controls.Tools
{
public class ToolMoveControl : ToolControl
{
private bool _isMiddleCenterChecked = true;
public OperationMove Operation => BaseOperation as OperationMove;
public bool IsMiddleCenterChecked
{
get => _isMiddleCenterChecked;
set => RaiseAndSetIfChanged(ref _isMiddleCenterChecked, value);
}
public ToolMoveControl()
{
InitializeComponent();
var roi = App.MainWindow.ROI;
BaseOperation = new OperationMove(SlicerFile, roi);
Operation.PropertyChanged += (sender, e) =>
{
if (e.PropertyName.Equals(nameof(Operation.IsWithinBoundary)))
{
ParentWindow.ButtonOkEnabled = Operation.IsWithinBoundary;
}
};
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public override void Callback(ToolWindow.Callbacks callback)
{
switch (callback)
{
case ToolWindow.Callbacks.Init:
ParentWindow.IsButton1Visible = true;
break;
case ToolWindow.Callbacks.ClearROI:
Operation.ROI = App.SlicerFile.LayerManager.BoundingRectangle;
Operation.Reset();
break;
case ToolWindow.Callbacks.Button1:
Operation.Reset();
IsMiddleCenterChecked = true;
break;
}
}
}
}
|