From 5ee4696c9a82fa23ec477c28b725af104abe90ef Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 2 May 2018 14:23:40 +0300 Subject: Worked on DeveloperConsole. Added some fields to VSTS work item. (resolved...) Resolved issue with application crash when trying to show notification before main window initialized. Added DeveloperConsole permission to DB. Added SetWorkItemAssignment to TFS client. --- .../Converters/PermissionToVisibilityConverter.cs | 38 +++++++++ .../Tango.MachineStudio.Common/IStudioViewModel.cs | 5 ++ .../Tango.MachineStudio.Common/StudioViewModel.cs | 89 ++++++++++++++++++++++ .../Tango.MachineStudio.Common.csproj | 4 + 4 files changed, 136 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PermissionToVisibilityConverter.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PermissionToVisibilityConverter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PermissionToVisibilityConverter.cs new file mode 100644 index 000000000..08e7d1c12 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PermissionToVisibilityConverter.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core.DI; +using Tango.MachineStudio.Common.Authentication; + +namespace Tango.MachineStudio.Common.Converters +{ + public class PermissionToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + User user = value as User; + + if (user != null) + { + if (user.HasPermission((Permissions)parameter)) + { + return Visibility.Visible; + } + } + + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs index 35ed50cd9..4203a1e8b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs @@ -38,5 +38,10 @@ namespace Tango.MachineStudio.Common /// /// The arguments. void OnModuleRequest(params object[] args); + + /// + /// Called when the application has been started + /// + void OnApplicationStarted(); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs index 9c7e52d23..77fad1fc6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs @@ -7,6 +7,79 @@ using Tango.SharedUI; namespace Tango.MachineStudio.Common { + /// + /// Represents a Machine Studio view model + /// + /// The type of the module. + /// + /// + public abstract class StudioViewModelInternal : ViewModel, IStudioViewModel + { + /// + /// Gets or sets a value indicating whether this view model studio module is currently loaded. + /// + public bool IsModuleLoaded { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public StudioViewModelInternal() : base() + { + + } + + /// + /// Called when another module has wants to navigate to this module with some arguments. + /// + /// The arguments. + public virtual void OnModuleRequest(params object[] args) + { + + } + + /// + /// Called when the user has navigated out of the module. + /// + public virtual void OnNavigatedFrom() + { + IsModuleLoaded = false; + } + + /// + /// Called when the user has navigated in to the module. + /// + public virtual void OnNavigatedTo() + { + IsModuleLoaded = true; + } + + /// + /// Called before the application is shutting down. + /// Return false to cancel the shutdown in case an important process is in progress. + /// + /// + public virtual Task OnShutdownRequest() + { + return Task.FromResult(true); + } + + /// + /// Called when application is shutting down. + /// + public virtual void OnShuttingDown() + { + + } + + /// + /// Called when the application has been started + /// + public virtual void OnApplicationStarted() + { + + } + } + /// /// Represents a Machine Studio view model /// @@ -70,6 +143,14 @@ namespace Tango.MachineStudio.Common { } + + /// + /// Called when the application has been started + /// + public virtual void OnApplicationStarted() + { + + } } /// @@ -90,6 +171,14 @@ namespace Tango.MachineStudio.Common } + /// + /// Called when the application has been started + /// + public virtual void OnApplicationStarted() + { + + } + /// /// Called when another module has wants to navigate to this module with some arguments. /// 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 e4a2720b9..ac6f84618 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 @@ -89,6 +89,7 @@ RealTimeGraphControl.xaml + @@ -287,5 +288,8 @@ True + + + \ No newline at end of file -- cgit v1.3.1