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 | |
| 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')
15 files changed, 327 insertions, 21 deletions
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 { + /// <summary> + /// Represents the default Machine Studio <see cref="IAuthenticationProvider">Authentication provider</see> + /// </summary> + /// <seealso cref="Tango.Core.ExtendedObject" /> + /// <seealso cref="Tango.MachineStudio.Common.Authentication.IAuthenticationProvider" /> public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider { private User _currentUser; - + /// <summary> + /// Gets the current logged-in user. + /// </summary> public User CurrentUser { get { return _currentUser; } @@ -25,8 +32,18 @@ namespace Tango.MachineStudio.UI.Authentication } } + /// <summary> + /// Occurs when the current logged-in user has changed. + /// </summary> public event EventHandler<User> CurrentUserChanged; + /// <summary> + /// Performs a user login by the specified email and password. + /// </summary> + /// <param name="email">The email.</param> + /// <param name="password">The password.</param> + /// <returns></returns> + /// <exception cref="AuthenticationException">Login failed for user " + email</exception> 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; } + /// <summary> + /// Logs-out the current logged-in user. + /// </summary> 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 { + /// <summary> + /// Represents the Machine Studio default <see cref="IStudioModuleLoader">module loader</see>. + /// </summary> + /// <seealso cref="Tango.Core.ExtendedObject" /> + /// <seealso cref="Tango.MachineStudio.Common.Modules.IStudioModuleLoader" /> public class DefaultStudioModuleLoader : ExtendedObject, IStudioModuleLoader { private IAuthenticationProvider _authenticationProvider; private bool _loaded; + /// <summary> + /// Initializes a new instance of the <see cref="DefaultStudioModuleLoader"/> class. + /// </summary> + /// <param name="authenticationProvider">The authentication provider.</param> public DefaultStudioModuleLoader(IAuthenticationProvider authenticationProvider) { _authenticationProvider = authenticationProvider; @@ -29,12 +38,20 @@ namespace Tango.MachineStudio.UI.Modules _authenticationProvider.CurrentUserChanged += _authenticationProvider_CurrentUserChanged; } + /// <summary> + /// Handles the authentication provider user changed event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="e">The e.</param> private void _authenticationProvider_CurrentUserChanged(object sender, DAL.Observables.User e) { LoadModules(); } private ObservableCollection<IStudioModule> _allModules; + /// <summary> + /// Gets all loaded modules. + /// </summary> public ObservableCollection<IStudioModule> AllModules { get { return _allModules; } @@ -42,12 +59,18 @@ namespace Tango.MachineStudio.UI.Modules } private ObservableCollection<IStudioModule> _userModules; + /// <summary> + /// Gets all the user permitted modules. + /// </summary> public ObservableCollection<IStudioModule> UserModules { get { return _userModules; } private set { _userModules = value; RaisePropertyChangedAuto(); } } + /// <summary> + /// Loads all available Machine Studio modules. + /// </summary> 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 { + /// <summary> + /// Represents the Machine Studio default <see cref="INavigationManager">Navigation Manager</see>. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Common.Navigation.INavigationManager" /> public class DefaultNavigationManager : INavigationManager { + /// <summary> + /// Navigates to the specified view. + /// </summary> + /// <param name="view">The view.</param> 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 { + /// <summary> + /// Represents the default Machine Studio <see cref="INotificationProvider">Notification Provider</see>. + /// </summary> + /// <seealso cref="Tango.Core.ExtendedObject" /> + /// <seealso cref="Tango.MachineStudio.Common.Notifications.INotificationProvider" /> public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + /// <summary> + /// The view types + /// </summary> private static List<Type> viewTypes; + /// <summary> + /// Gets the collection of active task items. + /// </summary> public ObservableCollection<TaskItem> TaskItems { get; private set; } + /// <summary> + /// Gets a value indicating whether there are any queued task items. + /// </summary> public bool HasTaskItems { get { return TaskItems.Count > 0; } } + /// <summary> + /// The current task item + /// </summary> private TaskItem _currentTaskItem; + /// <summary> + /// Gets the current displayed task item. + /// </summary> public TaskItem CurrentTaskItem { get { return _currentTaskItem; } set { _currentTaskItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasTaskItems)); } } + /// <summary> + /// Initializes a new instance of the <see cref="DefaultNotificationProvider"/> class. + /// </summary> public DefaultNotificationProvider() { TaskItems = new ObservableCollection<TaskItem>(); } + /// <summary> + /// Display a message box. + /// </summary> + /// <param name="icon">The icon.</param> + /// <param name="iconColor">Color of the icon.</param> + /// <param name="message">The message.</param> + /// <param name="hasCancel">if set to <c>true</c> displays the cancel button.</param> + /// <returns></returns> 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; } + /// <summary> + /// Creates a new instance of the specified View type and displays it as a modal dialog. + /// </summary> + /// <typeparam name="View">The type of the view.</typeparam> + /// <typeparam name="VM">The type of the view model.</typeparam> + /// <param name="onAccept">Accept button callback.</param> + /// <param name="onCancel">Cancel button callback.</param> public void ShowModalDialog<View, VM>(Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM { var view = Activator.CreateInstance<View>(); @@ -97,6 +135,13 @@ namespace Tango.MachineStudio.UI.Notifications MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; } + /// <summary> + /// Creates a new view by a naming convention of the specified view model type. + /// </summary> + /// <typeparam name="VM">The type of the view model.</typeparam> + /// <param name="onAccept">Accept button callback.</param> + /// <param name="onCancel">Cancel button callback.</param> + /// <exception cref="NullReferenceException">Could not locate view " + viewName</exception> public void ShowModalDialog<VM>(Action<VM> 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; } + /// <summary> + /// Creates a new view by a naming convention of the specified view model type. + /// </summary> + /// <typeparam name="VM">The type of the view model.</typeparam> + /// <param name="onAccept">Accept button callback.</param> public void ShowModalDialog<VM>(Action<VM> onAccept) where VM : DialogViewVM { ShowModalDialog<VM>(onAccept, null); } + /// <summary> + /// Shows an error message box. + /// </summary> + /// <param name="message">The message.</param> public void ShowError(string message) { ShowMessageBox(PackIconKind.Exclamation, Brushes.Red, message, false); } + /// <summary> + /// Shows an information message box. + /// </summary> + /// <param name="message">The message.</param> public void ShowInfo(string message) { ShowMessageBox(PackIconKind.Information, Brushes.Black, message, false); } + /// <summary> + /// Shows a question message box. + /// </summary> + /// <param name="message">The message.</param> + /// <returns></returns> public bool ShowQuestion(string message) { return ShowMessageBox(PackIconKind.CommentQuestionOutline, Brushes.Black, message, true).Value; } + /// <summary> + /// Shows warning message box. + /// </summary> + /// <param name="message">The message.</param> public void ShowWarning(string message) { ShowMessageBox(PackIconKind.Exclamation, Brushes.DarkOrange, message, false); } + /// <summary> + /// Pushes the specified task item to the queue. + /// </summary> + /// <param name="taskItem">The task item.</param> public void PushTaskItem(TaskItem taskItem) { TaskItems.Add(taskItem); CurrentTaskItem = taskItem; } + /// <summary> + /// Create and push a new task item from the specified message. + /// </summary> + /// <param name="message">The message.</param> + /// <returns></returns> public TaskItem PushTaskItem(string message) { TaskItem item = new TaskItem(this); @@ -193,6 +269,10 @@ namespace Tango.MachineStudio.UI.Notifications return item; } + /// <summary> + /// Removed the specified task item from the queue. + /// </summary> + /// <param name="taskItem">The task item.</param> 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 { + /// <summary> + /// Represents the default Machine Studio <see cref="IStudioApplicationManager">Application Manager</see>. + /// </summary> + /// <seealso cref="Tango.Core.ExtendedObject" /> + /// <seealso cref="Tango.MachineStudio.Common.StudioApplication.IStudioApplicationManager" /> public class DefaultStudioApplicationManager : ExtendedObject, IStudioApplicationManager { + /// <summary> + /// The navigation manager + /// </summary> private INavigationManager _navigationManager; + /// <summary> + /// Initializes a new instance of the <see cref="DefaultStudioApplicationManager" /> class. + /// </summary> + /// <param name="navigationManager">The navigation manager.</param> public DefaultStudioApplicationManager(INavigationManager navigationManager) { _navigationManager = navigationManager; } + /// <summary> + /// Gets a value indicating whether Machine Studio is shutting down. + /// </summary> public bool IsShuttingDown { get; private set; } + /// <summary> + /// The connected machine + /// </summary> private IExternalBridgeClient _connectedMachine; + /// <summary> + /// Gets or sets the currently connected machine if any. + /// </summary> public IExternalBridgeClient ConnectedMachine { get { return _connectedMachine; } @@ -48,11 +69,19 @@ namespace Tango.MachineStudio.UI.StudioApplication } } + /// <summary> + /// Gets a value indicating whether the <see cref="P:Tango.MachineStudio.Common.StudioApplication.IStudioApplicationManager.ConnectedMachine" /> is valid and connected through TCP/IP. + /// </summary> public bool IsMachineConnectedViaTCP { get { return IsMachineConnected && ConnectedMachine is ExternalBridgeTcpClient; } } + /// <summary> + /// Handles the <see cref="ConnectedMachine"/> state changed event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="e">The e.</param> 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 } + /// <summary> + /// Gets a value indicating whether the <see cref="P:Tango.MachineStudio.Common.StudioApplication.IStudioApplicationManager.ConnectedMachine" /> is valid. + /// </summary> public bool IsMachineConnected { get { return ConnectedMachine != null; } } + /// <summary> + /// Shutdown the application. + /// </summary> 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 { + /// <summary> + /// Represents a supervising controller pattern view contract. + /// </summary> + /// <seealso cref="Tango.SharedUI.IView" /> 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 @@ <ItemGroup> <Resource Include="Images\account.png" /> </ItemGroup> - <ItemGroup> - <Folder Include="Controls\" /> - </ItemGroup> + <ItemGroup /> <ItemGroup> <Resource Include="Images\external-bridge-tcp.png" /> <Resource Include="Images\external-bridge-usb.png" /> 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<MachineConnectionViewVM>(); SimpleIoc.Default.Register<MachineLoginViewVM>(); - 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 { + /// <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 { } |
