aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-28 12:55:42 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-28 12:55:42 +0200
commitf0a14c671e8611feb3611e7a174fef02ae26632a (patch)
tree0c99f25fae7a034f610d5805d6e1fb11de086702 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs
parent9f2a597f2404b3688f8bffb1ff67af6a3a119f18 (diff)
downloadTango-f0a14c671e8611feb3611e7a174fef02ae26632a.tar.gz
Tango-f0a14c671e8611feb3611e7a174fef02ae26632a.zip
Added clear cache custom action to machine studio installer maintenance.
Prevent save process parameters and save liquid factors with no researcher role. Fixed issue with brush stop offset meters refresh. Return back to dispensers list after saving dispenser. Fixed issue where brush stop offset sliders are not visible.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs
new file mode 100644
index 000000000..87a4d621e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs
@@ -0,0 +1,41 @@
+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;
+
+namespace Tango.MachineStudio.Common.Converters
+{
+ public class UserRoleToVisibilityConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var user = value as User;
+
+ if (user != null && parameter != null)
+ {
+ Roles role;
+ if (Enum.TryParse<Roles>(parameter.ToString(),out role))
+ {
+ if (user.HasRole(role))
+ {
+ return Visibility.Visible;
+ }
+ }
+ }
+
+ return Visibility.Collapsed;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}