GrooveComputerVM.cs
1.71 KB
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
57
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using HHECS.RobotTool.Dto;
using HHECS.RobotTool.Service;
using MessageBox = HandyControl.Controls.MessageBox;
namespace HHECS.RobotTool.ViewModel
{
internal partial class GrooveComputerVM : ObservableObject
{
[ObservableProperty]
private RobotInputParameter inputParameter = new RobotInputParameter();
[ObservableProperty]
private RobotOutputParameter outputParameter = new RobotOutputParameter();
[ObservableProperty]
private List<RobotTechnology> technologies = new List<RobotTechnology>();
private readonly GrooveService _grooveService;
public GrooveComputerVM(GrooveService grooveService)
{
_grooveService = grooveService;
Reset();
}
[RelayCommand]
private void Computer()
{
var result = _grooveService.GetComputedData(InputParameter);
if (!result.Success)
{
MessageBox.Error($"数据计算出现异常:{result.Msg}");
return;
}
(OutputParameter, Technologies) = result.Data;
}
[RelayCommand]
private void Reset()
{
InputParameter = new RobotInputParameter
{
GrooveWidth = 37,
GrooveDepth = 30,
WeldingWire = 1.2,
ReservedGap = 0,
BluntEdgeSize = 2,
WeldLength = 1000,
WeldWidth = 1.5,
WeldHeight = 2
};
OutputParameter = new RobotOutputParameter();
Technologies = new List<RobotTechnology>();
}
}
}