diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-14 15:49:39 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-14 15:49:39 +0200 |
| commit | 48071f784b19ea8ed2859fb03642b8cc856406b1 (patch) | |
| tree | 2a3152e7188da7c184005e3bff0c7171b7ecfaf2 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels | |
| parent | a20fd4bd769aeccd1fd1f20273f895c92a5b5bb8 (diff) | |
| download | Tango-48071f784b19ea8ed2859fb03642b8cc856406b1.tar.gz Tango-48071f784b19ea8ed2859fb03642b8cc856406b1.zip | |
Added code comments for:
MachineStudio.UI
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels')
6 files changed, 150 insertions, 13 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 5d341b835..54e2f9196 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -13,12 +13,22 @@ using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels { + /// <summary> + /// Represents the Machine Studio loading view, view model. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> public class LoadingViewVM : ViewModel { private INotificationProvider _notificationProvider; private INavigationManager _navigationManager; private IStudioModuleLoader _studioModuleLoader; + /// <summary> + /// Initializes a new instance of the <see cref="LoadingViewVM"/> class. + /// </summary> + /// <param name="navigationManager">The navigation manager.</param> + /// <param name="studioModuleLoader">The studio module loader.</param> + /// <param name="notificationProvider">The notification provider.</param> public LoadingViewVM(INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider) { _navigationManager = navigationManager; @@ -27,6 +37,9 @@ namespace Tango.MachineStudio.UI.ViewModels Load(); } + /// <summary> + /// Load application modules. + /// </summary> private void Load() { ThreadsHelper.StartStaThread(() => diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs index 6fe90fa99..c5936eea8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -16,6 +16,10 @@ using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels { + /// <summary> + /// Represents the Machine Studio login view, view model. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> public class LoginViewVM : ViewModel { private IAuthenticationProvider _authenticationProvider; @@ -24,6 +28,9 @@ namespace Tango.MachineStudio.UI.ViewModels private Rfc2898Cryptographer cryptographer; private String _email; + /// <summary> + /// Gets or sets the email. + /// </summary> [Required(ErrorMessage = "Email is required")] [EmailAddress(ErrorMessage = "Please enter a valid email")] public String Email @@ -33,16 +40,26 @@ namespace Tango.MachineStudio.UI.ViewModels } private bool _rememberMe; - + /// <summary> + /// Gets or sets a value indicating whether to remember the last user email and password. + /// </summary> public bool RememberMe { get { return _rememberMe; } set { _rememberMe = value; RaisePropertyChangedAuto(); } } - + /// <summary> + /// Gets or sets the login command. + /// </summary> public RelayCommand<String> LoginCommand { get; set; } + /// <summary> + /// Initializes a new instance of the <see cref="LoginViewVM"/> class. + /// </summary> + /// <param name="authenticationProvider">The authentication provider.</param> + /// <param name="navigationManager">The navigation manager.</param> + /// <param name="notificationProvider">The notification provider.</param> public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider) { _notificationProvider = notificationProvider; @@ -55,6 +72,10 @@ namespace Tango.MachineStudio.UI.ViewModels RememberMe = SettingsManager.Default.MachineStudio.RememberMe; } + /// <summary> + /// Logins the requested user. + /// </summary> + /// <param name="password">The password.</param> private void Login(String password) { if (Validate()) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs index b8b888e86..23be8d274 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -10,10 +10,16 @@ using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels { + /// <summary> + /// Represents the Machine Studio connection dialog, view model. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Common.Notifications.DialogViewVM" /> public class MachineConnectionViewVM : DialogViewVM { private ExternalBridgeScanner _scanner; - + /// <summary> + /// Gets or sets the machine scanner. + /// </summary> public ExternalBridgeScanner Scanner { get { return _scanner; } @@ -21,15 +27,24 @@ namespace Tango.MachineStudio.UI.ViewModels } private IExternalBridgeClient _selectedMachine; - + /// <summary> + /// Gets or sets the selected machine. + /// </summary> public IExternalBridgeClient SelectedMachine { get { return _selectedMachine; } set { _selectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + /// <summary> + /// Gets or sets the connect command. + /// </summary> public RelayCommand ConnectCommand { get; set; } + /// <summary> + /// Initializes a new instance of the <see cref="MachineConnectionViewVM"/> class. + /// </summary> + /// <param name="scanner">The scanner.</param> public MachineConnectionViewVM(ExternalBridgeScanner scanner) { Scanner = scanner; @@ -37,6 +52,9 @@ namespace Tango.MachineStudio.UI.ViewModels Scanner.Start(); } + /// <summary> + /// Connect to the currently selected machine. + /// </summary> private void Connect() { if (SelectedMachine != null) @@ -45,10 +63,12 @@ namespace Tango.MachineStudio.UI.ViewModels } } + /// <summary> + /// Called when the dialog has been shown. + /// </summary> public override void OnShow() { base.OnShow(); - Scanner.AvailableMachines.Clear(); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs index a6ee9ee2a..20c2e3afb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs @@ -8,20 +8,40 @@ using Tango.MachineStudio.Common.Notifications; 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 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() { 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; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index ceb81a66f..fcbdc90a3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -23,12 +23,19 @@ using Tango.Transport.Adapters; namespace Tango.MachineStudio.UI.ViewModels { + /// <summary> + /// Represents the Machine Studio main view, view model. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel{Tango.MachineStudio.UI.SupervisingController.IMainView}" /> public class MainViewVM : ViewModel<IMainView> { private IStudioModule _currentModule; private INavigationManager _navigation; private bool _isDisconnecting; + /// <summary> + /// Gets or sets the current loaded module. + /// </summary> public IStudioModule CurrentModule { get { return _currentModule; } @@ -36,33 +43,54 @@ namespace Tango.MachineStudio.UI.ViewModels } private bool _isModuleLoaded; - + /// <summary> + /// Gets or sets a value indicating whether any module is loaded at the moment. + /// </summary> public bool IsModuleLoaded { get { return _isModuleLoaded; } set { _isModuleLoaded = value; RaisePropertyChangedAuto(); } } - private bool _isMenuOpened; - + /// <summary> + /// Gets or sets a value indicating whether the side menu is opened. + /// </summary> public bool IsMenuOpened { get { return _isMenuOpened; } set { _isMenuOpened = value; RaisePropertyChangedAuto(); } } + /// <summary> + /// Gets or sets the start module command. + /// </summary> public RelayCommand<IStudioModule> StartModuleCommand { get; set; } + /// <summary> + /// Gets or sets the home command. + /// </summary> public RelayCommand HomeCommand { get; set; } + /// <summary> + /// Gets or sets the connect command. + /// </summary> public RelayCommand ConnectCommand { get; set; } + /// <summary> + /// Gets or sets the disconnect command. + /// </summary> public RelayCommand DisconnectCommand { get; set; } + /// <summary> + /// Gets or sets the sign-out command. + /// </summary> public RelayCommand SignoutCommand { get; set; } private IAuthenticationProvider _authenticationProvider; + /// <summary> + /// Gets or sets the authentication provider. + /// </summary> public IAuthenticationProvider AuthenticationProvider { get { return _authenticationProvider; } @@ -70,7 +98,9 @@ namespace Tango.MachineStudio.UI.ViewModels } private IStudioModuleLoader _studioModuleLoader; - + /// <summary> + /// Gets or sets the studio module loader. + /// </summary> public IStudioModuleLoader StudioModuleLoader { get { return _studioModuleLoader; } @@ -78,7 +108,9 @@ namespace Tango.MachineStudio.UI.ViewModels } private INotificationProvider _notificationProvider; - + /// <summary> + /// Gets or sets the notification provider. + /// </summary> public INotificationProvider NotificationProvider { get { return _notificationProvider; } @@ -86,15 +118,24 @@ namespace Tango.MachineStudio.UI.ViewModels } private IStudioApplicationManager _applicationManager; - + /// <summary> + /// Gets or sets the application manager. + /// </summary> public IStudioApplicationManager ApplicationManager { get { return _applicationManager; } set { _applicationManager = value; RaisePropertyChangedAuto(); } } - - + /// <summary> + /// Initializes a new instance of the <see cref="MainViewVM"/> class. + /// </summary> + /// <param name="view">The view.</param> + /// <param name="authenticationProvider">The authentication provider.</param> + /// <param name="studioModuleLoader">The studio module loader.</param> + /// <param name="notificationProvider">The notification provider.</param> + /// <param name="applicationManager">The application manager.</param> + /// <param name="navigationManager">The navigation manager.</param> public MainViewVM( IMainView view, IAuthenticationProvider authenticationProvider, @@ -117,6 +158,9 @@ namespace Tango.MachineStudio.UI.ViewModels DisconnectCommand = new RelayCommand(DisconnectFromMachine, (x) => ApplicationManager.IsMachineConnected && !_isDisconnecting); } + /// <summary> + /// Disconnected from the current connected machine. + /// </summary> private async void DisconnectFromMachine() { using (_notificationProvider.PushTaskItem("Disconnecting from machine...")) @@ -130,6 +174,9 @@ namespace Tango.MachineStudio.UI.ViewModels } } + /// <summary> + /// Signs-out the current logged-in user. + /// </summary> private void SignOut() { _authenticationProvider.Logout(); @@ -138,6 +185,9 @@ namespace Tango.MachineStudio.UI.ViewModels IsMenuOpened = false; } + /// <summary> + /// Opens the machine connection dialog to allow the user to scan and connect to remote machines view USB/TCP. + /// </summary> private void ConnectToMachine() { _notificationProvider.ShowModalDialog<MachineConnectionViewVM>(async (x) => @@ -209,11 +259,18 @@ namespace Tango.MachineStudio.UI.ViewModels }); } + /// <summary> + /// Navigates to the home screen. + /// </summary> private void Home() { StartModule(null); } + /// <summary> + /// Starts the specified module. + /// </summary> + /// <param name="module">The module.</param> private void StartModule(IStudioModule module) { IsMenuOpened = false; @@ -229,6 +286,9 @@ namespace Tango.MachineStudio.UI.ViewModels } } + /// <summary> + /// Called when the <see cref="T:Tango.SharedUI.IView" /> is loaded and attached. + /// </summary> protected override void OnViewAttached() { base.OnViewAttached(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ShutdownViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ShutdownViewVM.cs index c7a919a82..ed771f00a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ShutdownViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ShutdownViewVM.cs @@ -6,6 +6,9 @@ using System.Threading.Tasks; namespace Tango.MachineStudio.UI.ViewModels { + /// <summary> + /// Represents the Machine Studio shutdown view, view model. + /// </summary> public class ShutdownViewVM { } |
