aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs
blob: 7584617ed5acaa7f76cb784751dcbd514562ef09 (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
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.Commands;
using Tango.MachineStudio.Common.Notifications;
using Tango.PMR.Integration;
using Tango.SharedUI;

namespace Tango.MachineStudio.UI.ViewModels
{
    /// <summary>
    /// Represents the machine login dialog, view model.
    /// </summary>
    /// <seealso cref="Tango.MachineStudio.Common.Notifications.DialogViewVM" />
    public class MachineLoginViewVM : DialogViewVM
    {
        /// <summary>
        /// Gets or sets the machine password.
        /// </summary>
        public String Password { get; set; }

        /// <summary>
        /// Gets or sets the intent.
        /// </summary>
        public ExternalBridgeLoginIntent Intent { get; set; }

        /// <summary>
        /// Gets or sets the login command.
        /// </summary>
        public RelayCommand<String> LoginCommand { get; set; }

        /// <summary>
        /// Gets or sets the cancel command.
        /// </summary>
        public RelayCommand CancelCommand { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="MachineLoginViewVM"/> class.
        /// </summary>
        public MachineLoginViewVM()
        {
            Intent = ExternalBridgeLoginIntent.FullControl;
            LoginCommand = new RelayCommand<string>(Login);
            CancelCommand = new RelayCommand(Cancel);
        }

        /// <summary>
        /// Invoked when user presses the login button.
        /// </summary>
        /// <param name="password">The password.</param>
        private void Login(string password)
        {
            Password = password;
            Accept();
        }
    }
}