blob: 5467c53a0aefb70cc035828cbd85f4efb5cdb80f (
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
57
58
59
60
61
62
63
64
65
66
67
68
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.MachineStudio.Common.Diagnostics;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.Common.StudioApplication;
using Tango.SharedUI;
namespace Tango.MachineStudio.UI.ViewModels
{
public class ConnectedMachineViewVM : DialogViewVM
{
public enum ConnectedMachineVMResult
{
Cancel,
Disconnect,
UploadHardwareConfig,
Reset,
TurnOffHeaters
}
private IStudioApplicationManager _applicationManager;
public IStudioApplicationManager ApplicationManager
{
get { return _applicationManager; }
set { _applicationManager = value; RaisePropertyChangedAuto(); }
}
public ConnectedMachineVMResult Result { get; set; }
private IDiagnosticsFrameProvider _diagnosticsFrameProvider;
public IDiagnosticsFrameProvider DiagnosticsFrameProvider
{
get { return _diagnosticsFrameProvider; }
set { _diagnosticsFrameProvider = value; RaisePropertyChangedAuto(); }
}
public RelayCommand DisconnectCommand { get; set; }
public RelayCommand UploadHardwareConfigurationCommand { get; set; }
public RelayCommand ResetCommand { get; set; }
public RelayCommand TurnOffHeatersCommand { get; set; }
public ConnectedMachineViewVM(IStudioApplicationManager application, IDiagnosticsFrameProvider frameProvider)
{
ApplicationManager = application;
DisconnectCommand = new RelayCommand(() => AcceptResult(ConnectedMachineVMResult.Disconnect));
UploadHardwareConfigurationCommand = new RelayCommand(() => AcceptResult(ConnectedMachineVMResult.UploadHardwareConfig));
ResetCommand = new RelayCommand(() => AcceptResult(ConnectedMachineVMResult.Reset));
TurnOffHeatersCommand = new RelayCommand(() => AcceptResult(ConnectedMachineVMResult.TurnOffHeaters));
DiagnosticsFrameProvider = frameProvider;
}
private void AcceptResult(ConnectedMachineVMResult result)
{
Result = result;
Accept();
}
}
}
|