From 3aa8d26fe59aeea616bda89ca325b9f9583fadc6 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 8 Jan 2018 18:19:37 +0200 Subject: Added code comments for: Integration. Refactored ExternalBridgeClient to: IExternalBridgeSecureClient. ExternalBridgeTcpClient. ExternalBridgeUsbClient. Refactored MachineConnectionView to use the new external bridge clients by data template "data type". --- .../StudioApplication/DefaultStudioApplicationManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs') 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 de8649c13..36b5074cb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -50,7 +50,7 @@ namespace Tango.MachineStudio.UI.StudioApplication public bool IsMachineConnectedViaTCP { - get { return IsMachineConnected && ConnectedMachine.Type != ExternalBridgeClientType.USB; } + get { return IsMachineConnected && ConnectedMachine is ExternalBridgeTcpClient; } } private void ConnectedMachine_StateChanged(object sender, Transport.TransportComponentState e) -- cgit v1.3.1 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/StudioApplication/DefaultStudioApplicationManager.cs') 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 From 0fda2ba3ff49bdc1ffc6833f658e2164af187008 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 16 Jan 2018 12:17:10 +0200 Subject: Embedded RealTimeGraphEx library to solution. Added graphs to technician view. Implemented simple sensors data test using Machine Emulator. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes Software/PMR/Messages/Common/MessageType.proto | 4 + .../Messages/Diagnostics/PushSensorsRequest.proto | 9 + .../Messages/Diagnostics/PushSensorsResponse.proto | 9 + .../Modules/Tango.MachineStudio.DB/DBModule.cs | 9 +- .../DeveloperModule.cs | 6 + .../MachineDesignerModule.cs | 7 + .../Tango.MachineStudio.Stubs/StubsModule.cs | 7 + .../SynchronizationModule.cs | 9 +- .../ViewModels/MainViewVM.cs | 2 +- .../Converters/SecondsToGraphPointsConverter.cs | 23 + .../Converters/TransitionLinkConverter.cs | 55 + .../Helpers/GraphsMaxPointsHelper.cs | 26 + .../Navigation/TechNavigationManager.cs | 17 + .../Navigation/TechNavigationView.cs | 15 + .../Resources/GraphEx.xaml | 126 + .../Tango.MachineStudio.Technician.csproj | 35 + .../TechnicianModule.cs | 14 + .../ViewModelLocator.cs | 15 + .../ViewModels/MainViewVM.cs | 27 + .../ViewModels/SensorsViewVM.cs | 139 + .../Views/MainView.xaml | 90 +- .../Views/MainView.xaml.cs | 3 + .../Views/MotorsView.xaml | 12 + .../Views/MotorsView.xaml.cs | 28 + .../Views/OverviewView.xaml | 12 + .../Views/OverviewView.xaml.cs | 28 + .../Views/SensorsView.xaml | 141 + .../Views/SensorsView.xaml.cs | 53 + .../Tango.MachineStudio.Common/IStudioModule.cs | 5 + .../StudioApplication/IStudioApplicationManager.cs | 5 + .../MachineStudio/Tango.MachineStudio.UI/App.xaml | 5 +- .../Modules/DefaultStudioModuleLoader.cs | 3 + .../Navigation/DefaultNavigationManager.cs | 1 + .../DefaultStudioApplicationManager.cs | 7 + .../SupervisingController/IMainView.cs | 7 +- .../Tango.MachineStudio.UI.csproj | 4 + .../Tango.MachineStudio.UI/ViewModelLocator.cs | 2 +- .../ViewModels/MainViewVM.cs | 11 +- .../Tango.MachineStudio.UI/Views/MainView.xaml | 145 +- .../Tango.MachineStudio.UI/Views/MainView.xaml.cs | 29 + .../RealTimeGraphEx/Components/ComponentBase.cs | 101 + .../Components/ComponentLocationEnum.cs | 17 + .../RealTimeGraphEx/Components/GridLines.cs | 121 + .../Components/MouseValueToolTip.cs | 73 + .../RealTimeGraphEx/Components/YAxisLegends.cs | 61 + .../RealTimeGraphEx/Components/YAxisScroll.cs | 205 + .../RealTimeGraphEx/Components/YAxisTicks.cs | 192 + .../RealTimeGraphEx/Components/YAxisWave.cs | 107 + .../ComponentsItems/YAxisBigTick.cs | 14 + .../RealTimeGraphEx/ComponentsItems/YAxisLabel.cs | 14 + .../RealTimeGraphEx/ComponentsItems/YAxisLegend.cs | 15 + .../ComponentsItems/YAxisSmallTick.cs | 14 + .../RealTimeGraphEx/Controllers/GraphController.cs | 96 + .../Controllers/GraphControllerBase.cs | 62 + .../Controllers/GraphMultiController.cs | 200 + .../RealTimeGraphEx/DX2D/DX10ImageSource.cs | 147 + .../DX2D/DXGraphSurfaceMultiErase.cs | 100 + .../DX2D/DXGraphSurfaceMultiScroll.cs | 85 + .../DX2D/DXGraphSurfaceSingleErase.cs | 91 + .../DX2D/DXGraphSurfaceSingleScroll.cs | 76 + .../RealTimeGraphEx/DX2D/Direct2DControl.cs | 261 + .../SideChains/RealTimeGraphEx/DX2D/Disposer.cs | 35 + .../RealTimeGraphEx/DX2D/NativeMethods.cs | 18 + .../RealTimeGraphEx/DataSeries/DataYSeries.cs | 176 + .../RealTimeGraphExDirectXLineErase.cs | 186 + .../RealTimeGraphExDirectXLineScroll.cs | 276 + .../RealTimeGraphExDirectXMultiLineErase.cs | 225 + .../RealTimeGraphExDirectXMultiLineScroll.cs | 266 + .../RealTimeGraphEx/Enums/OpacityTypeEnum.cs | 15 + .../RealTimeGraphEx/Enums/ZoomDirectionEnum.cs | 15 + .../RealTimeGraphEx/Enums/ZoomModeEnum.cs | 16 + .../ExtensionMethods/BrushExtensions.cs | 72 + .../ExtensionMethods/ColorExtensions.cs | 18 + .../ExtensionMethods/RenderTargetExtensions.cs | 83 + .../FastGraphs/RealTimeGraphExEllipseScroll.cs | 122 + .../FastGraphs/RealTimeGraphExLineErase.cs | 257 + .../FastGraphs/RealTimeGraphExLineScroll.cs | 251 + .../FastGraphs/RealTimeGraphExMultiLineErase.cs | 233 + .../FastGraphs/RealTimeGraphExMultiLineScroll.cs | 267 + .../FastGraphs/RealTimeGraphExShapeErase.cs | 287 + .../FastGraphs/RealTimeGraphExShapeScroll.cs | 276 + .../FastGraphs/RealTimeGraphExWaveErase.cs | 79 + .../FastGraphs/RealTimeGraphExWaveScroll.cs | 66 + .../RealTimeGraphEx/FastGraphs/ShapeTypeEnum.cs | 15 + .../SideChains/RealTimeGraphEx/FodyWeavers.xml | 4 + .../RealTimeGraphEx/Models/ConcurrentPointsList.cs | 429 + .../SideChains/RealTimeGraphEx/Models/RangeData.cs | 33 + .../Models/RealTimeGraphColumnsCollection.cs | 68 + .../Models/RealTimeGraphExColumn.cs | 24 + .../RealTimeGraphEx/Models/RealTimeGraphExPoint.cs | 15 + .../Models/RealTimeGraphExPolygon.cs | 383 + .../Models/RealTimeGraphExReachPolygon.cs | 244 + .../RealTimeGraphEx/Properties/AssemblyInfo.cs | 55 + .../Properties/Resources.Designer.cs | 62 + .../RealTimeGraphEx/Properties/Resources.resx | 117 + .../Properties/Settings.Designer.cs | 30 + .../RealTimeGraphEx/Properties/Settings.settings | 7 + .../ReachGraphs/RealTimeGraphExReachCircle.cs | 295 + .../ReachGraphs/RealTimeGraphExReachLineErase.cs | 210 + .../ReachGraphs/RealTimeGraphExReachLineScroll.cs | 270 + .../RealTimeGraphExReachMultiLineErase.cs | 196 + .../RealTimeGraphExReachMultiLineScroll.cs | 229 + .../ReachGraphs/RealTimeGraphExReachVUMeter.cs | 289 + .../ReachGraphs/RealTimeGraphExReachWaveScroll.cs | 44 + .../RealTimeGraphEx/RealTimeGraphEx.csproj | 225 + .../RealTimeGraphEx/RealTimeGraphExBase.cs | 1346 + .../RealTimeGraphEx/RealTimeGraphExMultiBase.cs | 74 + .../Referenced Assemblies/SharpDX.DXGI.dll | Bin 0 -> 90624 bytes .../Referenced Assemblies/SharpDX.DXGI.xml | 4365 ++ .../Referenced Assemblies/SharpDX.Direct2D1.dll | Bin 0 -> 230912 bytes .../Referenced Assemblies/SharpDX.Direct2D1.xml | 24418 ++++++++++ .../Referenced Assemblies/SharpDX.Direct3D10.dll | Bin 0 -> 179200 bytes .../Referenced Assemblies/SharpDX.Direct3D10.xml | 23120 +++++++++ .../Referenced Assemblies/SharpDX.Direct3D9.dll | Bin 0 -> 349696 bytes .../Referenced Assemblies/SharpDX.Direct3D9.xml | 36476 ++++++++++++++ .../Referenced Assemblies/SharpDX.dll | Bin 0 -> 558080 bytes .../Referenced Assemblies/SharpDX.xml | 48704 +++++++++++++++++++ .../RealTimeGraphEx/Resources/Resources.xaml | 74 + .../RealTimeGraphEx/Synchronization/SyncManager.cs | 63 + .../WriteableBitmap/BitmapContext.cs | 468 + .../WriteableBitmap/BitmapFactory.cs | 214 + .../WriteableBitmap/NativeMethods.cs | 41 + .../WriteableBitmapAntialiasingExtensions.cs | 444 + .../WriteableBitmapBaseExtensions.cs | 480 + .../WriteableBitmapBlitExtensions.cs | 704 + .../WriteableBitmapContextExtensions.cs | 55 + .../WriteableBitmapConvertExtensions.cs | 344 + .../WriteableBitmapFillExtensions.cs | 1205 + .../WriteableBitmapFilterExtensions.cs | 423 + .../WriteableBitmapLineExtensions.cs | 1316 + .../WriteableBitmapShapeExtensions.cs | 489 + .../WriteableBitmapSplineExtensions.cs | 341 + .../WriteableBitmapTransformationExtensions.cs | 623 + .../SideChains/RealTimeGraphEx/packages.config | 5 + .../Tango.Emulations/Emulators/MachineEmulator.cs | 24 + .../Operators/IMachineOperator.cs | 23 + .../Tango.Integration/Operators/MachineOperator.cs | 85 + .../Tango.Integration/Services/ComPortInfo.cs | 74 + .../Services/ExternalBridgeScanner.cs | 17 +- .../Services/ExternalBridgeTcpClient.cs | 3 +- .../Services/ExternalBridgeUsbClient.cs | 3 +- .../Services/IExternalBridgeClient.cs | 3 +- .../Tango.Integration/Tango.Integration.csproj | 20 + .../Tango.Integration/packages.config | 6 + .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 12 +- .../Tango.PMR/Diagnostics/PushSensorsRequest.cs | 131 + .../Tango.PMR/Diagnostics/PushSensorsResponse.cs | 153 + Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 2 + Software/Visual_Studio/Tango.PMR/TangoMessage.cs | 4 +- .../Visual_Studio/Tango.Settings/Integration.cs | 9 +- .../MachineStudioSettings/MachineStudio.cs | 6 + .../MachineStudioSettings/TechnicianModule.cs | 21 + .../Tango.Settings/Tango.Settings.csproj | 1 + .../Controls/MultiTransitionControl.xaml.cs | 31 +- Software/Visual_Studio/Tango.SharedUI/ViewModel.cs | 9 + Software/Visual_Studio/Tango.sln | 23 + .../Tango.MachineEM.UI/ViewModels/MainViewVM.cs | 8 +- 159 files changed, 156002 insertions(+), 138 deletions(-) create mode 100644 Software/PMR/Messages/Diagnostics/PushSensorsRequest.proto create mode 100644 Software/PMR/Messages/Diagnostics/PushSensorsResponse.proto create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/ComponentBase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/ComponentLocationEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/GridLines.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/MouseValueToolTip.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisLegends.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisTicks.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisWave.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ComponentsItems/YAxisBigTick.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ComponentsItems/YAxisLabel.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ComponentsItems/YAxisLegend.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ComponentsItems/YAxisSmallTick.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Controllers/GraphController.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Controllers/GraphControllerBase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Controllers/GraphMultiController.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DX10ImageSource.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DXGraphSurfaceMultiErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DXGraphSurfaceMultiScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DXGraphSurfaceSingleErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DXGraphSurfaceSingleScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/Direct2DControl.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/Disposer.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/NativeMethods.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DataSeries/DataYSeries.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DirectXGraphs/RealTimeGraphExDirectXLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DirectXGraphs/RealTimeGraphExDirectXLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DirectXGraphs/RealTimeGraphExDirectXMultiLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DirectXGraphs/RealTimeGraphExDirectXMultiLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Enums/OpacityTypeEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Enums/ZoomDirectionEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Enums/ZoomModeEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ExtensionMethods/BrushExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ExtensionMethods/ColorExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ExtensionMethods/RenderTargetExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExEllipseScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExShapeErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExShapeScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExWaveErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExWaveScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/ShapeTypeEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FodyWeavers.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/ConcurrentPointsList.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RangeData.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphColumnsCollection.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphExColumn.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphExPoint.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphExPolygon.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphExReachPolygon.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/Resources.resx create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/Settings.settings create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachCircle.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachMultiLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachMultiLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachVUMeter.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachWaveScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphEx.csproj create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExMultiBase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.DXGI.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.DXGI.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct2D1.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct2D1.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct3D10.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct3D10.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct3D9.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct3D9.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Resources/Resources.xaml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Synchronization/SyncManager.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/BitmapContext.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/BitmapFactory.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/NativeMethods.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapAntialiasingExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapBaseExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapBlitExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapContextExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapConvertExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapFillExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapFilterExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapLineExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapShapeExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapSplineExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapTransformationExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/packages.config create mode 100644 Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Services/ComPortInfo.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/PushSensorsRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/PushSensorsResponse.cs create mode 100644 Software/Visual_Studio/Tango.Settings/MachineStudioSettings/TechnicianModule.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index da5cc939b..6ec476601 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 35f93651b..3d4d754ea 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index d1b34ba77..c34263440 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -57,4 +57,8 @@ enum MessageType OverrideDataBaseResponse = 1006; KeepAliveRequest = 1007; KeepAliveResponse = 1008; + + //Diagnostics + PushSensorsRequest = 2000; + PushSensorsResponse = 2001; } diff --git a/Software/PMR/Messages/Diagnostics/PushSensorsRequest.proto b/Software/PMR/Messages/Diagnostics/PushSensorsRequest.proto new file mode 100644 index 000000000..0617a656f --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/PushSensorsRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message PushSensorsRequest +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/PushSensorsResponse.proto b/Software/PMR/Messages/Diagnostics/PushSensorsResponse.proto new file mode 100644 index 000000000..710e31bcd --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/PushSensorsResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message PushSensorsResponse +{ + repeated int32 Temperature = 1; +} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs index 4f751d9da..c433a4cd4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs @@ -17,10 +17,8 @@ namespace Tango.MachineStudio.DB /// public class DBModule : IStudioModule { - /// - /// The is initialized - /// private bool _isInitialized; + private bool _isLoaded; /// /// Gets the module name. @@ -52,6 +50,11 @@ namespace Tango.MachineStudio.DB /// public Permissions Permission => Permissions.RunDataBaseModule; + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs index c3d351468..4401245a9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs @@ -15,6 +15,7 @@ namespace Tango.MachineStudio.Developer public class DeveloperModule : IStudioModule { private bool _isInitialized; + private bool _isLoaded; public string Name => "Developer"; @@ -26,6 +27,11 @@ namespace Tango.MachineStudio.Developer public bool IsInitialized => _isInitialized; + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + public Permissions Permission => Permissions.RunDeveloperModule; public void Dispose() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs index ca13bd350..8fbac790f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs @@ -18,6 +18,8 @@ namespace Tango.MachineStudio.MachineDesigner /// public class MachineDesignerModule : IStudioModule { + private bool _isLoaded; + /// /// Gets the module name. /// @@ -33,6 +35,11 @@ namespace Tango.MachineStudio.MachineDesigner /// public BitmapSource Image => ResourceHelper.GetImageFromResources("Images/machine-designer-module.jpg"); + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + /// /// Gets the module entry point view. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs index 23214cf55..8b072ea46 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs @@ -18,6 +18,8 @@ namespace Tango.MachineStudio.Stubs /// public class StubsModule : IStudioModule { + private bool _isLoaded; + /// /// Gets the module name. /// @@ -38,6 +40,11 @@ namespace Tango.MachineStudio.Stubs /// public FrameworkElement MainView => new MainView(); + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + /// /// Gets the permission required to see and load this module. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs index f6381a482..4a753b05e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs @@ -18,9 +18,7 @@ namespace Tango.MachineStudio.Synchronization /// public class SynchronizationModule : IStudioModule { - /// - /// The is initialized - /// + private bool _isLoaded; private bool _isInitialized; /// @@ -43,6 +41,11 @@ namespace Tango.MachineStudio.Synchronization /// public FrameworkElement MainView => new MainView(); + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + /// /// Gets a value indicating whether this module has been initialized. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs index 48a5c64bd..21d76d7d7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs @@ -22,7 +22,7 @@ namespace Tango.MachineStudio.Synchronization.ViewModels MainViewLogger logger = new MainViewLogger(); logger.NewLog += (output) => { - Log += output + Environment.NewLine; + //Log += output + Environment.NewLine; }; LogManager.RegisterLogger(logger); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs new file mode 100644 index 000000000..3120c44a6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Technician.Converters +{ + public class SecondsToGraphPointsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + double arrLength = double.Parse(parameter.ToString()); + return Helpers.GraphsMaxPointsHelper.GetMaxPoints(arrLength); + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return value; + } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs new file mode 100644 index 000000000..d67f3a259 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; + +namespace Tango.MachineStudio.Technician.Converters +{ + /// + /// Binding converter for converting TransitionControl child Tag to text style. + /// + /// + /// This converter is used by the patient page tabs, changing the selected tab text style to bold/normal. + /// + public class TransitionLinkConverter : IValueConverter + { + /// + /// Converts a ContentControl to font style. + /// + /// Content control. + /// + /// + /// + /// Font style. + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + ContentControl control = value as ContentControl; + + if (control != null && control.Tag != null && control.Tag.ToString().ToLower() == parameter.ToString().ToLower()) + { + return FontWeights.Bold; + } + else + { + return FontWeights.Normal; + } + } + + /// + /// Not Implemented. + /// + /// + /// + /// + /// + /// + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return value; + } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs new file mode 100644 index 000000000..87aab5967 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.MachineStudio.Technician.Helpers +{ + public static class GraphsMaxPointsHelper + { + public static int GetMaxPoints(double arrLength) + { + try + { + double seconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration; + double pullRate = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsPullingInterval; + return (int)(((pullRate * arrLength * 10 * seconds) * (10 / pullRate)) * 0.65); + } + catch (Exception) + { + return 300; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs new file mode 100644 index 000000000..f473776d1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Technician.Views; + +namespace Tango.MachineStudio.Technician.Navigation +{ + public class TechNavigationManager + { + public void NavigateTo(TechNavigationView view) + { + MainView.Instance.TransitionControl.AutoNavigate(view.ToString()); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs new file mode 100644 index 000000000..27d9fb09b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Technician.Navigation +{ + public enum TechNavigationView + { + Overview, + Motors, + Sensors, + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml new file mode 100644 index 000000000..85cccc2dd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml @@ -0,0 +1,126 @@ + + + Segoe UI + Lucida Console + + 28 + 26 + 20 + 16 + 14 + 12 + 9 + + + Silver + #FFE9E9E9 + Gray + #03A9F4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 2c5df42fc..097917fef 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -77,15 +77,46 @@ + + + + + + + + MotorsView.xaml + + + OverviewView.xaml + + + SensorsView.xaml + MainView.xaml GlobalVersionInfo.cs + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -117,6 +148,10 @@ + + {b9ae25d6-be35-492f-9079-21a7f3e6f7cc} + RealTimeGraphEx + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs index a4eaff71e..b715b6710 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs @@ -14,6 +14,10 @@ namespace Tango.MachineStudio.Technician { public class TechnicianModule : IStudioModule { + private bool _isLoaded; + + public event EventHandler IsLoadedChanged; + public string Name => "Technician"; public string Description => "Provides access to low level machine components by exposing diagnostics and profiling tools."; @@ -26,6 +30,16 @@ namespace Tango.MachineStudio.Technician public bool IsInitialized => true; + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded + { + get { return _isLoaded; } + set { _isLoaded = value; IsLoadedChanged?.Invoke(this, value); } + } + + public void Dispose() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs index f922d5ec4..e7fea686d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs @@ -1,6 +1,7 @@ using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Ioc; using Microsoft.Practices.ServiceLocation; +using Tango.MachineStudio.Technician.Navigation; using Tango.MachineStudio.Technician.ViewModels; namespace Tango.MachineStudio.Technician @@ -17,7 +18,13 @@ namespace Tango.MachineStudio.Technician static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + SimpleIoc.Default.Register(); + SimpleIoc.Default.Register(); + + SimpleIoc.Default.Unregister(); + + SimpleIoc.Default.Register(); } public static MainViewVM MainViewVM @@ -27,5 +34,13 @@ namespace Tango.MachineStudio.Technician return ServiceLocator.Current.GetInstance(); } } + + public static SensorsViewVM SensorsViewVM + { + get + { + return ServiceLocator.Current.GetInstance(); + } + } } } \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs index c715af6cb..68852fe20 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs @@ -3,12 +3,39 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.MachineStudio.Technician.Navigation; using Tango.SharedUI; namespace Tango.MachineStudio.Technician.ViewModels { public class MainViewVM : ViewModel { + private TechNavigationManager _navigation; + #region Constructors + + public MainViewVM(TechNavigationManager navigationManager) + { + _navigation = navigationManager; + NavigateToViewCommand = new RelayCommand(NavigateToView); + } + + #endregion + + #region Commands + + public RelayCommand NavigateToViewCommand { get; set; } + + #endregion + + #region Private Methods + + private void NavigateToView(string view) + { + _navigation.NavigateTo((TechNavigationView)Enum.Parse(typeof(TechNavigationView), view, true)); + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs new file mode 100644 index 000000000..cb3114f4c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs @@ -0,0 +1,139 @@ +using RealTimeGraphEx.Controllers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operators; +using Tango.Logging; +using Tango.MachineStudio.Common.Modules; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.PMR.Diagnostics; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Technician.ViewModels +{ + public class SensorsViewVM : ViewModel + { + private List _controllers; + + public IStudioApplicationManager ApplicationManager { get; set; } + + private IMachineOperator _machineOperator; + public IMachineOperator MachineOperator + { + get { return _machineOperator; } + set { _machineOperator = value; RaisePropertyChangedAuto(); } + } + + public SensorsViewVM(IStudioApplicationManager applicationManager, IStudioModuleLoader moduleLoader) + { + ApplicationManager = applicationManager; + ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + + InitializeConnectedMachine(ApplicationManager.ConnectedMachine); + + if (!DesignMode) + { + //Set graphs FIFO capacity by seconds (this will be converted to MaxPoints by the view). + GraphSeconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration; + + _controllers = new List(); + + TemperatureController = new GraphController(); + PressureController = new GraphController(); + + _controllers.Add(TemperatureController); + _controllers.Add(PressureController); + + var module = moduleLoader.UserModules.SingleOrDefault(x => x is TechnicianModule) as TechnicianModule; + + if (module != null) + { + module.IsLoadedChanged += Module_IsLoadedChanged; + } + } + } + + private void Module_IsLoadedChanged(object sender, bool loaded) + { + //_controllers.ForEach(x => x.ChangeRenderMode(loaded)); + } + + private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machineOperator) + { + InitializeConnectedMachine(machineOperator); + } + + private void MachineOperator_SensorsDataAvailable(object sender, PushSensorsResponse data) + { + TemperatureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray()); + PressureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray()); + } + + private void InitializeConnectedMachine(IMachineOperator machineOperator) + { + MachineOperator = machineOperator; + + if (MachineOperator != null) + { + MachineOperator.EnableSensorsUpdate = true; + MachineOperator.SensorsDataAvailable -= MachineOperator_SensorsDataAvailable; + MachineOperator.SensorsDataAvailable += MachineOperator_SensorsDataAvailable; + } + } + + #region Graphs Controllers + + private GraphController _temperatureController; + /// + /// Gets or sets the temperature sensor graph controller . + /// + public GraphController TemperatureController + { + get { return _temperatureController; } + set { _temperatureController = value; RaisePropertyChanged(nameof(TemperatureController)); } + } + + private GraphController _pressureController; + /// + /// Gets or sets the pressure sensor graph controller . + /// + public GraphController PressureController + { + get { return _pressureController; } + set { _pressureController = value; RaisePropertyChanged(nameof(PressureController)); } + } + + #endregion + + private int _graphSeconds; + /// + /// Gets or sets the graphs number of seconds to complete FIFO capacity. + /// + public int GraphSeconds + { + get { return _graphSeconds; } + set { _graphSeconds = value; RaisePropertyChanged(nameof(GraphSeconds)); } + } + + /// + /// Clears the graphs. + /// + public void ClearGraphs() + { + _controllers.ForEach(x => x.Clear()); + } + + /// + /// Creates a dummy list with default value of -1000 (used to fill graphs buffer). + /// + /// List length. + /// + private List CreateDummyList(int count) + { + return Enumerable.Repeat(-1000, count + 1).ToList(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml index 1337358e1..6b84881fd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml @@ -5,10 +5,98 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.MachineStudio.Technician" xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:sharedUI="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" + xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" Background="White"> + + + + + + + + + + + + + - Technician + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs index 0701fbc50..b07fc597e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs @@ -20,9 +20,12 @@ namespace Tango.MachineStudio.Technician.Views /// public partial class MainView : UserControl { + public static MainView Instance { get; set; } + public MainView() { InitializeComponent(); + Instance = this; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml new file mode 100644 index 000000000..3fb49d457 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml @@ -0,0 +1,12 @@ + + + MOTORS + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs new file mode 100644 index 000000000..bd548766c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// + /// Interaction logic for MotorsView.xaml + /// + public partial class MotorsView : UserControl + { + public MotorsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml new file mode 100644 index 000000000..3c064346d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml @@ -0,0 +1,12 @@ + + + OVERVIEW + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs new file mode 100644 index 000000000..aeba42c00 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// + /// Interaction logic for OverviewView.xaml + /// + public partial class OverviewView : UserControl + { + public OverviewView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml new file mode 100644 index 000000000..2e074ec3c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs new file mode 100644 index 000000000..4727a3603 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs @@ -0,0 +1,53 @@ +using Microsoft.Practices.ServiceLocation; +using RealTimeGraphEx.Synchronization; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// + /// Interaction logic for DebugView.xaml + /// + public partial class SensorsView : UserControl + { + private SyncManager _syncManager; + + public SensorsView() + { + InitializeComponent(); + + _syncManager = new SyncManager(); + _syncManager.AddGraph(graphTemperature); + _syncManager.AddGraph(graphPressure); + _syncManager.RefreshRate = 30; + _syncManager.Start(); + } + + private void OnGraphFullScreen(object sender, RoutedEventArgs e) + { + + } + + private void Graph_MouseEnter(object sender, MouseEventArgs e) + { + + } + + private void Graph_MouseLeave(object sender, MouseEventArgs e) + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs index 21377fb5f..118afff7e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs @@ -49,5 +49,10 @@ namespace Tango.MachineStudio.Common /// Perform any operations required to initialize this module. /// void Initialize(); + + /// + /// Sets a value indicating whether this module is loaded. + /// + bool IsLoaded { set; get; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index dfdac67c7..a88a045a6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -12,6 +12,11 @@ namespace Tango.MachineStudio.Common.StudioApplication /// public interface IStudioApplicationManager { + /// + /// Occurs when the connected machine property has changed. + /// + event EventHandler ConnectedMachineChanged; + /// /// Gets a value indicating whether Machine Studio is shutting down. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml index 8e5876e79..fe50851a0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml @@ -11,7 +11,10 @@ - + + + + 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 5944af2d1..0e1bd829b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -25,6 +25,7 @@ namespace Tango.MachineStudio.UI.Modules { private IAuthenticationProvider _authenticationProvider; private bool _loaded; + public event EventHandler ModulesLoaded; /// /// Initializes a new instance of the class. @@ -115,6 +116,8 @@ namespace Tango.MachineStudio.UI.Modules { UserModules = AllModules.Where(x => _authenticationProvider.CurrentUser.HasPermission(x.Permission)).ToObservableCollection(); } + + ModulesLoaded?.Invoke(this, new EventArgs()); } } } 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 2fa8c7562..56abbd702 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Navigation; namespace Tango.MachineStudio.UI.Navigation 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 68af7bdc3..06b4dca7c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -48,6 +48,11 @@ namespace Tango.MachineStudio.UI.StudioApplication /// private IExternalBridgeClient _connectedMachine; + /// + /// Occurs when the connected machine property has changed. + /// + public event EventHandler ConnectedMachineChanged; + /// /// Gets or sets the currently connected machine if any. /// @@ -66,6 +71,8 @@ namespace Tango.MachineStudio.UI.StudioApplication _connectedMachine.StateChanged -= ConnectedMachine_StateChanged; _connectedMachine.StateChanged += ConnectedMachine_StateChanged; } + + ConnectedMachineChanged?.Invoke(this, _connectedMachine); } } 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 3de061de8..fd8ef4be5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.MachineStudio.Common; using Tango.SharedUI; namespace Tango.MachineStudio.UI.SupervisingController @@ -13,6 +14,10 @@ namespace Tango.MachineStudio.UI.SupervisingController /// public interface IMainView : IView { - + /// + /// Navigates to the specified studio module. + /// + /// The module. + void NavigateToModule(IStudioModule module); } } 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 b752ca4b7..9b498cfb6 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 @@ -241,6 +241,10 @@ + + {b9ae25d6-be35-492f-9079-21a7f3e6f7cc} + RealTimeGraphEx + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 5f315f7f4..7ceab8268 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -67,7 +67,7 @@ namespace Tango.MachineStudio.UI if (!ViewModelBase.IsInDesignModeStatic) { - LogManager.RegisterLogger(new VSOutputLogger()); + //LogManager.RegisterLogger(new VSOutputLogger()); LogManager.RegisterLogger(new FileLogger()); } 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 fcbdc90a3..fdab1a93c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -1,4 +1,5 @@ -using System; +using GalaSoft.MvvmLight.Ioc; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; @@ -275,14 +276,22 @@ namespace Tango.MachineStudio.UI.ViewModels { IsMenuOpened = false; + foreach (var m in StudioModuleLoader.AllModules.Where(x => x != module)) + { + m.IsLoaded = false; + } + if (module != null) { CurrentModule = module; + CurrentModule.IsLoaded = true; IsModuleLoaded = true; + View.NavigateToModule(module); } else { IsModuleLoaded = false; + View.NavigateToModule(null); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 616187288..99654f602 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -165,95 +165,66 @@ - - - - - - - Welcome to Machine Studio - Select Your Studio Module... - - + + + + + + + + + + + Welcome to Machine Studio + Select Your Studio Module... + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config new file mode 100644 index 000000000..4fd672b32 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs index 8fbac790f..b0160abd5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs @@ -48,7 +48,7 @@ namespace Tango.MachineStudio.MachineDesigner /// /// Gets the permission required to see and load this module. /// - public Permissions Permission => Permissions.RunDeveloperModule; + public Permissions Permission => Permissions.RunMachineDesignerModule; /// /// Gets a value indicating whether this module has been initialized. diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index ac1616401..64c54b357 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -85,6 +85,9 @@ MachineVersionDialog.xaml + + MachineView.xaml + MainView.xaml @@ -96,6 +99,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 24f2f6d43..9f44bc270 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -13,10 +13,12 @@ using Tango.DAL.Observables; using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI; using SimpleValidator.Extensions; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.MachineDesigner.ViewModels { - public class MainViewVM : ViewModel + public class MainViewVM : ViewModel, IModuleRequestListener { private bool _isSaving; private INotificationProvider _notification; @@ -631,5 +633,22 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } #endregion + + #region IModuleRequestListener + + /// + /// Called when the request has been made. + /// + /// The module instance. + /// The arguments. + public void OnRequestModule(IStudioModule module, object args) + { + if (module is MachineDesignerModule) + { + SelectedMachine = args as Machine; + } + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml new file mode 100644 index 000000000..a54f9bbdc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hardware + + + + + + Add IDS + + + + + + Remove IDS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NO IDS PACKS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Touch Panel + + + + + + Embedded Firmware + + + + + + Dispensers + + + + + + Mid Tanks + + + + + + Cartridges + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml.cs new file mode 100644 index 000000000..67fa0d5bf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.MachineDesigner.Views +{ + /// + /// Interaction logic for MachineView.xaml + /// + public partial class MachineView : UserControl + { + public MachineView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/TableGrid.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/TableGrid.cs new file mode 100644 index 000000000..07fd0c446 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/TableGrid.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace Tango.MachineStudio.Common.Controls +{ + public class TableGrid : Grid + { + public TableGrid() + { + ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) }); + ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); + this.Loaded += TableGrid_Loaded; + } + + private void TableGrid_Loaded(object sender, RoutedEventArgs e) + { + InvalidateGrid(); + } + + protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) + { + base.OnVisualChildrenChanged(visualAdded, visualRemoved); + } + + protected override Size ArrangeOverride(Size arrangeSize) + { + return base.ArrangeOverride(arrangeSize); + } + + private void InvalidateGrid() + { + RowDefinitions.Clear(); + RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50, GridUnitType.Pixel) }); + + int currentRow = 0; + + for (int i = 0; i < Children.Count; i++) + { + SetRow(Children[i], currentRow); + + if (i % 2 != 0) + { + SetColumn(Children[i], 1); + (Children[i] as FrameworkElement).Margin = new Thickness(20, 0, 0, 0); + currentRow++; + RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50, GridUnitType.Pixel) }); + } + + (Children[i] as FrameworkElement).VerticalAlignment = VerticalAlignment.Bottom; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IModuleRequestListener.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IModuleRequestListener.cs new file mode 100644 index 000000000..b950d7bcd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IModuleRequestListener.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.StudioApplication +{ + /// + /// Represents a type which will be notified when a new module request was made by + /// + public interface IModuleRequestListener + { + /// + /// Called when the request has been made. + /// + /// The module instance. + /// The arguments. + void OnRequestModule(IStudioModule module, Object args); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index a88a045a6..c67c34044 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -20,7 +20,7 @@ namespace Tango.MachineStudio.Common.StudioApplication /// /// Gets a value indicating whether Machine Studio is shutting down. /// - bool IsShuttingDown { get;} + bool IsShuttingDown { get; } /// /// Shutdown the application. @@ -40,6 +40,13 @@ namespace Tango.MachineStudio.Common.StudioApplication /// /// Gets a value indicating whether the is valid and connected through TCP/IP. /// - bool IsMachineConnectedViaTCP { get; } + bool IsMachineConnectedViaTCP { get; } + + /// + /// Loads the specified module if permitted. + /// + /// Name of the module. + /// The arguments. + void RequestModule(String moduleName, Object args); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 42eae3c1e..e16703cfa 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -71,7 +71,9 @@ + + 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 06b4dca7c..a59ecf8e0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -14,6 +14,8 @@ using System.Collections; using Tango.Integration.Services; using Tango.Core; using Tango.Logging; +using Tango.MachineStudio.Common.Modules; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.UI.StudioApplication { @@ -24,17 +26,16 @@ namespace Tango.MachineStudio.UI.StudioApplication /// public class DefaultStudioApplicationManager : ExtendedObject, IStudioApplicationManager { - /// - /// The navigation manager - /// private INavigationManager _navigationManager; + private IStudioModuleLoader _moduleLoader; /// /// Initializes a new instance of the class. /// /// The navigation manager. - public DefaultStudioApplicationManager(INavigationManager navigationManager) + public DefaultStudioApplicationManager(INavigationManager navigationManager, IStudioModuleLoader moduleLoader) { + _moduleLoader = moduleLoader; _navigationManager = navigationManager; } @@ -146,5 +147,30 @@ namespace Tango.MachineStudio.UI.StudioApplication }); } + + /// + /// Loads the specified module if permitted. + /// + /// Name of the module. + /// The arguments. + public void RequestModule(string moduleName, object args) + { + IStudioModule module = _moduleLoader.UserModules.SingleOrDefault(x => x.Name == moduleName); + + if (module != null) + { + ServiceLocator.Current.GetInstance().StartModule(module); + + //Notify request listeners. + foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase()) + { + vm.OnRequestModule(module, args); + } + } + else + { + throw new InvalidOperationException("The module was not found or you do not have sufficient privileges."); + } + } } } 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 fdab1a93c..679ba5ff3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -272,7 +272,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Starts the specified module. /// /// The module. - private void StartModule(IStudioModule module) + internal void StartModule(IStudioModule module) { IsMenuOpened = false; -- cgit v1.3.1 From 06ad24ef8a414fc89c0cf42b9f5264d584292afe Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 1 Feb 2018 11:39:19 +0200 Subject: Improved RequestShutDown Mechanism on machine studio UI implementation. Fixed issue with job brush markers visibility. Implemented Job Progress Indicator. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../Converters/JobProgressToPositionConverter.cs | 43 ++++++ .../Converters/ObjectsNotEqualToBooleanConveter.cs | 30 ++++ .../Converters/SegmentLengthToWidthConverter.cs | 22 ++- .../Tango.MachineStudio.Developer.csproj | 2 + .../ViewModels/MainViewVM.cs | 75 +++++++++- .../Views/MainView.xaml | 153 ++++++++++++++++++--- .../Views/MainView.xaml.cs | 5 + .../DefaultStudioApplicationManager.cs | 29 ++-- 10 files changed, 322 insertions(+), 37 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 4d1c04124..1f93351b8 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index c6ee41459..04a1123e6 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs new file mode 100644 index 000000000..9865b26f8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobProgressToPositionConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class JobProgressToPositionConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + Job job = values[0] as Job; + + if (job != null) + { + double progress = System.Convert.ToDouble(values[1]); + double parentElementWidth = System.Convert.ToDouble(values[2]); + + return (progress / job.Length) * parentElementWidth; + } + else + { + return 0d; + } + } + catch + { + return 0d; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs new file mode 100644 index 000000000..15bfd6add --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectsNotEqualToBooleanConveter.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class ObjectsNotEqualToBooleanConveter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + return (values[0] != values[1]); + } + catch + { + return true; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs index 959fb6410..b632d9d12 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentLengthToWidthConverter.cs @@ -19,21 +19,29 @@ namespace Tango.MachineStudio.Developer.Converters if (values.Length == 4) { Job job = values[0] as Job; - double jobLength = System.Convert.ToDouble(values[1]); - double elementWidth = System.Convert.ToDouble(values[2]); - double segmentLength = System.Convert.ToDouble(values[3]); - double totalLength = job.Length; - return (segmentLength / totalLength) * elementWidth; + if (job != null && values[1] is double) + { + double jobLength = System.Convert.ToDouble(values[1]); + double elementWidth = System.Convert.ToDouble(values[2]); + double segmentLength = System.Convert.ToDouble(values[3]); + double totalLength = job.Length; + + return (segmentLength / totalLength) * elementWidth; + } + else + { + return 0d; + } } else { - return 0; + return 0d; } } catch { - return 0; + return 0d; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index b58908048..3b72c4971 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -77,7 +77,9 @@ + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 85febd0f1..4f7447253 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -15,6 +15,7 @@ using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.SharedUI; using System.Runtime.CompilerServices; +using System.Windows.Threading; namespace Tango.MachineStudio.Developer.ViewModels { @@ -22,7 +23,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Represents the developer module main view, view model. /// /// - public class MainViewVM : ViewModel + public class MainViewVM : ViewModel, IShutdownRequestBlocker { private INotificationProvider _notification; @@ -203,13 +204,35 @@ namespace Tango.MachineStudio.Developer.ViewModels } private bool _isJobRunning; - + /// + /// Gets or sets a value indicating whether a job is currently running. + /// public bool IsJobRunning { get { return _isJobRunning; } set { _isJobRunning = value; RaisePropertyChangedAuto(); } } + private Job _runningJob; + /// + /// Gets or sets the currently running job. + /// + public Job RunningJob + { + get { return _runningJob; } + set { _runningJob = value; RaisePropertyChangedAuto(); } + } + + private double _runningJobProgress; + /// + /// Gets or sets the running job current progress. + /// + public double RunningJobProgress + { + get { return _runningJobProgress; } + set { _runningJobProgress = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -279,6 +302,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public RelayCommand StartJobCommand { get; set; } + /// + /// Gets or sets the stop job command. + /// + public RelayCommand StopJobCommand { get; set; } + #endregion #region Constructors @@ -324,6 +352,7 @@ namespace Tango.MachineStudio.Developer.ViewModels RemoveBrushStopCommand = new RelayCommand(RemoveBrushStop, () => SelectedBrushStop != null); SaveJobsCommand = new RelayCommand(SaveJobs, () => SelectedMachine != null); StartJobCommand = new RelayCommand(StartJob, () => SelectedJob != null && !IsJobRunning); + StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning); } #endregion @@ -438,9 +467,32 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private void StopJob() + { + RunningJobProgress = 0; + IsJobRunning = false; + RunningJob = null; + } + private void StartJob() { IsJobRunning = true; + RunningJob = SelectedJob; + + DispatcherTimer timer = new DispatcherTimer(); + timer.Interval = TimeSpan.FromSeconds(0.1); + timer.Tick += (x, y) => + { + if (RunningJob == null || RunningJobProgress >= RunningJob.Length) + { + timer.Stop(); + StopJob(); + return; + } + RunningJobProgress += 0.1; + }; + + timer.Start(); } private async void SaveJobs() @@ -739,5 +791,24 @@ namespace Tango.MachineStudio.Developer.ViewModels } #endregion + + #region IShutdownRequestBlocker + + public Task OnShutdownRequest() + { + if (IsJobRunning) + { + InvokeUI(() => + { + _notification.ShowWarning("Please stop the currently running job before closing the developer module."); + }); + + return Task.FromResult(false); + } + + return Task.FromResult(true); + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index a1b607b8b..5dbb8604b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -42,6 +42,8 @@ + + @@ -164,12 +166,12 @@ - + - - JOB RUNNING... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -316,7 +425,7 @@