aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Tango.FSE.UI/Panes/ConnectedMachinePaneVM.cs
blob: 817a6626a357b2e3df1f3e39214c4c1a09b85939 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.Commands;
using Tango.Core.DI;
using Tango.FSE.Common.Connection;
using Tango.FSE.Common.Diagnostics;
using Tango.FSE.Common.SystemInfo;
using Tango.Integration.ExternalBridge;
using Tango.SharedUI;

namespace Tango.FSE.UI.Panes
{
    /// <summary>
    /// Represents the connected machine view model.
    /// </summary>
    /// <seealso cref="Tango.SharedUI.ViewModel" />
    public class ConnectedMachinePaneVM : ViewModel
    {
        [TangoInject(Mode = TangoInjectMode.WhenAvailable)]
        public IMachineProvider MachineProvider { get; set; }

        [TangoInject(Mode = TangoInjectMode.WhenAvailable)]
        public IDiagnosticsProvider DiagnosticsProvider { get; set; }

        [TangoInject(Mode = TangoInjectMode.WhenAvailable)]
        public ISystemInfoProvider SystemInfoProvider { get; set; }

        /// <summary>
        /// Occurs when the user chose to close the current machine connection.
        /// </summary>
        public event EventHandler DisconnectedFromMachine;

        /// <summary>
        /// Closes the machine connection.
        /// </summary>
        public RelayCommand DisconnectCommand { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ConnectedMachinePaneVM"/> class.
        /// </summary>
        public ConnectedMachinePaneVM()
        {
            TangoIOC.Default.Inject(this);

            DisconnectCommand = new RelayCommand(Disconnect);
        }

        private void Disconnect()
        {
            DisconnectedFromMachine?.Invoke(this, new EventArgs());
        }
    }
}