From 0f410137ecf1d05789c48f470997f87bc6f8a5e5 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 23 Jun 2025 12:04:00 +0200 Subject: [PATCH 1/4] Buttons neu laden bei erneuter Ansicht --- BeWo/Core/Commands/CommandFactory.cs | 2 +- BeWo/View/Navigation/MainNavigationView.xaml.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BeWo/Core/Commands/CommandFactory.cs b/BeWo/Core/Commands/CommandFactory.cs index eb2090f52..4c2db2187 100644 --- a/BeWo/Core/Commands/CommandFactory.cs +++ b/BeWo/Core/Commands/CommandFactory.cs @@ -18,7 +18,7 @@ namespace BeWo.Core.Commands BeWoApp.HasLoggedOnUserRight(userRightType) && (additionalCheckup is null || additionalCheckup()); - return GetTestClientCommand(openView, canExecute, false); + return GetTestClientCommand(openView, canExecute, null); } public static DelegateCommand GetTestClientCommand(Action action, Func canExecute = null, bool? useCommandManager = null) diff --git a/BeWo/View/Navigation/MainNavigationView.xaml.cs b/BeWo/View/Navigation/MainNavigationView.xaml.cs index 06f8052e0..e2416ea32 100644 --- a/BeWo/View/Navigation/MainNavigationView.xaml.cs +++ b/BeWo/View/Navigation/MainNavigationView.xaml.cs @@ -506,7 +506,9 @@ namespace BeWo.View.Navigation private void OnLoaded(object sender, RoutedEventArgs e) { - textbox_search.Focus(); + CommandManager.InvalidateRequerySuggested(); + + textbox_search.Focus(); } private void OnOpenObject() From aecaf2d1ee1540156f75c3165c5117cfeb5f7e66 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 23 Jun 2025 12:04:22 +0200 Subject: [PATCH 2/4] redundant: Ist bereits in Style + Command Logik enthalten --- .../Detail/Zeiterfassung/ServiceRecordView2.xaml.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml.cs b/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml.cs index 35e908036..fa76cc33d 100644 --- a/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml.cs +++ b/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml.cs @@ -350,21 +350,11 @@ namespace BeWo.View.Detail.Zeiterfassung OpenAiWindowCommand = CommandFactory.GetAiViewCommand(OpenAiWindow, UserRightType.AiModuleView); OpenAiPopupCommand = CommandFactory.GetAiViewCommand(OpenAiPopup, UserRightType.AiModuleView2); - - if (!BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView)) - { - btnOpenAi2.Visibility = Visibility.Collapsed; - } - if (!BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView2)) - { - btnOpenAi3.Visibility = Visibility.Collapsed; - } } public ICommand OpenAiWindowCommand { get; set; } public ICommand OpenAiPopupCommand { get; set; } - private void SrGridControl_ItemsSourceChanged(object sender, DevExpress.Xpf.Grid.ItemsSourceChangedEventArgs e) { ErstelleRecordInformationString(); From a27f84af78847800346a24bebb4290708fbe97a5 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 23 Jun 2025 12:29:57 +0200 Subject: [PATCH 3/4] Fehler beim Logout --- BeWo/BeWoApp.xaml.cs | 4 ++-- BeWo/Core/Commands/CommandFactory.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index 39cc569f6..fff2245b2 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -633,8 +633,8 @@ namespace BeWo //showInfoButtonInCalender = true; //IsInDeveloperMode = true; //IsInDeveloperMode = false; - AppSettings.ModuleAiEnabled = true; - AppSettings.ModuleAiSettingsEnabled = false; + //AppSettings.ModuleAiEnabled = true; + //AppSettings.ModuleAiSettingsEnabled = false; AppSettings.IsSchedulerAllowed = true; #endif diff --git a/BeWo/Core/Commands/CommandFactory.cs b/BeWo/Core/Commands/CommandFactory.cs index 4c2db2187..141d52fb4 100644 --- a/BeWo/Core/Commands/CommandFactory.cs +++ b/BeWo/Core/Commands/CommandFactory.cs @@ -14,7 +14,7 @@ namespace BeWo.Core.Commands public static DelegateCommand GetAiViewCommand(Action openView, UserRightType userRightType, Func additionalCheckup = null) { bool canExecute() => - BeWoApp.AppSettings.ModuleAiEnabled && + (BeWoApp.AppSettings?.ModuleAiEnabled ?? false) && BeWoApp.HasLoggedOnUserRight(userRightType) && (additionalCheckup is null || additionalCheckup()); From b482896c8eb22e26b43ec5550f7109eb3e78bbe0 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 23 Jun 2025 12:33:15 +0200 Subject: [PATCH 4/4] =?UTF-8?q?double=20secure,=20wenn=20beim=20canExecute?= =?UTF-8?q?=20was=20schief=20l=C3=A4uft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/Core/Commands/CommandFactory.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/BeWo/Core/Commands/CommandFactory.cs b/BeWo/Core/Commands/CommandFactory.cs index 141d52fb4..5589c6658 100644 --- a/BeWo/Core/Commands/CommandFactory.cs +++ b/BeWo/Core/Commands/CommandFactory.cs @@ -18,7 +18,7 @@ namespace BeWo.Core.Commands BeWoApp.HasLoggedOnUserRight(userRightType) && (additionalCheckup is null || additionalCheckup()); - return GetTestClientCommand(openView, canExecute, null); + return GetTestClientCommand(openView, () => CheckupSafe(canExecute), null); } public static DelegateCommand GetTestClientCommand(Action action, Func canExecute = null, bool? useCommandManager = null) @@ -27,7 +27,19 @@ namespace BeWo.Core.Commands CheckupTestVersion() && (canExecute is null || canExecute()); - return new DelegateCommand(action, canExecute2, useCommandManager); + return new DelegateCommand(action, () => CheckupSafe(canExecute2), useCommandManager); + } + + private static bool CheckupSafe(Func predicate) + { + try + { + return predicate(); + } + catch (Exception ex) + { + return false; + } } private static bool CheckupTestVersion()