aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs
blob: 35a4b0e9dcb6069bd3a978f02a65d6c8011b1689 (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
69
70
71
72
73
74
75
76
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,
        }

        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 ConnectedMachineViewVM(IStudioApplicationManager application, IDiagnosticsFrameProvider frameProvider)
        {
            ApplicationManager = application;
            DisconnectCommand = new RelayCommand(Disconnect);
            UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration);
            ResetCommand = new RelayCommand(Reset);

            DiagnosticsFrameProvider = frameProvider;
        }

        private void Reset()
        {
            Result = ConnectedMachineVMResult.Reset;
            Accept();
        }

        private void UploadHardwareConfiguration()
        {
            Result = ConnectedMachineVMResult.UploadHardwareConfig;
            Accept();
        }

        private void Disconnect()
        {
            Result = ConnectedMachineVMResult.Disconnect;
            Accept();
        }
    }
}