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/MainViewVM.cs | 76 +++++++++++++++++++--- 1 file changed, 68 insertions(+), 8 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs') 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(); -- cgit v1.3.1