From 48071f784b19ea8ed2859fb03642b8cc856406b1 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 14 Jan 2018 15:49:39 +0200 Subject: Added code comments for: MachineStudio.UI --- .../ViewModels/LoadingViewVM.cs | 13 ++++ .../ViewModels/LoginViewVM.cs | 25 ++++++- .../ViewModels/MachineConnectionViewVM.cs | 26 +++++++- .../ViewModels/MachineLoginViewVM.cs | 20 ++++++ .../ViewModels/MainViewVM.cs | 76 +++++++++++++++++++--- .../ViewModels/ShutdownViewVM.cs | 3 + 6 files changed, 150 insertions(+), 13 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels') 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 { + /// + /// Represents the Machine Studio loading view, view model. + /// + /// public class LoadingViewVM : ViewModel { private INotificationProvider _notificationProvider; private INavigationManager _navigationManager; private IStudioModuleLoader _studioModuleLoader; + /// + /// Initializes a new instance of the class. + /// + /// The navigation manager. + /// The studio module loader. + /// The notification provider. public LoadingViewVM(INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider) { _navigationManager = navigationManager; @@ -27,6 +37,9 @@ namespace Tango.MachineStudio.UI.ViewModels Load(); } + /// + /// Load application modules. + /// 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 { + /// + /// Represents the Machine Studio login view, view model. + /// + /// public class LoginViewVM : ViewModel { private IAuthenticationProvider _authenticationProvider; @@ -24,6 +28,9 @@ namespace Tango.MachineStudio.UI.ViewModels private Rfc2898Cryptographer cryptographer; private String _email; + /// + /// Gets or sets the email. + /// [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; - + /// + /// Gets or sets a value indicating whether to remember the last user email and password. + /// public bool RememberMe { get { return _rememberMe; } set { _rememberMe = value; RaisePropertyChangedAuto(); } } - + /// + /// Gets or sets the login command. + /// public RelayCommand LoginCommand { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The authentication provider. + /// The navigation manager. + /// The notification provider. public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider) { _notificationProvider = notificationProvider; @@ -55,6 +72,10 @@ namespace Tango.MachineStudio.UI.ViewModels RememberMe = SettingsManager.Default.MachineStudio.RememberMe; } + /// + /// Logins the requested user. + /// + /// The password. 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 { + /// + /// Represents the Machine Studio connection dialog, view model. + /// + /// public class MachineConnectionViewVM : DialogViewVM { private ExternalBridgeScanner _scanner; - + /// + /// Gets or sets the machine scanner. + /// public ExternalBridgeScanner Scanner { get { return _scanner; } @@ -21,15 +27,24 @@ namespace Tango.MachineStudio.UI.ViewModels } private IExternalBridgeClient _selectedMachine; - + /// + /// Gets or sets the selected machine. + /// public IExternalBridgeClient SelectedMachine { get { return _selectedMachine; } set { _selectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + /// + /// Gets or sets the connect command. + /// public RelayCommand ConnectCommand { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The scanner. public MachineConnectionViewVM(ExternalBridgeScanner scanner) { Scanner = scanner; @@ -37,6 +52,9 @@ namespace Tango.MachineStudio.UI.ViewModels Scanner.Start(); } + /// + /// Connect to the currently selected machine. + /// private void Connect() { if (SelectedMachine != null) @@ -45,10 +63,12 @@ namespace Tango.MachineStudio.UI.ViewModels } } + /// + /// Called when the dialog has been shown. + /// 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 { + /// + /// Represents the machine login dialog, view model. + /// + /// public class MachineLoginViewVM : DialogViewVM { + /// + /// Gets or sets the machine password. + /// public String Password { get; set; } + /// + /// Gets or sets the login command. + /// public RelayCommand LoginCommand { get; set; } + /// + /// Gets or sets the cancel command. + /// public RelayCommand CancelCommand { get; set; } + /// + /// Initializes a new instance of the class. + /// public MachineLoginViewVM() { LoginCommand = new RelayCommand(Login); CancelCommand = new RelayCommand(Cancel); } + /// + /// Invoked when user presses the login button. + /// + /// The password. 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 { + /// + /// Represents the Machine Studio main view, view model. + /// + /// public class MainViewVM : ViewModel { private IStudioModule _currentModule; private INavigationManager _navigation; private bool _isDisconnecting; + /// + /// Gets or sets the current loaded module. + /// public IStudioModule CurrentModule { get { return _currentModule; } @@ -36,33 +43,54 @@ namespace Tango.MachineStudio.UI.ViewModels } private bool _isModuleLoaded; - + /// + /// Gets or sets a value indicating whether any module is loaded at the moment. + /// public bool IsModuleLoaded { get { return _isModuleLoaded; } set { _isModuleLoaded = value; RaisePropertyChangedAuto(); } } - private bool _isMenuOpened; - + /// + /// Gets or sets a value indicating whether the side menu is opened. + /// public bool IsMenuOpened { get { return _isMenuOpened; } set { _isMenuOpened = value; RaisePropertyChangedAuto(); } } + /// + /// Gets or sets the start module command. + /// public RelayCommand StartModuleCommand { get; set; } + /// + /// Gets or sets the home command. + /// public RelayCommand HomeCommand { get; set; } + /// + /// Gets or sets the connect command. + /// public RelayCommand ConnectCommand { get; set; } + /// + /// Gets or sets the disconnect command. + /// public RelayCommand DisconnectCommand { get; set; } + /// + /// Gets or sets the sign-out command. + /// public RelayCommand SignoutCommand { get; set; } private IAuthenticationProvider _authenticationProvider; + /// + /// Gets or sets the authentication provider. + /// public IAuthenticationProvider AuthenticationProvider { get { return _authenticationProvider; } @@ -70,7 +98,9 @@ namespace Tango.MachineStudio.UI.ViewModels } private IStudioModuleLoader _studioModuleLoader; - + /// + /// Gets or sets the studio module loader. + /// public IStudioModuleLoader StudioModuleLoader { get { return _studioModuleLoader; } @@ -78,7 +108,9 @@ namespace Tango.MachineStudio.UI.ViewModels } private INotificationProvider _notificationProvider; - + /// + /// Gets or sets the notification provider. + /// public INotificationProvider NotificationProvider { get { return _notificationProvider; } @@ -86,15 +118,24 @@ namespace Tango.MachineStudio.UI.ViewModels } private IStudioApplicationManager _applicationManager; - + /// + /// Gets or sets the application manager. + /// public IStudioApplicationManager ApplicationManager { get { return _applicationManager; } set { _applicationManager = value; RaisePropertyChangedAuto(); } } - - + /// + /// Initializes a new instance of the class. + /// + /// The view. + /// The authentication provider. + /// The studio module loader. + /// The notification provider. + /// The application manager. + /// The navigation manager. public MainViewVM( IMainView view, IAuthenticationProvider authenticationProvider, @@ -117,6 +158,9 @@ namespace Tango.MachineStudio.UI.ViewModels DisconnectCommand = new RelayCommand(DisconnectFromMachine, (x) => ApplicationManager.IsMachineConnected && !_isDisconnecting); } + /// + /// Disconnected from the current connected machine. + /// private async void DisconnectFromMachine() { using (_notificationProvider.PushTaskItem("Disconnecting from machine...")) @@ -130,6 +174,9 @@ namespace Tango.MachineStudio.UI.ViewModels } } + /// + /// Signs-out the current logged-in user. + /// private void SignOut() { _authenticationProvider.Logout(); @@ -138,6 +185,9 @@ namespace Tango.MachineStudio.UI.ViewModels IsMenuOpened = false; } + /// + /// Opens the machine connection dialog to allow the user to scan and connect to remote machines view USB/TCP. + /// private void ConnectToMachine() { _notificationProvider.ShowModalDialog(async (x) => @@ -209,11 +259,18 @@ namespace Tango.MachineStudio.UI.ViewModels }); } + /// + /// Navigates to the home screen. + /// private void Home() { StartModule(null); } + /// + /// Starts the specified module. + /// + /// The module. private void StartModule(IStudioModule module) { IsMenuOpened = false; @@ -229,6 +286,9 @@ namespace Tango.MachineStudio.UI.ViewModels } } + /// + /// Called when the is loaded and attached. + /// 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 { + /// + /// Represents the Machine Studio shutdown view, view model. + /// public class ShutdownViewVM { } -- cgit v1.3.1