blob: 9eac9e53f98ec9ef982cee41d2c6425fb40c9302 (
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
|
using System.Diagnostics;
using System.Timers;
using Avalonia.Markup.Xaml;
using UVtools.Core.Operations;
namespace UVtools.WPF.Controls.Tools
{
public class ToolChangeResolutionControl : ToolControl
{
private OperationChangeResolution.Resolution _selectedPresetItem;
public OperationChangeResolution Operation => BaseOperation as OperationChangeResolution;
public OperationChangeResolution.Resolution SelectedPresetItem
{
get => _selectedPresetItem;
set
{
RaiseAndSetIfChanged(ref _selectedPresetItem, value);
if (_selectedPresetItem is null || _selectedPresetItem.IsEmpty) return;
Operation.NewResolutionX = _selectedPresetItem.ResolutionX;
Operation.NewResolutionY = _selectedPresetItem.ResolutionY;
//SelectedPresetItem = null;
Timer timer = new(1);
timer.Elapsed += (sender, args) =>
{
SelectedPresetItem = null;
timer.Dispose();
};
timer.Start();
}
}
public ToolChangeResolutionControl()
{
BaseOperation = new OperationChangeResolution(SlicerFile);
if (!ValidateSpawn()) return;
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|