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 --- .../DefaultAuthenticationProvider.cs | 22 +++++- .../Modules/DefaultStudioModuleLoader.cs | 23 +++++++ .../Navigation/DefaultNavigationManager.cs | 8 +++ .../Notifications/DefaultNotificationProvider.cs | 80 ++++++++++++++++++++++ .../Notifications/DialogWindow.xaml.cs | 2 - .../DefaultStudioApplicationManager.cs | 35 ++++++++++ .../SupervisingController/IMainView.cs | 4 ++ .../Tango.MachineStudio.UI.csproj | 4 +- .../Tango.MachineStudio.UI/ViewModelLocator.cs | 7 +- .../ViewModels/LoadingViewVM.cs | 13 ++++ .../ViewModels/LoginViewVM.cs | 25 ++++++- .../ViewModels/MachineConnectionViewVM.cs | 26 ++++++- .../ViewModels/MachineLoginViewVM.cs | 20 ++++++ .../ViewModels/MainViewVM.cs | 76 +++++++++++++++++--- .../ViewModels/ShutdownViewVM.cs | 3 + 15 files changed, 327 insertions(+), 21 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index a30cf0f92..80e5e9762 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -10,10 +10,17 @@ using Tango.MachineStudio.Common.Authentication; namespace Tango.MachineStudio.UI.Authentication { + /// + /// Represents the default Machine Studio Authentication provider + /// + /// + /// public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider { private User _currentUser; - + /// + /// Gets the current logged-in user. + /// public User CurrentUser { get { return _currentUser; } @@ -25,8 +32,18 @@ namespace Tango.MachineStudio.UI.Authentication } } + /// + /// Occurs when the current logged-in user has changed. + /// public event EventHandler CurrentUserChanged; + /// + /// Performs a user login by the specified email and password. + /// + /// The email. + /// The password. + /// + /// Login failed for user " + email public User Login(string email, string password) { User user = ObservablesEntitiesAdapter.Instance.Users.SingleOrDefault(x => x.Email.ToLower() == email.ToLower() && x.Password == password); @@ -40,6 +57,9 @@ namespace Tango.MachineStudio.UI.Authentication return user; } + /// + /// Logs-out the current logged-in user. + /// public void Logout() { CurrentUser = null; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs index 473e66d38..5944af2d1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -16,11 +16,20 @@ using Tango.MachineStudio.Stubs; namespace Tango.MachineStudio.UI.Modules { + /// + /// Represents the Machine Studio default module loader. + /// + /// + /// public class DefaultStudioModuleLoader : ExtendedObject, IStudioModuleLoader { private IAuthenticationProvider _authenticationProvider; private bool _loaded; + /// + /// Initializes a new instance of the class. + /// + /// The authentication provider. public DefaultStudioModuleLoader(IAuthenticationProvider authenticationProvider) { _authenticationProvider = authenticationProvider; @@ -29,12 +38,20 @@ namespace Tango.MachineStudio.UI.Modules _authenticationProvider.CurrentUserChanged += _authenticationProvider_CurrentUserChanged; } + /// + /// Handles the authentication provider user changed event. + /// + /// The sender. + /// The e. private void _authenticationProvider_CurrentUserChanged(object sender, DAL.Observables.User e) { LoadModules(); } private ObservableCollection _allModules; + /// + /// Gets all loaded modules. + /// public ObservableCollection AllModules { get { return _allModules; } @@ -42,12 +59,18 @@ namespace Tango.MachineStudio.UI.Modules } private ObservableCollection _userModules; + /// + /// Gets all the user permitted modules. + /// public ObservableCollection UserModules { get { return _userModules; } private set { _userModules = value; RaisePropertyChangedAuto(); } } + /// + /// Loads all available Machine Studio modules. + /// public void LoadModules() { if (!_loaded) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs index 15f2fe422..2fa8c7562 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs @@ -7,8 +7,16 @@ using Tango.MachineStudio.Common.Navigation; namespace Tango.MachineStudio.UI.Navigation { + /// + /// Represents the Machine Studio default Navigation Manager. + /// + /// public class DefaultNavigationManager : INavigationManager { + /// + /// Navigates to the specified view. + /// + /// The view. public void NavigateTo(NavigationView view) { MainWindow.Instance.Dispatcher.Invoke(() => diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index 6b6d59c63..8ca933397 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -13,30 +13,61 @@ using System.Collections.ObjectModel; namespace Tango.MachineStudio.UI.Notifications { + /// + /// Represents the default Machine Studio Notification Provider. + /// + /// + /// public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + /// + /// The view types + /// private static List viewTypes; + /// + /// Gets the collection of active task items. + /// public ObservableCollection TaskItems { get; private set; } + /// + /// Gets a value indicating whether there are any queued task items. + /// public bool HasTaskItems { get { return TaskItems.Count > 0; } } + /// + /// The current task item + /// private TaskItem _currentTaskItem; + /// + /// Gets the current displayed task item. + /// public TaskItem CurrentTaskItem { get { return _currentTaskItem; } set { _currentTaskItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasTaskItems)); } } + /// + /// Initializes a new instance of the class. + /// public DefaultNotificationProvider() { TaskItems = new ObservableCollection(); } + /// + /// Display a message box. + /// + /// The icon. + /// Color of the icon. + /// The message. + /// if set to true displays the cancel button. + /// public bool? ShowMessageBox(PackIconKind icon, Brush iconColor, string message, bool hasCancel) { MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; @@ -55,6 +86,13 @@ namespace Tango.MachineStudio.UI.Notifications return result; } + /// + /// Creates a new instance of the specified View type and displays it as a modal dialog. + /// + /// The type of the view. + /// The type of the view model. + /// Accept button callback. + /// Cancel button callback. public void ShowModalDialog(Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM { var view = Activator.CreateInstance(); @@ -97,6 +135,13 @@ namespace Tango.MachineStudio.UI.Notifications MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; } + /// + /// Creates a new view by a naming convention of the specified view model type. + /// + /// The type of the view model. + /// Accept button callback. + /// Cancel button callback. + /// Could not locate view " + viewName public void ShowModalDialog(Action onAccept, Action onCancel) where VM : DialogViewVM { String viewName = typeof(VM).Name.Replace("VM", ""); @@ -154,37 +199,68 @@ namespace Tango.MachineStudio.UI.Notifications MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; } + /// + /// Creates a new view by a naming convention of the specified view model type. + /// + /// The type of the view model. + /// Accept button callback. public void ShowModalDialog(Action onAccept) where VM : DialogViewVM { ShowModalDialog(onAccept, null); } + /// + /// Shows an error message box. + /// + /// The message. public void ShowError(string message) { ShowMessageBox(PackIconKind.Exclamation, Brushes.Red, message, false); } + /// + /// Shows an information message box. + /// + /// The message. public void ShowInfo(string message) { ShowMessageBox(PackIconKind.Information, Brushes.Black, message, false); } + /// + /// Shows a question message box. + /// + /// The message. + /// public bool ShowQuestion(string message) { return ShowMessageBox(PackIconKind.CommentQuestionOutline, Brushes.Black, message, true).Value; } + /// + /// Shows warning message box. + /// + /// The message. public void ShowWarning(string message) { ShowMessageBox(PackIconKind.Exclamation, Brushes.DarkOrange, message, false); } + /// + /// Pushes the specified task item to the queue. + /// + /// The task item. public void PushTaskItem(TaskItem taskItem) { TaskItems.Add(taskItem); CurrentTaskItem = taskItem; } + /// + /// Create and push a new task item from the specified message. + /// + /// The message. + /// public TaskItem PushTaskItem(string message) { TaskItem item = new TaskItem(this); @@ -193,6 +269,10 @@ namespace Tango.MachineStudio.UI.Notifications return item; } + /// + /// Removed the specified task item from the queue. + /// + /// The task item. public void PopTaskItem(TaskItem taskItem) { TaskItems.Remove(taskItem); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs index d1bc0564b..8ed1a4946 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs @@ -36,7 +36,5 @@ namespace Tango.MachineStudio.UI.Windows // Using a DependencyProperty as the backing store for InnerContent. This enables animation, styling, binding, etc... public static readonly DependencyProperty InnerContentProperty = DependencyProperty.Register("InnerContent", typeof(FrameworkElement), typeof(DialogWindow), new PropertyMetadata(null)); - - } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 36b5074cb..68af7bdc3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -17,19 +17,40 @@ using Tango.Logging; namespace Tango.MachineStudio.UI.StudioApplication { + /// + /// Represents the default Machine Studio Application Manager. + /// + /// + /// public class DefaultStudioApplicationManager : ExtendedObject, IStudioApplicationManager { + /// + /// The navigation manager + /// private INavigationManager _navigationManager; + /// + /// Initializes a new instance of the class. + /// + /// The navigation manager. public DefaultStudioApplicationManager(INavigationManager navigationManager) { _navigationManager = navigationManager; } + /// + /// Gets a value indicating whether Machine Studio is shutting down. + /// public bool IsShuttingDown { get; private set; } + /// + /// The connected machine + /// private IExternalBridgeClient _connectedMachine; + /// + /// Gets or sets the currently connected machine if any. + /// public IExternalBridgeClient ConnectedMachine { get { return _connectedMachine; } @@ -48,11 +69,19 @@ namespace Tango.MachineStudio.UI.StudioApplication } } + /// + /// Gets a value indicating whether the is valid and connected through TCP/IP. + /// public bool IsMachineConnectedViaTCP { get { return IsMachineConnected && ConnectedMachine is ExternalBridgeTcpClient; } } + /// + /// Handles the state changed event. + /// + /// The sender. + /// The e. private void ConnectedMachine_StateChanged(object sender, Transport.TransportComponentState e) { if (e == Transport.TransportComponentState.Disconnected || e == Transport.TransportComponentState.Failed) @@ -62,11 +91,17 @@ namespace Tango.MachineStudio.UI.StudioApplication } + /// + /// Gets a value indicating whether the is valid. + /// public bool IsMachineConnected { get { return ConnectedMachine != null; } } + /// + /// Shutdown the application. + /// public async void ShutDown() { if (IsShuttingDown) return; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs index 70b57027e..3de061de8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs @@ -7,6 +7,10 @@ using Tango.SharedUI; namespace Tango.MachineStudio.UI.SupervisingController { + /// + /// Represents a supervising controller pattern view contract. + /// + /// public interface IMainView : IView { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index df8b65fda..fcc790d7a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -311,9 +311,7 @@ - - - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 70912ba98..5f315f7f4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -65,8 +65,11 @@ namespace Tango.MachineStudio.UI SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); - LogManager.RegisterLogger(new VSOutputLogger()); - LogManager.RegisterLogger(new FileLogger()); + if (!ViewModelBase.IsInDesignModeStatic) + { + LogManager.RegisterLogger(new VSOutputLogger()); + LogManager.RegisterLogger(new FileLogger()); + } //Register View (Supervising Controller Pattern). if (!ViewModelBase.IsInDesignModeStatic) 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