From e9b00a4a1df8aa4745332947c4ab45c412d7ec1c Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Fri, 15 Nov 2024 13:04:15 +0100 Subject: [PATCH] =?UTF-8?q?Binding=20zu=20UserPermission=20f=C3=BChrt=20im?= =?UTF-8?q?=20Designer=20nicht=20mehr=20zu=20Exception=20(Standardhaft=20z?= =?UTF-8?q?u=20true=20-=20hat=20Rechte)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/BeWoApp.xaml.cs | 3 +- .../Converter/UserPermission2BoolConverter.cs | 28 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index 6f2893c94..d14a2239c 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -44,7 +44,6 @@ namespace BeWo { private static DebugMessageLogView _DebugMessageLogView; - private static FrameworkElement _lockedContent; public static LoginControl LoginControl; @@ -55,6 +54,8 @@ namespace BeWo public static int RenderTier = 0; + public static bool IsInDesignMode = DesignerProperties.GetIsInDesignMode(new DependencyObject()); + internal static string IpAddress = string.Empty; internal static string Tenant = string.Empty; diff --git a/BeWo/Converter/UserPermission2BoolConverter.cs b/BeWo/Converter/UserPermission2BoolConverter.cs index a4a18ae83..e61ade63d 100644 --- a/BeWo/Converter/UserPermission2BoolConverter.cs +++ b/BeWo/Converter/UserPermission2BoolConverter.cs @@ -14,20 +14,28 @@ namespace BeWo.Converter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (value is UserRightType type) + try { - return BeWoApp.HasLoggedOnUserRight(type); - } + if (value is UserRightType type) + { + return BeWoApp.HasLoggedOnUserRight(type); + } - if (parameter is UserRightType type2) - { - return BeWoApp.HasLoggedOnUserRight(type2); - } + if (parameter is UserRightType type2) + { + return BeWoApp.HasLoggedOnUserRight(type2); + } - if (parameter is string setting && !string.IsNullOrWhiteSpace(setting)) + if (parameter is string setting && !string.IsNullOrWhiteSpace(setting)) + { + if (setting == SettingsKeys.AllowGkvAbrechnung) + return BeWoApp.AppSettings.AllowGkvAbrechnung; + } + } + catch (Exception) { - if (setting == SettingsKeys.AllowGkvAbrechnung) - return BeWoApp.AppSettings.AllowGkvAbrechnung; + if (BeWoApp.IsInDesignMode) + return true; } return false;