diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 69f8c2b9e..56c0b6cf7 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -96,7 +96,6 @@ - @@ -3518,6 +3517,7 @@ + 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/Converter/Features/AiConversationMessageSystemConverter.cs b/BeWo/Converter/Features/AiConversationMessageSystemConverter.cs deleted file mode 100644 index 9b27509d5..000000000 --- a/BeWo/Converter/Features/AiConversationMessageSystemConverter.cs +++ /dev/null @@ -1,32 +0,0 @@ -using BeWo.View.Navigation.Filter; -using BS.Shared.DataContracts; -using BS.Shared; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Data; -using BeWo.ViewModel; - -namespace BeWo.Converter.Features -{ - public class AiConversationMessageSystemConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (BeWoApp.IsInDeveloperMode) - return value; - - var ret = (value as IEnumerable).Where(vm => vm.Role != AiConversationMessageRole.System); - - return ret; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/BeWo/Core/Commands/CommandFactory.cs b/BeWo/Core/Commands/CommandFactory.cs index eb2090f52..5589c6658 100644 --- a/BeWo/Core/Commands/CommandFactory.cs +++ b/BeWo/Core/Commands/CommandFactory.cs @@ -14,11 +14,11 @@ 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()); - return GetTestClientCommand(openView, canExecute, false); + 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() diff --git a/BeWo/DebugConfig.cs b/BeWo/DebugConfig.cs index 83ebc7e99..4a6f9dd15 100644 --- a/BeWo/DebugConfig.cs +++ b/BeWo/DebugConfig.cs @@ -145,11 +145,11 @@ namespace BeWo { DebugConfigMode = DebugConfigMode.FeatureAiModule, AutoLogin = true, - //SelectView = UIContext.AiConversation, + SelectView = UIContext.Customer, //SelectIndex = 8, - //DefaultLoginUsername = "m1", - //DefaultLoginPassword = "bewobewo", - //DefaultProfilename = "5000000000", + DefaultLoginUsername = "m1", + DefaultLoginPassword = "bewobewo", + DefaultProfilename = "5000000000", EnableAutoRemoteDebugging = true }); diff --git a/BeWo/View/Detail/AI/AiConversationChatView.xaml b/BeWo/View/Detail/AI/AiConversationChatView.xaml index 5bf69aca8..6d6f990d4 100644 --- a/BeWo/View/Detail/AI/AiConversationChatView.xaml +++ b/BeWo/View/Detail/AI/AiConversationChatView.xaml @@ -3,7 +3,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ai="clr-namespace:BeWo.View.Detail.AI" - xmlns:conv="clr-namespace:BeWo.Converter.Features" xmlns:core="clr-namespace:BS.Shared.Core;assembly=BS.Shared" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" @@ -31,7 +30,6 @@ - @@ -114,7 +112,7 @@ + SelectionChanged="listview_conversations_SelectionChanged">