blob: 2762a3c76b6c21c65d76bebdd8dc0a050d8ea680 (
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
|
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 Timer(1);
timer.Elapsed += (sender, args) =>
{
SelectedPresetItem = null;
timer.Dispose();
};
timer.Start();
}
}
public ToolChangeResolutionControl()
{
InitializeComponent();
BaseOperation = new OperationChangeResolution(App.SlicerFile.Resolution, App.SlicerFile.LayerManager.BoundingRectangle);
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|