Merge branch 'feature_rene_18_ai'

# Conflicts:
#	BeWo/View/Controls/AI/AiPromptbausteinButton.xaml.cs
#	Service/ServiceImplementations/Enhanced/StatusServiceImp.cs
This commit is contained in:
2026-06-16 12:01:30 +02:00
164 changed files with 6790 additions and 3569 deletions

View File

@@ -21,8 +21,6 @@ using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords;
using BS.Shared.Extensions;
using BS.Shared.Translation;
using DevExpress.Mvvm;

View File

@@ -119,7 +119,9 @@
<Compile Include="Converter\NewlineConverter.cs" />
<Compile Include="Converter\StringEmptyBoolConverter.cs" />
<Compile Include="Core\BeWoAppVersion.cs" />
<Compile Include="Core\BeWoUserUtils.cs" />
<Compile Include="Core\Commands\CommandFactory.cs" />
<Compile Include="Core\EventArg\TextAcceptedEventArgs.cs" />
<Compile Include="Scheduling\View\AbsenceTimesCreationView.xaml.cs">
<DependentUpon>AbsenceTimesCreationView.xaml</DependentUpon>
</Compile>
@@ -147,6 +149,8 @@
<Compile Include="Styles\DataTemplates\DataTemplates.xaml.cs">
<DependentUpon>DataTemplates.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModel\Controls\AI\AiChatButtonViewModel.cs" />
<Compile Include="ViewModel\Controls\AI\AiChatButtonWithHistoryViewModel.cs" />
<Compile Include="ViewModel\TeamFolderRightVM.cs" />
<Compile Include="ViewModel\AddressVM.cs" />
<Compile Include="ViewModel\AiConfigVM.cs" />
@@ -165,17 +169,21 @@
<Compile Include="ViewModel\View\Administration\AiPromptbausteinComplexTreeViewModel.cs" />
<Compile Include="ViewModel\View\Administration\AiPromptbausteinFolderViewModel.cs" />
<Compile Include="ViewModel\View\Administration\AiPromptbausteinPromptViewModel.cs" />
<Compile Include="ViewModel\View\Administration\AiPromptbausteinRoutineViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiConversationChatViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinActionResultViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinComplexSelectionViewModel.cs" />
<Compile Include="ViewModel\IAiPromptbausteinComplexViewModel.cs" />
<Compile Include="ViewModel\View\Developer\DesignDeveloperViewModel.cs" />
<Compile Include="ViewModel\View\Developer\DeveloperViewModel.cs" />
<Compile Include="ViewModel\View\DialogViewModel.cs" />
<Compile Include="ViewModel\View\Gkv\GkvAbrechnungDialogViewModel.cs" />
<Compile Include="ViewModel\View\WindowViewModel.cs" />
<Compile Include="View\Controls\AI\AiConversationButton.xaml.cs">
<DependentUpon>AiConversationButton.xaml</DependentUpon>
<Compile Include="View\Controls\AI\AiChatButton.xaml.cs">
<DependentUpon>AiChatButton.xaml</DependentUpon>
</Compile>
<Compile Include="View\Controls\AI\AiPromptbausteinButton.xaml.cs">
<DependentUpon>AiPromptbausteinButton.xaml</DependentUpon>
<Compile Include="View\Controls\AI\AiPromptbausteinLibraryControl.xaml.cs">
<DependentUpon>AiPromptbausteinLibraryControl.xaml</DependentUpon>
</Compile>
<Compile Include="View\Detail\AI\AiPromptbausteinActionResultView.xaml.cs">
<DependentUpon>AiPromptbausteinActionResultView.xaml</DependentUpon>
@@ -205,9 +213,15 @@
<Compile Include="View\Detail\AI\AiConfigView.xaml.cs">
<DependentUpon>AiConfigView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Detail\AI\AiPromptbausteinRoutineView.xaml.cs">
<DependentUpon>AiPromptbausteinRoutineView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Detail\Report\DatenbereinigungView.xaml.cs">
<DependentUpon>DatenbereinigungView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Developer\DeveloperView.xaml.cs">
<DependentUpon>DeveloperView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Document\TeamFolderRightView.xaml.cs">
<DependentUpon>TeamFolderRightView.xaml</DependentUpon>
</Compile>
@@ -216,6 +230,7 @@
</Compile>
<Compile Include="View\Navigation\Filter\ValueListFilter.cs" />
<Compile Include="View\TemplateSelectors\AiConversationMessageTemplateSelector.cs" />
<Compile Include="View\TemplateSelectors\AiPromptbausteinFolderItemTemplateSelector.cs" />
<Compile Include="View\Windows\AnimatedBeWoWindow.xaml.cs">
<DependentUpon>AnimatedBeWoWindow.xaml</DependentUpon>
</Compile>
@@ -287,11 +302,15 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\Controls\AI\AiConversationButton.xaml">
<Page Include="Styles\Designs\GeometryCollection.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Controls\AI\AiPromptbausteinButton.xaml">
<Page Include="View\Controls\AI\AiChatButton.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Controls\AI\AiPromptbausteinLibraryControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -343,10 +362,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Detail\AI\AiPromptbausteinRoutineView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Detail\Report\DatenbereinigungView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\Developer\DeveloperView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Document\TeamFolderRightView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View File

@@ -37,6 +37,7 @@ using DevExpress.XtraScheduler;
using System.ServiceModel;
using BeWo.View.Windows;
using System.Diagnostics;
using BeWo.Services;
namespace BeWo
{
@@ -81,6 +82,8 @@ namespace BeWo
public static bool IsInDesignMode = DesignerProperties.GetIsInDesignMode(new DependencyObject());
internal static IBeWoWindowService WindowService { get; set; }
public static EmployeeDC LoggedOnEmployee
{
get => _LoggedOnEmployee;
@@ -784,10 +787,20 @@ namespace BeWo
//{
// url += "/service45";
//}
if (url.IndexOf("/service") < 0)
if (BeWoAppInfo.IsInAiMode)
{
url += "/service";
if (url.IndexOf("/service_ai") < 0)
{
url += "/service_ai";
}
}
else
{
if (url.IndexOf("/service") < 0)
{
url += "/service";
}
}
return new Uri(String.Format("https://{0}", url));
}
@@ -1073,16 +1086,11 @@ namespace BeWo
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
BeWoAppInfo.BeWoAppVersion.TryActiveDeveloperMode(e.Args);
var controlFactory = new BeWoControlFactory();
var windowFactory = new BeWoWindowFactory();
WindowService = new BeWoWindowService(windowFactory, controlFactory);
//if(e.Args.LastOrDefault(x => x.StartsWith("/timeout:") || x.StartsWith("--timeout:")) is string str)
//{
// var valuePart = str.Substring(str.IndexOf(':') + 1);
// if(int.TryParse(valuePart, out int parsedTimeout))
// {
// AiTimeout = parsedTimeout;
// }
//}
BeWoAppInfo.BeWoAppVersion.TryActiveDeveloperMode(e.Args);
}
public static void ShowInfoMessage(string message)

View File

@@ -15,12 +15,12 @@ namespace BeWo
{
var baseVersion = new Version(BeWoApp.ShortVersion);
var stage = BeWoClientReleaseStage.Sandbox;
var stageVersion = new Version("4.5");
var stageVersion = new Version("5.1.5");
var feature = BeWoClientFeature.AI;
#if !DEBUG
stage = BeWoClientReleaseStage.Release;
feature = BeWoClientFeature.None;
//stage = BeWoClientReleaseStage.Release;
//feature = BeWoClientFeature.None;
#endif
BeWoAppVersion = new BeWoAppVersion(baseVersion, stage, stageVersion, feature);

View File

@@ -1,5 +1,8 @@
using System;
using System.Collections;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Data;
namespace BeWo.Converter
@@ -10,8 +13,29 @@ namespace BeWo.Converter
{
try
{
var count = (int) value;
return count > 0;
int count;
switch (value)
{
case int i:
count = i;
break;
case ICollection collection:
count = collection.Count;
break;
case IEnumerable enumerable:
count = enumerable.Cast<object>().Count();
break;
default:
return false;
}
if (parameter is string s && s == "reverse")
{
return !(count > 0);
}
return count > 0;
}
catch (Exception)
{

View File

@@ -1,5 +1,7 @@
using System;
using System.Collections;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Data;
@@ -11,8 +13,29 @@ namespace BeWo.Converter
{
try
{
var count = (int)value;
return count > 0 ? Visibility.Visible : Visibility.Collapsed;
int count;
switch (value)
{
case int i:
count = i;
break;
case ICollection collection:
count = collection.Count;
break;
case IEnumerable enumerable:
count = enumerable.Cast<object>().Count();
break;
default:
return Visibility.Collapsed;
}
if (parameter is string s && s == "reverse")
{
return count > 0 ? Visibility.Collapsed : Visibility.Visible;
}
return count > 0 ? Visibility.Visible : Visibility.Collapsed;
}
catch (Exception)
{

View File

@@ -1,4 +1,5 @@
using BeWo.ViewModel;
using DevExpress.Mvvm;
using System;
using System.Globalization;
using System.Windows.Data;
@@ -12,6 +13,8 @@ namespace BeWo.Converter
if (value is null)
return null;
var t = ((DelegateCommand)value).CanExecute(null);
return value;
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Core
{
public static class BeWoUserUtils
{
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Core.EventArg
{
public class TextAcceptedEventArgs : EventArgs
{
public string Text { get; }
public TextAcceptedEventArgs(string text)
{
Text = text;
}
}
}

View File

@@ -53,6 +53,8 @@ namespace BeWo
public bool EnableAutoRemoteDebugging { get; set; }
public bool EnableAllUserRightsInDebug { get; set; } = false;
public bool EnableDeveloperView { get; set; } = false;
public static DebugConfig SimpleAutoLogin => new DebugConfig()
{
DebugConfigMode = DebugConfigMode.SimpleAutoLogin,
@@ -152,7 +154,8 @@ namespace BeWo
//DefaultLoginUsername = "m1",
//DefaultLoginPassword = "bewobewo",
//DefaultProfilename = "5000000000",
EnableAutoRemoteDebugging = true
EnableAutoRemoteDebugging = true,
EnableDeveloperView = true
});
name2config.Add("FeatureXRechnung",

View File

@@ -192,11 +192,16 @@ namespace BeWo
UpdateMandator();
var controlFactory = new BeWoControlFactory();
var windowFactory = new BeWoWindowFactory();
WindowService = new BeWoWindowService(windowFactory, controlFactory);
#if DEBUG
if (DebugConfig.CurrentConfig is DebugConfig config && config.EnableDeveloperView)
{
WindowService.ShowDeveloper();
}
#endif
}
public IBeWoWindowService WindowService => BeWoApp.WindowService;
private AnimatedBeWoWindow _CurrentAnimatedBeWoWindow;
public AnimatedBeWoWindow CurrentAnimatedBeWoWindow
{
@@ -217,8 +222,6 @@ namespace BeWo
}
}
internal IBeWoWindowService WindowService { get; set; }
public List<ModalViewWindow> OpenedModalViewWindows { get; set; }
internal Dictionary<UIContext, BeWoView> Views

View File

@@ -31,16 +31,78 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetAiConversations", ReplyAction="http://tempuri.org/IAiEnhancedService/GetAiConversationsResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetAiConversationsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiContextType uicontext, System.Nullable<long> oid);
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiActionType actionType, System.Nullable<long> oid);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CreateAiConversation", ReplyAction="http://tempuri.org/IAiEnhancedService/CreateAiConversationResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CreateAiConversationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid);
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.BeWoDataContract))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConfigDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiModelDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiModelDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiUserSettingDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Compact.CompactEmployeeDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<long>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<long, BS.Shared.ValueListEntryType>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFault))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFaultType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiDataContextType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiModelSource))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiActionType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.TableID))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiConversationMessageRole))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ActivationTypeId))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ValueListEntryType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiRoutineType))]
BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CreateAiConversationWithMessage", ReplyAction="http://tempuri.org/IAiEnhancedService/CreateAiConversationWithMessageResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CreateAiConversationWithMessageBeWoFaultFau" +
"lt", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversationWithMessage(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid, string message);
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.BeWoDataContract))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConfigDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiModelDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiModelDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiUserSettingDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Compact.CompactEmployeeDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<long>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<long, BS.Shared.ValueListEntryType>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFault))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFaultType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiDataContextType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiModelSource))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiActionType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.TableID))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiConversationMessageRole))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ActivationTypeId))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ValueListEntryType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiRoutineType))]
BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversationWithMessage(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context, string message);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CloneAiConversation", ReplyAction="http://tempuri.org/IAiEnhancedService/CloneAiConversationResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CloneAiConversationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
@@ -59,9 +121,112 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/SendNewMessageBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC> SendNewMessage(long conversation, string message);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/ExecuteAiConversationWithPrompt", ReplyAction="http://tempuri.org/IAiEnhancedService/ExecuteAiConversationWithPromptResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/ExecuteAiConversationWithPromptBeWoFaultFau" +
"lt", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.BeWoDataContract))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConfigDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiModelDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiModelDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiUserSettingDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Compact.CompactEmployeeDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<long>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<long, BS.Shared.ValueListEntryType>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFault))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFaultType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiDataContextType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiModelSource))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiActionType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.TableID))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiConversationMessageRole))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ActivationTypeId))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ValueListEntryType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiRoutineType))]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC> ExecuteAiConversationWithPrompt(long conversation, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context, long prompt_oid);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/ExecuteAiConversationWithRoutine", ReplyAction="http://tempuri.org/IAiEnhancedService/ExecuteAiConversationWithRoutineResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/ExecuteAiConversationWithRoutineBeWoFaultFa" +
"ult", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.BeWoDataContract))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConfigDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiModelDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiModelDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiUserSettingDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Compact.CompactEmployeeDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<long>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<long, BS.Shared.ValueListEntryType>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFault))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFaultType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiDataContextType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiModelSource))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiActionType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.TableID))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiConversationMessageRole))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ActivationTypeId))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ValueListEntryType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiRoutineType))]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC> ExecuteAiConversationWithRoutine(long conversation, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context, long routine, int step);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CheckContextSize", ReplyAction="http://tempuri.org/IAiEnhancedService/CheckContextSizeResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CheckContextSizeBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
bool CheckContextSize(BS.Shared.AiContextType aiContextType, System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>> context, System.Nullable<long> modell_oid);
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.BeWoDataContract))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConfigDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiModelDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiModelDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineStepDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Feature.AI.AiUserSettingDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Compact.CompactEmployeeDC))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List<long>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<long, BS.Shared.ValueListEntryType>))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFault))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Core.BeWoFaultType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiDataContextType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiModelSource))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiActionType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.TableID))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiConversationMessageRole))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ActivationTypeId))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ValueListEntryType))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiRoutineType))]
bool CheckContextSize(BS.Shared.AiActionType actionType, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteinFolder", ReplyAction="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteinFolderResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteinFolderBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
@@ -69,34 +234,42 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinFolder", ReplyAction="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinFolderResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinFolderBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> InsertAiPromptbausteinFolder(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> folders);
BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC InsertAiPromptbausteinFolder(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC folders);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinPrompt", ReplyAction="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinPromptResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinPromptBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC> InsertAiPromptbausteinPrompt(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC> prompts);
BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC InsertAiPromptbausteinPrompt(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC prompts);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinRoutine", ReplyAction="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinRoutineResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinRoutineBeWoFaultFault" +
"", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC InsertAiPromptbausteinRoutine(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC routine);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinFolder", ReplyAction="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinFolderResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinFolderBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> UpdateAiPromptbausteinFolder(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> folders);
BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC UpdateAiPromptbausteinFolder(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC folders);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinPrompt", ReplyAction="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinPromptResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinPromptBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC> UpdateAiPromptbausteinPrompt(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC> prompts);
BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC UpdateAiPromptbausteinPrompt(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC prompts);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinRoutine", ReplyAction="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinRoutineResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinRoutineBeWoFaultFault" +
"", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC UpdateAiPromptbausteinRoutine(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC routine);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinFolder", ReplyAction="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinFolderResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinFolderBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
void DeleteAiPromptbausteinFolder(System.Collections.Generic.Dictionary<long, long> oid2version);
void DeleteAiPromptbausteinFolder(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC folder);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinPrompt", ReplyAction="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinPromptResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinPromptBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
void DeleteAiPromptbausteinPrompt(System.Collections.Generic.Dictionary<long, long> oid2version);
void DeleteAiPromptbausteinPrompt(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC prompt);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/ExecuteAiFunctionServiceRecordDocumentation" +
"", ReplyAction="http://tempuri.org/IAiEnhancedService/ExecuteAiFunctionServiceRecordDocumentation" +
"Response")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/ExecuteAiFunctionServiceRecordDocumentation" +
"BeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords.AiFunctionDocResponse ExecuteAiFunctionServiceRecordDocumentation(BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords.AiFunctionDocRequest request);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinRoutine", ReplyAction="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinRoutineResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinRoutineBeWoFaultFault" +
"", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
void DeleteAiPromptbausteinRoutine(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC routine);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetUserSetting", ReplyAction="http://tempuri.org/IAiEnhancedService/GetUserSettingResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetUserSettingBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
@@ -156,19 +329,19 @@ namespace BeWo.ServiceProxy
return base.Channel.GetAiModels();
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiContextType uicontext, System.Nullable<long> oid)
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiActionType actionType, System.Nullable<long> oid)
{
return base.Channel.GetAiConversations(uicontext, oid);
return base.Channel.GetAiConversations(actionType, oid);
}
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid)
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context)
{
return base.Channel.CreateAiConversation(conversation, modell_oid);
return base.Channel.CreateAiConversation(conversation, view_context);
}
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversationWithMessage(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid, string message)
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversationWithMessage(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context, string message)
{
return base.Channel.CreateAiConversationWithMessage(conversation, modell_oid, message);
return base.Channel.CreateAiConversationWithMessage(conversation, view_context, message);
}
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CloneAiConversation(long conversation_oid, System.Nullable<long> message_oid)
@@ -191,9 +364,19 @@ namespace BeWo.ServiceProxy
return base.Channel.SendNewMessage(conversation, message);
}
public bool CheckContextSize(BS.Shared.AiContextType aiContextType, System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>> context, System.Nullable<long> modell_oid)
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC> ExecuteAiConversationWithPrompt(long conversation, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context, long prompt_oid)
{
return base.Channel.CheckContextSize(aiContextType, context, modell_oid);
return base.Channel.ExecuteAiConversationWithPrompt(conversation, view_context, prompt_oid);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationMessageDC> ExecuteAiConversationWithRoutine(long conversation, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context, long routine, int step)
{
return base.Channel.ExecuteAiConversationWithRoutine(conversation, view_context, routine, step);
}
public bool CheckContextSize(BS.Shared.AiActionType actionType, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context)
{
return base.Channel.CheckContextSize(actionType, view_context);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> GetAiPromptbausteinFolder(BS.Shared.AiActionType aiActionType)
@@ -201,39 +384,49 @@ namespace BeWo.ServiceProxy
return base.Channel.GetAiPromptbausteinFolder(aiActionType);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> InsertAiPromptbausteinFolder(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> folders)
public BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC InsertAiPromptbausteinFolder(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC folders)
{
return base.Channel.InsertAiPromptbausteinFolder(folders);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC> InsertAiPromptbausteinPrompt(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC> prompts)
public BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC InsertAiPromptbausteinPrompt(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC prompts)
{
return base.Channel.InsertAiPromptbausteinPrompt(prompts);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> UpdateAiPromptbausteinFolder(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> folders)
public BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC InsertAiPromptbausteinRoutine(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC routine)
{
return base.Channel.InsertAiPromptbausteinRoutine(routine);
}
public BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC UpdateAiPromptbausteinFolder(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC folders)
{
return base.Channel.UpdateAiPromptbausteinFolder(folders);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC> UpdateAiPromptbausteinPrompt(System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC> prompts)
public BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC UpdateAiPromptbausteinPrompt(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC prompts)
{
return base.Channel.UpdateAiPromptbausteinPrompt(prompts);
}
public void DeleteAiPromptbausteinFolder(System.Collections.Generic.Dictionary<long, long> oid2version)
public BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC UpdateAiPromptbausteinRoutine(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC routine)
{
base.Channel.DeleteAiPromptbausteinFolder(oid2version);
return base.Channel.UpdateAiPromptbausteinRoutine(routine);
}
public void DeleteAiPromptbausteinPrompt(System.Collections.Generic.Dictionary<long, long> oid2version)
public void DeleteAiPromptbausteinFolder(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC folder)
{
base.Channel.DeleteAiPromptbausteinPrompt(oid2version);
base.Channel.DeleteAiPromptbausteinFolder(folder);
}
public BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords.AiFunctionDocResponse ExecuteAiFunctionServiceRecordDocumentation(BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords.AiFunctionDocRequest request)
public void DeleteAiPromptbausteinPrompt(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinPromptDC prompt)
{
return base.Channel.ExecuteAiFunctionServiceRecordDocumentation(request);
base.Channel.DeleteAiPromptbausteinPrompt(prompt);
}
public void DeleteAiPromptbausteinRoutine(BS.Shared.DataContracts.Feature.AI.AiPromptbausteinRoutineDC routine)
{
base.Channel.DeleteAiPromptbausteinRoutine(routine);
}
public BS.Shared.DataContracts.Feature.AI.AiUserSettingDC GetUserSetting()

View File

@@ -1028,6 +1028,7 @@ namespace BeWo.ServiceProxy
private static void StartWaiting()
{
Monitor.Enter(_Lock);
if ((++_RunningAsyncs) == 1 && BeWoApp.MainControl != null)
{
if (BeWoApp.MainControl.CurrentAnimatedBeWoWindow is null)
@@ -1042,6 +1043,7 @@ namespace BeWo.ServiceProxy
private static void EndWaiting()
{
Monitor.Enter(_Lock);
if ((--_RunningAsyncs) == 0 && BeWoApp.MainControl != null)
{
BeWoApp.MainControl.CurrentAnimatedBeWoWindow?.EndWaiting();
@@ -1056,6 +1058,22 @@ namespace BeWo.ServiceProxy
return _RunningAsyncs != 0;
}
public static void StartManuelWaiting()
{
if (_RunningAsyncs != 0)
throw new InvalidOperationException("_RunningAsyncs != 0");
_RunningAsyncs++;
}
public static void EndManuelWaiting()
{
if (_RunningAsyncs != 1)
throw new InvalidOperationException("_RunningAsyncs != 1");
_RunningAsyncs--;
}
//public static void WaitUntilAsyncIsFinished(Action<bool> callback = null)
//{
// if (!IsWaiting())

View File

@@ -19,7 +19,7 @@ namespace BeWo.Services
{
public Control GetAiConversationControl(AiConversationChatViewModel vm)
{
var styleString = getStyleString(vm.AiContext);
var styleString = getStyleString(vm.ActionType);
var control = styleString is object ? new AiConversationChatView(vm, styleString) : new AiConversationChatView(vm);
@@ -52,18 +52,21 @@ namespace BeWo.Services
return control;
}
private string getStyleString(AiContextType uIContext) {
switch (uIContext)
private string getStyleString(AiActionType actionType) {
switch (actionType)
{
case AiContextType.SupportConceptNavigation: return "ModuleAiControlSupportConceptStyle";
case AiContextType.CustomerNavigation: return "ModuleAiControlCustomerStyle";
case AiContextType.PersonNavigation: return "ModuleAiControlPersonStyle";
case AiContextType.EmployeeNavigation: return "ModuleAiControlEmployeeStyle";
case AiContextType.OrganisationNavigation: return "ModuleAiControlOrganisationStyle";
case AiContextType.ServiceRecord: return "ModuleAiControlZeiterfassungStyle";
case AiContextType.CustomerDetail: return "ModuleAiControlCustomerStyle";
case AiContextType.PersonDetail: return "ModuleAiControlPersonStyle";
case AiContextType.EmployeeDetail: return "ModuleAiControlEmployeeStyle";
case AiActionType.ServiceRecordConversation: return "ModuleAiControlZeiterfassungStyle";
case AiActionType.ServiceRecordDocumentation: return "ModuleAiControlZeiterfassungStyle";
//case AiContextType.SupportConceptNavigation: return "ModuleAiControlSupportConceptStyle";
//case AiContextType.CustomerNavigation: return "ModuleAiControlCustomerStyle";
//case AiContextType.PersonNavigation: return "ModuleAiControlPersonStyle";
//case AiContextType.EmployeeNavigation: return "ModuleAiControlEmployeeStyle";
//case AiContextType.OrganisationNavigation: return "ModuleAiControlOrganisationStyle";
//case AiContextType.ServiceRecord: return "ModuleAiControlZeiterfassungStyle";
//case AiContextType.CustomerDetail: return "ModuleAiControlCustomerStyle";
//case AiContextType.PersonDetail: return "ModuleAiControlPersonStyle";
//case AiContextType.EmployeeDetail: return "ModuleAiControlEmployeeStyle";
}
return null;

View File

@@ -17,15 +17,10 @@ namespace BeWo.Services
{
public class BeWoWindowFactory
{
private Dictionary<AiContextType, string> _UIContext2Header = new Dictionary<AiContextType, string>()
private Dictionary<AiActionType, string> _UIContext2Header = new Dictionary<AiActionType, string>()
{
{AiContextType.ServiceRecord, "KI Chat: Zeiterfassung" },
{AiContextType.CustomerNavigation, "KI Chat: Klienten Übersicht" },
{AiContextType.PersonNavigation, "KI Chat: Personen Übersicht" },
{AiContextType.EmployeeNavigation, "KI Chat: Mitarbeiter Übersicht" },
{AiContextType.OrganisationNavigation, "KI Chat: Organisation Übersicht" },
{AiContextType.SupportConceptNavigation, "KI Chat: Hilfeplan Übersicht" },
{AiContextType.CustomerDetail, "KI Chat: Klient" },
{AiActionType.ServiceRecordConversation, "KI Chat: Zeiterfassung" },
{AiActionType.ServiceRecordDocumentation, "KI Doku: Zeiterfassung" }
};
public Control GetModalViewWindow(string title, Control control, double height = 600, double width = 1200)
@@ -69,9 +64,9 @@ namespace BeWo.Services
return "GKV-Abrechnung Nr. " + vm.Oid;
}
public string GetAiTitle(AiContextType aiContextType)
public string GetAiTitle(AiActionType actionType)
{
if (_UIContext2Header.TryGetValue(aiContextType, out string str))
if (_UIContext2Header.TryGetValue(actionType, out string str))
return str;
return "default";

View File

@@ -23,6 +23,10 @@ using System.Windows.Controls.Primitives;
using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames;
using DevExpress.Mvvm.Native;
using BeWo.ViewModel.View.Gkv;
using BeWo.ViewModel.View.Developer;
using BeWo.View.Developer;
using System.Windows.Forms;
using static DevExpress.Mvvm.Native.Either;
namespace BeWo.Services
{
@@ -68,16 +72,20 @@ namespace BeWo.Services
{
ShowAiPromptbausteinSelectionComplexWindow(viewModel6);
}
else if (windowViewModel is AiPromptbausteinRoutineViewModel viewModel7)
{
ShowAiPromptbausteinRoutineWindow(viewModel7);
}
else
{
throw new NotImplementedException($"type not implemented: {typeof(T)}");
}
}
public void ShowAiConversationWindow(AiConversationChatViewModel viewModel)
private void ShowAiConversationWindow(AiConversationChatViewModel viewModel)
{
var control = _controlFactory.GetAiConversationControl(viewModel);
var title = _windowFactory.GetAiTitle(viewModel.AiContext);
var title = _windowFactory.GetAiTitle(viewModel.ActionType);
var options = new BeWoWindowOptions()
{
Height = 600,
@@ -85,7 +93,7 @@ namespace BeWo.Services
};
Show(title, control, viewModel, options);
}
public void ShowAiPromptbausteinFolderWindow(AiPromptbausteinFolderViewModel viewModel)
private void ShowAiPromptbausteinFolderWindow(AiPromptbausteinFolderViewModel viewModel)
{
var control = new AiPromptbausteinFolderView(viewModel);
var options = new BeWoWindowOptions()
@@ -95,7 +103,7 @@ namespace BeWo.Services
};
Show("KI Promptbaustein Ordner", control, viewModel, options);
}
public void ShowAiPromptbausteinPromptWindow(AiPromptbausteinPromptViewModel viewModel)
private void ShowAiPromptbausteinPromptWindow(AiPromptbausteinPromptViewModel viewModel)
{
var control = new AiPromptbausteinPromptView(viewModel);
var options = new BeWoWindowOptions()
@@ -105,7 +113,17 @@ namespace BeWo.Services
};
Show("KI Promptbaustein Prompt", control, viewModel, options);
}
public void ShowAiPromptbausteinActionResultWindow(AiPromptbausteinActionResultViewModel viewModel)
private void ShowAiPromptbausteinRoutineWindow(AiPromptbausteinRoutineViewModel viewModel)
{
var control = new AiPromptbausteinRoutineView(viewModel);
var options = new BeWoWindowOptions()
{
Height = 600,
Width = 600
};
Show("KI Promptbaustein Routine", control, viewModel, options);
}
private void ShowAiPromptbausteinActionResultWindow(AiPromptbausteinActionResultViewModel viewModel)
{
var control = new AiPromptbausteinActionResultView(viewModel);
var options = new BeWoWindowOptions()
@@ -116,17 +134,55 @@ namespace BeWo.Services
Show("KI Promptbaustein Ergebnis", control, viewModel, options);
}
public void ShowAiPromptbausteinSelectionComplexWindow(AiPromptbausteinSelectionComplexViewModel viewModel)
private void ShowAiPromptbausteinSelectionComplexWindow(AiPromptbausteinSelectionComplexViewModel viewModel)
{
var control = new AiPromptbausteinComplexSelectionView(viewModel);
var options = new BeWoWindowOptions()
{
Height = 400,
Width = 600
Height = 600,
Width = 900
};
Show("KI Promptbaustein Auswahl", control, viewModel, options);
}
#if DEBUG
public void ShowDeveloper(DeveloperViewModel viewModel = null)
{
if(viewModel == null)
viewModel = new DeveloperViewModel();
var control = new DeveloperView(viewModel);
var window = new Window();
window.Title = "Developer Informations";
window.Content = control;
window.Height = 600;
window.Width = 800;
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.Topmost = true;
window.Deactivated += (s, e) =>
{
//window.Topmost = false; // set topmost false first
//window.Topmost = true; // then set topmost true again.
};
var screens = Screen.AllScreens;
var firstSecondary = screens.OrderBy(x => x.Bounds.X).LastOrDefault(s => s.Primary == false);
if (firstSecondary != null)
{
window.WindowStartupLocation = WindowStartupLocation.Manual;
// Ensure Window is minimized on creation
window.WindowState = WindowState.Minimized;
// Define Position on Secondary screen, for "Normal" window-mode
// ( Here Top/Left-Position )
window.Left = firstSecondary.Bounds.Left;
window.Top = firstSecondary.Bounds.Top;
}
window.Show();
}
#endif
public void ShowGkvAbrechnungDetailWindow(GkvAbrechnungDialogViewModel vm)
{
@@ -165,8 +221,8 @@ namespace BeWo.Services
Show(title, control, null, pOptions);
}
private void Show(string title, Control control, WindowViewModel windowViewModel, BeWoWindowOptions options)
{
private void Show(string title, System.Windows.Controls.Control control, WindowViewModel windowViewModel, BeWoWindowOptions options)
{
if (options.ShowAsModal)
{
var modal = _windowFactory.GetModalViewWindow(title, control, options.Height, options.Width);
@@ -181,7 +237,7 @@ namespace BeWo.Services
if (windowViewModel is DialogViewModel dialogViewModel)
{
dialogViewModel.RequestClose += (s, e) => window.Close();
dialogViewModel.RequestCloseFinal += (s, e) => window.Close();
}
if (options.ShowAsDialog)

View File

@@ -1,8 +1,10 @@
using BeWo.ViewModel;
using BeWo.View.Developer;
using BeWo.ViewModel;
using BeWo.ViewModel.Light;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.Administration;
using BeWo.ViewModel.View.AI;
using BeWo.ViewModel.View.Developer;
using BeWo.ViewModel.View.Gkv;
using BS.Shared;
using System;
@@ -20,7 +22,6 @@ namespace BeWo.Services
public interface IBeWoWindowService
{
#region special
void ShowAiConversationWindow(AiConversationChatViewModel viewModel);
void ShowGkvAbrechnungDetailWindow(GkvAbrechnungDialogViewModel vm);
#endregion
@@ -34,5 +35,9 @@ namespace BeWo.Services
#endregion
void Show<T>(T windowViewModel) where T : WindowViewModel;
#if DEBUG
void ShowDeveloper(DeveloperViewModel windowViewModel = null);
#endif
}
}

View File

@@ -2,6 +2,7 @@
<!-- Base -->
<Style x:Key="BaseButton" TargetType="{x:Type Button}">
<Setter Property="Margin" Value="3" />
<Setter Property="MinWidth" Value="25" />
<Setter Property="Height" Value="25" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
@@ -441,4 +442,52 @@
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="ButtonPreviousStyle2"
BasedOn="{StaticResource PrimaryButton}"
TargetType="{x:Type Button}">
<Setter Property="Width" Value="25" />
<Setter Property="Height" Value="25" />
<Setter Property="Margin" Value="3" />
<Setter Property="Content">
<Setter.Value>
<Image
Width="20"
Height="18"
Margin="0,3,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="..\..\Ressources\Icons\Undo.png" />
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="ButtonRedoStyle2"
BasedOn="{StaticResource PrimaryButton}"
TargetType="{x:Type Button}">
<Setter Property="Width" Value="25" />
<Setter Property="Height" Value="25" />
<Setter Property="Margin" Value="3" />
<Setter Property="Content">
<Setter.Value>
<Image
Width="20"
Height="18"
Margin="0,3,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="..\..\Ressources\Icons\Undo.png" />
</Setter.Value>
</Setter>
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<ScaleTransform ScaleX="-1" />
<TranslateTransform X="25" />
</TransformGroup>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -46,4 +46,18 @@
</Trigger>
</Style.Triggers>
</Style>
<Style
x:Key="PopupBlackLabel2"
BasedOn="{StaticResource BaseLabel}"
TargetType="Label">
<Setter Property="Foreground" Value="{DynamicResource TextForegroundDarkPrimary}" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource TextForegroundDarkSecondary}" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View File

@@ -4,4 +4,13 @@
<Setter Property="Margin" Value="3" />
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
<Style
x:Key="PopupBlackRadioButton"
BasedOn="{StaticResource BaseRadioButton}"
TargetType="RadioButton">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Padding" Value="2" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</ResourceDictionary>

View File

@@ -5,6 +5,7 @@
<Setter Property="Height" Value="23" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style

View File

@@ -10,27 +10,39 @@
x:Key="ai_promptbaustein_folder_itemtemplate"
DataType="{x:Type vm:AiPromptbausteinFolderVM}"
ItemsSource="{Binding Path=SubFolders.VMList}">
<Grid Background="Transparent">
<Grid Margin="0" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image
Name="img"
Width="16"
Height="16"
Margin="0,0,0,2"
Source="..\..\Ressources\Icons\Folder.png"
Stretch="Fill" />
<TextBox
Grid.Column="1"
Height="21"
Margin="0,0,0,0"
Padding="0,3,0,0"
Padding="0,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontSize="12"
FontWeight="{Binding FontWeight}"
IsReadOnly="True"
Text="{Binding Path=Displayname, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
@@ -48,6 +60,49 @@
</StackPanel>
</TextBox.ToolTip>
</TextBox>
<Border
x:Name="border1"
Grid.Column="3"
MinWidth="24"
Margin="0,0,3,0"
Padding="3"
VerticalAlignment="Stretch"
Background="#EEEDFE"
CornerRadius="7">
<TextBlock
Margin="1,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Text="{Binding TotalPromptCount, StringFormat={}{0}P}"
TextWrapping="Wrap" />
</Border>
<Border
x:Name="border2"
Grid.Column="4"
MinWidth="24"
Margin="0,0,3,0"
Padding="3"
VerticalAlignment="Stretch"
Background="#E1F5EE"
CornerRadius="7">
<TextBlock
Margin="1,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Text="{Binding TotalRoutineCount, StringFormat={}{0}R}"
TextWrapping="Wrap" />
</Border>
</Grid>
<HierarchicalDataTemplate.Triggers>
<DataTrigger Binding="{Binding TotalPromptCount}" Value="0">
<Setter TargetName="border1" Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding TotalRoutineCount}" Value="0">
<Setter TargetName="border2" Property="Visibility" Value="Collapsed" />
</DataTrigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
</ResourceDictionary>

View File

@@ -0,0 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<PathGeometry x:Key="GeometryFileAdd">M238.25 957.4166666666666C182.4166666666667 952.4583333333334 136.6666666666667 909.9583333333334 126.8333333333333 853.9166666666667C124.0833333333333 838.125 124.0833333333333 161.8750000000001 126.8333333333333 146.0833333333334C135.8333333333333 94.6666666666666 174 55.1666666666667 225.4166666666667 44.0833333333334C235 42 252.125 41.875 500 41.875C747.875 41.875 764.9999999999999 42 774.5833333333333 44.0833333333334C826 55.1666666666667 864.1666666666665 94.6666666666666 873.1666666666666 146.0833333333334C876 162.25 875.9166666666665 673.1666666666667 873.0833333333333 689.4583333333333C868.9166666666666 713.3333333333334 858.7083333333334 736.2916666666667 844.125 754.625C839.875 760 799.6666666666666 801 754.75 845.7083333333334C670.1666666666666 930 666.5 933.3333333333334 646.4166666666666 943.2083333333334C630.0833333333333 951.25 616.7083333333333 955.2083333333334 598.125 957.4166666666666C584.9166666666666 958.9583333333334 256 959 238.25 957.4166666666666M541.5 784.0416666666667L541.875 693.125L545.375 682.875C552.3333333333333 662.2916666666667 569 643.0416666666667 588.0416666666666 633.6666666666667C605.625 625 605.1666666666666 625.0416666666667 703.4583333333333 625.0416666666667L791.2499999999999 625L791.2499999999999 391.9166666666668C791.2499999999999 159.875 791.2499999999999 158.8333333333335 788.6666666666666 152C785.2916666666666 142.9166666666668 776.6666666666666 133.5000000000001 767.7499999999999 129.1250000000001L760.6249999999999 125.6250000000001L500 125.6250000000001L239.375 125.6250000000001L232.25 129.1250000000001C223.3333333333334 133.5000000000001 214.7083333333333 142.9166666666668 211.3333333333333 152C208.75 158.8333333333335 208.75 158.9166666666668 208.75 500C208.75 839.9583333333334 208.75 841.1666666666667 211.2916666666667 847.9583333333334C215.9166666666667 860.375 228.25 871.2916666666667 240.1666666666667 873.6666666666666C243.1666666666667 874.25 312.125 874.7916666666666 393.375 874.875L541.125 875L541.5 784.0416666666667M700 783.125L774.375 708.75L699.6666666666667 708.75L625 708.75L625 783.125C625 824.0416666666667 625.125 857.5 625.3333333333333 857.5C625.5 857.5 659.0833333333333 824.0416666666667 700 783.125M488.75 540.1666666666667C477.7499999999999 536.5416666666667 467.5833333333333 527.9166666666667 462.3749999999999 517.75C459.375 511.8750000000001 459.375 511.7500000000001 459 464.125L458.6249999999999 416.375L410.875 416L363.125 415.625L356.875 412.3333333333334C349.0416666666667 408.1666666666667 341.2916666666667 400.4166666666667 337.375 392.75C334.8333333333333 387.75 334.375 385.0833333333334 334.375 375C334.375 364.9166666666667 334.8333333333333 362.2500000000001 337.4166666666667 357.2083333333334C341.25 349.625 349.625 341.25 357.2083333333333 337.4166666666668C363.125 334.375 363.1666666666667 334.375 410.875 334L458.6249999999999 333.625L459 285.8750000000001C459.375 238.1666666666668 459.375 238.125 462.4166666666667 232.2083333333334C466.2499999999999 224.625 474.625 216.2500000000001 482.2083333333333 212.4166666666666C487.25 209.8333333333335 489.9166666666666 209.375 500 209.375C510.0833333333333 209.375 512.7499999999999 209.8333333333335 517.7916666666666 212.4166666666666C525.375 216.2500000000001 533.75 224.625 537.5833333333333 232.2083333333334C540.625 238.125 540.625 238.1666666666668 541 285.8750000000001L541.375 333.625L589.1249999999999 334C636.8333333333334 334.375 636.875 334.375 642.7916666666666 337.4166666666668C650.375 341.25 658.75 349.625 662.5833333333333 357.2083333333334C665.1666666666666 362.2500000000001 665.625 364.9166666666667 665.625 375C665.625 385.0833333333334 665.1666666666666 387.75 662.625 392.75C658.7083333333333 400.4166666666667 650.9583333333333 408.1666666666667 643.125 412.3333333333334L636.875 415.625L589.1249999999999 416L541.375 416.375L541 464.125C540.625 511.7500000000001 540.625 511.8750000000001 537.625 517.75C533.6666666666666 525.4583333333334 525.9166666666666 533.2083333333334 518.125 537.2083333333334C513.25 539.7083333333333 509.6666666666666 540.5 501.8749999999999 540.7916666666667C496.375 541 490.4583333333333 540.7083333333334 488.75 540.1666666666667</PathGeometry>
<PathGeometry x:Key="GeometryFileAdd2">M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-40-64a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V160H104a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,152Z</PathGeometry>
<PathGeometry x:Key="Lucide.ChevronDown">M488.75 665.1666666666667C477.6249999999999 661.5 472.9166666666666 657.0416666666667 344.9166666666667 528.9583333333334C242.4166666666667 426.3333333333334 214.8333333333333 398.0833333333334 212.4166666666667 393.125C209.8333333333333 387.8333333333334 209.375 385.0416666666668 209.375 375C209.375 361.0833333333334 211.8333333333333 354.9166666666668 220.875 345.875C229.9166666666667 336.8333333333334 236.0833333333334 334.375 250 334.375C260.0833333333333 334.375 262.8333333333333 334.8333333333334 268.125 337.4583333333334C273.0416666666667 339.8333333333334 298.5 364.5833333333334 387.2083333333333 453.0416666666666L500 565.5833333333334L612.7916666666666 453.0416666666666C701.4999999999999 364.5833333333334 726.9583333333333 339.8333333333334 731.875 337.4583333333334C737.1666666666666 334.8333333333334 739.9166666666666 334.375 750 334.375C763.9166666666666 334.375 770.0833333333333 336.8333333333334 779.125 345.875C788.1666666666666 354.9166666666668 790.625 361.0833333333334 790.625 375C790.625 385.0416666666668 790.1666666666665 387.8333333333334 787.5833333333334 393.125C785.1666666666666 398.0833333333334 757.5833333333333 426.3333333333334 655.0833333333333 528.9583333333334C510.9583333333333 673.2083333333334 520 665.125 501.8749999999999 665.7916666666666C496.375 666 490.4583333333333 665.7083333333334 488.75 665.1666666666667</PathGeometry>
<PathGeometry x:Key="Lucide.ChevronUp">M238.75 665.1666666666667C227.75 661.5416666666667 217.5833333333334 652.9166666666667 212.375 642.75C209.8333333333333 637.75 209.375 635.0833333333334 209.375 625C209.375 614.9583333333334 209.8333333333333 612.1666666666667 212.4166666666667 606.875C216.9166666666667 597.7083333333334 472.7083333333333 341.9166666666667 481.8749999999999 337.4166666666668C487.1666666666666 334.8333333333334 489.9583333333333 334.375 500 334.375C510.0416666666666 334.375 512.8333333333333 334.8333333333334 518.125 337.4166666666668C527.2916666666666 341.9166666666667 783.0833333333333 597.7083333333334 787.5833333333334 606.875C790.1666666666665 612.1666666666667 790.625 614.9583333333334 790.625 625C790.625 635.0833333333334 790.1666666666665 637.75 787.6249999999999 642.75C783.7083333333334 650.4166666666667 775.9583333333334 658.1666666666667 768.1249999999999 662.2916666666667C762.625 665.2083333333334 760.4166666666666 665.625 750 665.625C739.375 665.625 737.3749999999999 665.25 731.25 662.0416666666667C725.7083333333334 659.1666666666667 702.6666666666666 636.7916666666667 612.1666666666666 546.4583333333334L500 434.4166666666668L387.7916666666667 546.4583333333334C262.75 671.3333333333334 269.8333333333333 665.125 251.875 665.7916666666666C246.375 666 240.4583333333333 665.7083333333334 238.75 665.1666666666667</PathGeometry>
</ResourceDictionary>

View File

@@ -148,7 +148,29 @@
<!-- Assistent Message Control -->
<DataTemplate x:Key="AssistentMessageTemplate">
<Grid Margin="0,0,30,0" HorizontalAlignment="Left">
<Grid
Margin="0,0,60,0"
HorizontalAlignment="Left"
ContextMenuService.IsEnabled="{Binding DataContext.AssistentCommands, Converter={StaticResource CollectionCountToBoolConverter}, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=ItemsControl}}">
<Grid.ContextMenu>
<ContextMenu ItemsSource="{Binding PlacementTarget.Tag.AssistentCommands, RelativeSource={RelativeSource Self}}">
<ContextMenu.ItemContainerStyle>
<Style TargetType="MenuItem">
<Setter Property="Command" Value="{Binding Command}" />
<Setter Property="CommandParameter" Value="{Binding Path=PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
</Style>
</ContextMenu.ItemContainerStyle>
<ContextMenu.ItemTemplate>
<DataTemplate>
<TextBlock
Margin="3"
VerticalAlignment="Center"
Text="{Binding Name}" />
</DataTemplate>
</ContextMenu.ItemTemplate>
</ContextMenu>
</Grid.ContextMenu>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
@@ -174,7 +196,7 @@
BorderBrush="Black"
BorderThickness="0"
CornerRadius="0, 10, 10, 10">
<Grid Margin="4,0,0,4">
<Grid Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
@@ -183,10 +205,11 @@
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<!--<Border BorderThickness="1" Grid.ColumnSpan="2" Grid.RowSpan="2" BorderBrush="Black"></Border>-->
<TextBlock
Grid.Row="0"
Grid.ColumnSpan="2"
Margin="0,4,0,4"
Margin="0,0,0,4"
Padding="0"
VerticalAlignment="Center"
FontSize="12"
@@ -195,7 +218,7 @@
Style="{StaticResource TextBlockStyle}"
Text="{Binding DurationSec, StringFormat=Nachgedacht für {0} Sekunden}">
<TextBlock.ToolTip>
<Grid Margin="4,0,0,4">
<Grid Margin="0,4,0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
@@ -238,8 +261,8 @@
Grid.ColumnSpan="2"
Margin="0,4,0,0"
Padding="-3"
VerticalAlignment="Center"
Style="{StaticResource MessageTextBoxStyle}" />
</Grid>
</Border>
</Grid>
@@ -249,7 +272,7 @@
<DataTemplate x:Key="SystemMessageTemplate">
<Border
Width="auto"
Margin="30,0,30,0"
Margin="60,0,60,0"
HorizontalAlignment="Center"
Background="#DEFFFFFF"
BorderBrush="Black"
@@ -280,7 +303,7 @@
<DataTemplate x:Key="UserMessageTemplate">
<Border
Width="auto"
Margin="30,0,0,0"
Margin="60,0,0,0"
HorizontalAlignment="Right"
Background="#DEFFFFFF"
BorderBrush="Black"

View File

@@ -23,6 +23,8 @@
<ResourceDictionary Source="Designs\AI\Icon_Refresh_Weiss.xaml" />
<ResourceDictionary Source="Designs\AI\Icon_Refresh_Weiss+Orange.xaml" />
<ResourceDictionary Source="Designs\GeometryCollection.xaml" />
<ResourceDictionary Source="Colors\Colors.xaml" />
<ResourceDictionary Source="DataTemplates\ControlTemplates.xaml" />

View File

@@ -37,7 +37,10 @@
<Separator Tag="Vorlage" />
<MenuItem Header="Neues Dokument aus Vorlage erstellen" Tag="Vorlage">
<MenuItem.Icon>
<Image Source="..\Ressources\Icons\DocumentWithAdd2.png" Width="24" Height="24" />
<Image
Width="24"
Height="24"
Source="..\Ressources\Icons\DocumentWithAdd2.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
@@ -54,7 +57,6 @@
Height="20"
Source="..\Ressources\Icons\Folder.png"
Stretch="Fill" />
<TextBox
Padding="2,1"
Background="Transparent"
@@ -184,26 +186,57 @@
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn FieldName="InsertedOn" AllowEditing="False" Header="hinterlegt am" Width="150" SortOrder="Ascending"/>
<dxg:GridColumn FieldName="InsertedBy" AllowEditing="False" Header="hinterlegt von" Width="150" />
<dxg:GridColumn FieldName="FileName" AllowEditing="False" Header="Dateiname" Width="180" />
<dxg:GridColumn FieldName="Description" AllowEditing="False" Header="Beschreibung" Width="180" />
<dxg:GridColumn FieldName="URL" Header="" Width="100" MinWidth="90" x:Name="ColumnDownload">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<TextBlock>
<Hyperlink TargetName="inexistent" NavigateUri="{Binding Path=Value, Converter={StaticResource DownloadURLConverter}}" RequestNavigate="Hyperlink_OnRequestNavigate">
<TextBlock Text="herunterladen" />
</Hyperlink>
</TextBlock>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView AutoWidth="false" ShowGroupPanel="False" ShowGroupedColumns="false" ShowTotalSummary="False" NavigationStyle="Cell" x:Name="DocumentTableView" />
</dxg:GridControl.View>
</dxg:GridControl>
<dxg:GridColumn
Width="150"
AllowEditing="False"
FieldName="InsertedOn"
Header="hinterlegt am"
SortOrder="Ascending" />
<dxg:GridColumn
Width="150"
AllowEditing="False"
FieldName="InsertedBy"
Header="hinterlegt von" />
<dxg:GridColumn
Width="180"
AllowEditing="False"
FieldName="FileName"
Header="Dateiname" />
<dxg:GridColumn
Width="180"
AllowEditing="False"
FieldName="Description"
Header="Beschreibung" />
<dxg:GridColumn
x:Name="ColumnDownload"
Width="100"
MinWidth="90"
FieldName="URL"
Header="">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<TextBlock>
<Hyperlink
NavigateUri="{Binding Path=Value, Converter={StaticResource DownloadURLConverter}}"
RequestNavigate="Hyperlink_OnRequestNavigate"
TargetName="inexistent">
<TextBlock Text="herunterladen" />
</Hyperlink>
</TextBlock>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView
x:Name="DocumentTableView"
AutoWidth="false"
NavigationStyle="Cell"
ShowGroupPanel="False"
ShowGroupedColumns="false"
ShowTotalSummary="False" />
</dxg:GridControl.View>
</dxg:GridControl>
</Grid>
<Canvas>

View File

@@ -0,0 +1,110 @@
<UserControl
x:Class="BeWo.View.Controls.AI.AiChatButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ai="clr-namespace:BeWo.ViewModel.Controls.AI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:draw="clr-namespace:System.Drawing;assembly=System.Drawing"
xmlns:i="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:local="clr-namespace:BeWo.View.Controls.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DataContext="{d:DesignInstance Type=ai:AiChatButtonWithHistoryViewModel}"
Loaded="UserControl_Loaded"
Visibility="{Binding IsEnabled, Converter={StaticResource BoolVisibilityConverter}}"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource PrimaryButton}" TargetType="{x:Type Button}" />
</ResourceDictionary>
</UserControl.Resources>
<Grid Visibility="{Binding IsVisible, Converter={StaticResource BoolVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Button
x:Name="btnOpenAiConversation"
Grid.Column="0"
Margin="0,0,6,0"
Background="Transparent"
Command="{Binding OpenConversationPopupCommand}"
Content="{StaticResource AiDesignsIconKIChatWeissOrange}"
ToolTip="KI Chat öffnen"
ToolTipService.ShowOnDisabled="True">
<!--<Button.InputBindings>
<MouseBinding Command="{Binding OpenConversationPopupCommand}" Gesture="LeftClick" />
</Button.InputBindings>-->
</Button>
<Button
x:Name="btnOpenAiPromptbaustein"
Grid.Column="1"
Margin="6,0"
Background="Transparent"
Command="{Binding OpenAllPromptsPopupCommand}"
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp"
ToolTip="KI Chat mit Prompt-Baustein starten"
ToolTipService.ShowOnDisabled="True">
<!--<Button.InputBindings>
<MouseBinding Command="{Binding OpenAllPromptsPopupCommand}" Gesture="LeftClick" />
</Button.InputBindings>-->
</Button>
<Image
x:Name="imgWarning"
Grid.Column="2"
Height="20"
Margin="6,0"
Source="{Binding Source={x:Static draw:SystemIcons.Warning}, Converter={StaticResource IconToImageSourceConverter}, Mode=OneWay}"
Visibility="{Binding IsContextSizeTooBig, Converter={StaticResource BoolVisibilityConverter}}">
<!-- Visibility="{Binding ElementName=btnOpenAi4, Path=Visibility}" -->
<Image.ToolTip>
Die aktuelle Ansicht beinhaltet zu viele Daten.
Es können keine neuen Chats zu dieser Ansicht erstellt werden.
</Image.ToolTip>
</Image>
<StackPanel
x:Name="stackpanelUndoRedo"
Grid.Column="3"
Margin="6,0,0,0"
Orientation="Horizontal"
Visibility="{Binding IsHistoryVisible, Converter={StaticResource BoolVisibilityConverter}}">
<Button
x:Name="btn_AiPromptbausteinUndo"
Margin="0"
Command="{Binding UndoAiActionCommand}"
IsEnabled="{Binding IsUndoButtonVisible}"
Style="{StaticResource ButtonPreviousStyle2}" />
<Button
x:Name="btn_AiPromptbausteinRedo"
Margin="3,0,0,0"
Command="{Binding RedoAiActionCommand}"
IsEnabled="{Binding IsRedoButtonVisible}"
Style="{StaticResource ButtonRedoStyle2}" />
</StackPanel>
<!--<Popup
x:Name="popup_promptbaustein_all"
Width="600"
Height="400"
Placement="Top"
PlacementTarget="{Binding ElementName=btnOpenAi5}"
StaysOpen="False">
<Border x:Name="border_promptbaustein_al" BorderThickness="1" />
</Popup>-->
<Popup
x:Name="popup_promptbaustein_favoriten"
Width="400"
Height="200"
IsOpen="{Binding IsFavoritenOpen}"
Placement="Top"
PlacementTarget="{Binding ElementName=btnOpenAi5}"
StaysOpen="False">
<Border x:Name="border_promptbaustein_favoriten" BorderThickness="1" />
</Popup>
</Grid>
</UserControl>

View File

@@ -0,0 +1,126 @@
using BeWo.ServiceProxy;
using BeWo.View.Detail.AI;
using BeWo.ViewModel;
using BeWo.ViewModel.Controls.AI;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BeWo.View.Controls.AI
{
public enum AiChatButtonOrientation
{
Right, Left
}
/// <summary>
/// Interaktionslogik für AiGenericConversationButton.xaml
/// </summary>
public partial class AiChatButton : UserControl
{
public AiChatButtonOrientation AiChatButtonOrientation
{
get { return (AiChatButtonOrientation)GetValue(AiChatButtonOrientationProperty); }
set { SetValue(AiChatButtonOrientationProperty, value); }
}
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty AiChatButtonOrientationProperty =
DependencyProperty.Register("AiChatButtonOrientation", typeof(AiChatButtonOrientation), typeof(AiChatButton), new PropertyMetadata(AiChatButtonOrientation.Left, OnOrientationChanged));
static void OnOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (AiChatButton)d;
control.UpdateOrientation((AiChatButtonOrientation)e.NewValue);
}
public AiChatButtonViewModel ViewModel => DataContext as AiChatButtonViewModel;
public AiChatButton()
{
InitializeComponent();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
ViewModel?.ReloadData(true, InitPromptbausteine);
}
private void InitPromptbausteine(AiActionType actionType, List<AiPromptbausteinFolderDC> folders)
{
VMFactory.CreateAiPromptbausteinFolderListVM(folders, (listvm) =>
{
var viewmodel = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm);
viewmodel.ItemAccepted += ItemAccepted;
viewmodel.RequestCloseFinal += (s, e) => viewmodel.ResetSelection();
ViewModel.AllPromptsViewModel = viewmodel;
var viewmodel2 = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm, true);
viewmodel2.ItemAccepted += ItemAccepted;
popup_promptbaustein_favoriten.Closed += (s, e) => viewmodel2.ResetSelection();
var view2 = new AiPromptbausteinComplexSelectionFavoritenView(viewmodel2);
viewmodel2.SelectedFolder = viewmodel2.Folders.VMList[0];
view2.Padding = new Thickness(3);
view2.Background = FindResource("ObjectEditBackgroundBrush") as System.Windows.Media.Brush;
border_promptbaustein_favoriten.Child = view2;
viewmodel.VMListReloaded += (s, e) => viewmodel2.ReloadVMList(false);
});
}
private void ItemAccepted(object sender, AbstractBaseVM e)
{
ViewModel.ItemAccepted(e);
}
private void btnOpenAi5_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
ViewModel.OpenFavoritePromptsPopupCommand.Execute(null);
}
void UpdateOrientation(AiChatButtonOrientation orientation)
{
if(orientation == AiChatButtonOrientation.Left)
{
Grid.SetColumn(btnOpenAiConversation, 0);
Grid.SetColumn(btnOpenAiPromptbaustein, 1);
Grid.SetColumn(imgWarning, 2);
Grid.SetColumn(stackpanelUndoRedo, 3);
stackpanelUndoRedo.Margin = new Thickness(6, 0, 0, 0);
btnOpenAiConversation.Margin = new Thickness(0, 0, 6, 0);
btnOpenAiPromptbaustein.Margin = new Thickness(6, 0, 6, 0);
}
else if(orientation == AiChatButtonOrientation.Right)
{
Grid.SetColumn(stackpanelUndoRedo, 0);
Grid.SetColumn(imgWarning, 1);
Grid.SetColumn(btnOpenAiConversation, 2);
Grid.SetColumn(btnOpenAiPromptbaustein, 3);
stackpanelUndoRedo.Margin = new Thickness(0, 0, 6, 0);
btnOpenAiConversation.Margin = new Thickness(6, 0, 6, 0);
btnOpenAiPromptbaustein.Margin = new Thickness(6, 0, 0, 0);
}
else
{
throw BeWoNotImplementedException.CreateFromEnum(orientation);
}
}
}
}

View File

@@ -1,81 +0,0 @@
<UserControl
x:Class="BeWo.View.Controls.AI.AiConversationButton"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:draw="clr-namespace:System.Drawing;assembly=System.Drawing"
xmlns:local="clr-namespace:BeWo.View.Controls.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="root"
mc:Ignorable="d">
<Grid>
<StackPanel
Margin="0"
VerticalAlignment="Center"
Orientation="Horizontal">
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</StackPanel.Resources>
<Button
x:Name="btnOpenAi4"
Height="30"
Margin="0"
Background="Transparent"
Click="btnOpenAi4_Click"
Content="{StaticResource AiDesignsIconKIChatWeissOrange}"
Style="{StaticResource NavigationToolbarButtonStyle}"
ToolTip="KI Chat öffnen"
ToolTipService.ShowOnDisabled="True" />
<Button
x:Name="btnOpenAi5"
Height="30"
Margin="10,0,0,0"
Background="Transparent"
Click="btnOpenAi5_Click"
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp"
Style="{StaticResource NavigationToolbarButtonStyle}"
ToolTip="KI Chat mit Prompt-Baustein starten"
ToolTipService.ShowOnDisabled="True">
<!--<Button.InputBindings>
<MouseBinding Command="{Binding AiPromptOpenFavoriteCommand, ElementName=root}" Gesture="RightClick" />
<MouseBinding Command="{Binding AiPromptOpenAllCommand, ElementName=root}" Gesture="LeftClick" />
</Button.InputBindings>-->
</Button>
<Image
x:Name="imgWarning"
Height="20"
Margin="10,0,0,0"
Source="{Binding Source={x:Static draw:SystemIcons.Warning}, Converter={StaticResource IconToImageSourceConverter}, Mode=OneWay}"
Visibility="Visible">
<!-- Visibility="{Binding ElementName=btnOpenAi4, Path=Visibility}" -->
<Image.ToolTip>
Die aktuelle Ansicht beinhaltet zu viele Daten.
Es können keine neuen Chats zu dieser Ansicht erstellt werden.
</Image.ToolTip>
</Image>
</StackPanel>
<!--<Popup
x:Name="popup_promptbaustein_all"
Width="600"
Height="400"
Placement="Top"
PlacementTarget="{Binding ElementName=btnOpenAi5}"
StaysOpen="False">
<Border x:Name="border_promptbaustein_al" BorderThickness="1" />
</Popup>-->
<Popup
x:Name="popup_promptbaustein_favoriten"
Placement="Top"
PlacementTarget="{Binding ElementName=btnOpenAi5}"
StaysOpen="False">
<Border x:Name="border_promptbaustein_favoriten" BorderThickness="1" />
</Popup>
</Grid>
</UserControl>

View File

@@ -1,199 +0,0 @@
using BeWo.ServiceProxy;
using BeWo.View.Detail.AI;
using BeWo.ViewModel;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.DataContracts.Feature.AI;
using DevExpress.Mvvm;
using DevExpress.Pdf.Native.BouncyCastle.Asn1.BC;
using DevExpress.Web.Internal.XmlProcessor;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BeWo.View.Controls.AI
{
public enum AiConversationButtonState
{
Hidden,
Normal,
Loading,
Warning,
Disabled
}
/// <summary>
/// Interaktionslogik für AIConversationButton.xaml
/// </summary>
public partial class AiConversationButton : UserControl
{
public static readonly DependencyProperty StateProperty =
DependencyProperty.Register("State", typeof(AiConversationButtonState), typeof(AiConversationButton), new PropertyMetadata(AiConversationButtonState.Normal, OnStateChanged));
public static readonly DependencyProperty ActionTypeProperty =
DependencyProperty.Register("ActionType", typeof(AiActionType), typeof(AiConversationButton), new PropertyMetadata(AiActionType.ServiceRecord, OnActionTypeChanged));
public event RoutedEventHandler OpenAiWindowClick;
public event EventHandler<AiPromptbausteinPromptVM> PromptAccepted;
public AiConversationButton()
{
InitializeComponent();
UpdateState();
}
public AiConversationButtonState State
{
get { return (AiConversationButtonState)GetValue(StateProperty); }
set { SetValue(StateProperty, value); }
}
public AiActionType ActionType
{
get { return (AiActionType)GetValue(ActionTypeProperty); }
set { SetValue(ActionTypeProperty, value); }
}
public AiPromptbausteinSelectionComplexViewModel AllPromptsViewModel { get; set; }
public ICommand AiPromptOpenAllCommand { get; set; }
public ICommand AiPromptOpenFavoriteCommand { get; set; }
public string Tooltip { get; set; }
public bool IsButtonEnabled { get; set; }
public bool IsButton2Enabled { get; set; }
public bool IsButtonVisible { get; set; }
public bool IsButton2Visible { get; set; }
public bool IsWarningSignVisible { get; set; }
public void AiPromptOpenAll()
{
//popup_promptbaustein_all.IsOpen = true;
//OpenAiPromptClick?.Invoke(this, e);
BeWoApp.MainControl.WindowService.Show(AllPromptsViewModel);
}
public void AiPromptOpenFavorite()
{
popup_promptbaustein_favoriten.IsOpen = true;
}
private void UpdateState()
{
switch (State)
{
case AiConversationButtonState.Hidden:
Tooltip = string.Empty;
IsButtonEnabled = false;
IsButton2Enabled = false;
IsButtonVisible = false;
IsButton2Visible = false;
IsWarningSignVisible = false;
break;
case AiConversationButtonState.Normal:
Tooltip = string.Empty;
IsButtonEnabled = true;
IsButton2Enabled = true;
IsButtonVisible = true;
IsButton2Visible = true;
IsWarningSignVisible = false;
break;
case AiConversationButtonState.Loading:
Tooltip = "Lädt";
IsButtonEnabled = false;
IsButton2Enabled = false;
IsButtonVisible = true;
IsButton2Visible = true;
IsWarningSignVisible = false;
break;
case AiConversationButtonState.Warning:
Tooltip = string.Empty;
IsButtonEnabled = true;
IsButton2Enabled = false;
IsButtonVisible = true;
IsButton2Visible = false;
IsWarningSignVisible = true;
break;
case AiConversationButtonState.Disabled:
Tooltip = string.Empty;
IsButtonEnabled = false;
IsButton2Enabled = false;
IsButtonVisible = true;
IsButton2Visible = true;
IsWarningSignVisible = false;
break;
}
btnOpenAi5.ToolTip = btnOpenAi4.ToolTip = ToolTip;
btnOpenAi4.IsEnabled = IsButtonEnabled;
btnOpenAi5.IsEnabled = IsButton2Enabled;
btnOpenAi4.Visibility = IsButtonVisible ? Visibility.Visible : Visibility.Collapsed;
btnOpenAi5.Visibility = IsButton2Visible ? Visibility.Visible : Visibility.Collapsed;
imgWarning.Visibility = IsWarningSignVisible ? Visibility.Visible : Visibility.Collapsed;
}
private static void OnActionTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (AiConversationButton)d;
var actionType = (AiActionType)e.NewValue;
if (BeWoApp.AppSettings.ShowAI && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineView))
{
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteinFolder(actionType), folders => control.InitPromptbausteine(actionType, folders));
}
}
private static void OnStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (AiConversationButton)d;
control.UpdateState();
}
private void btnOpenAi4_Click(object sender, RoutedEventArgs e)
{
OpenAiWindowClick?.Invoke(this, e);
}
private void btnOpenAi5_Click(object sender, RoutedEventArgs e)
{
AiPromptOpenAll();
}
private void btnOpenAi5_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
AiPromptOpenFavorite();
}
private void InitPromptbausteine(AiActionType actionType, List<AiPromptbausteinFolderDC> folders)
{
VMFactory.CreateAiPromptbausteinFolderListVM(folders, (listvm) =>
{
var viewmodel = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm);
viewmodel.PromptAccepted += PromptAccepted;
viewmodel.RequestClose += (s, e) => viewmodel.ResetSelection();
AllPromptsViewModel = viewmodel;
var viewmodel2 = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm, true);
viewmodel2.PromptAccepted += PromptAccepted;
popup_promptbaustein_favoriten.Closed += (s, e) => viewmodel2.ResetSelection();
var view2 = new AiPromptbausteinComplexSelectionFavoritenView(viewmodel2);
viewmodel2.SelectedFolder = viewmodel2.Folders.VMList[0];
view2.Padding = new Thickness(3);
view2.Background = FindResource("ObjectEditBackgroundBrush") as System.Windows.Media.Brush;
border_promptbaustein_favoriten.Child = view2;
viewmodel.VMListReloaded += (s, e) => viewmodel2.ReloadVMList(false);
AiPromptOpenAllCommand = new DelegateCommand(AiPromptOpenAll);
AiPromptOpenFavoriteCommand = new DelegateCommand(AiPromptOpenFavorite);
});
}
}
}

View File

@@ -1,56 +0,0 @@
<UserControl
x:Class="BeWo.View.Controls.AI.AiPromptbausteinButton"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:draw="clr-namespace:System.Drawing;assembly=System.Drawing"
xmlns:local="clr-namespace:BeWo.View.Controls.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="root"
mc:Ignorable="d">
<Grid>
<StackPanel
Margin="0"
VerticalAlignment="Center"
Orientation="Horizontal">
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</StackPanel.Resources>
<Button
x:Name="btnOpenAi5"
Margin="0"
Click="btnOpenAi5_Click"
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp"
Style="{StaticResource PrimaryButton}"
ToolTip="KI Chat mit Prompt-Baustein starten"
ToolTipService.ShowOnDisabled="True">
<!--<Button.InputBindings>
<MouseBinding Command="{Binding AiPromptOpenFavoriteCommand, ElementName=root}" Gesture="RightClick" />
<MouseBinding Command="{Binding AiPromptOpenAllCommand, ElementName=root}" Gesture="LeftClick" />
</Button.InputBindings>-->
</Button>
</StackPanel>
<!--<Popup
x:Name="popup_promptbaustein_all"
Width="600"
Height="400"
Placement="Top"
PlacementTarget="{Binding ElementName=btnOpenAi5}"
StaysOpen="False">
<Border x:Name="border_promptbaustein_al" BorderThickness="1" />
</Popup>-->
<Popup
x:Name="popup_promptbaustein_favoriten"
Placement="Top"
PlacementTarget="{Binding ElementName=btnOpenAi5}"
StaysOpen="False">
<Border x:Name="border_promptbaustein_favoriten" BorderThickness="1" />
</Popup>
</Grid>
</UserControl>

View File

@@ -1,191 +0,0 @@
using BeWo.ServiceProxy;
using BeWo.View.Detail.AI;
using BeWo.ViewModel;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.DataContracts.Feature.AI;
using DevExpress.Mvvm;
using DevExpress.Utils.Mdi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BeWo.View.Controls.AI
{
public enum AiPromptbausteinButtonState
{
Hidden,
Normal,
Loading,
Disabled
}
/// <summary>
/// Interaktionslogik für AiPromptbausteinButton.xaml
/// </summary>
public partial class AiPromptbausteinButton : UserControl
{
public static readonly DependencyProperty CanExecuteProperty =
DependencyProperty.Register("CanExecute", typeof(bool), typeof(AiPromptbausteinButton), new PropertyMetadata(false, OnCanExecuteChanged));
public static readonly DependencyProperty StateProperty =
DependencyProperty.Register("State", typeof(AiPromptbausteinButtonState), typeof(AiPromptbausteinButton), new PropertyMetadata(AiPromptbausteinButtonState.Normal, OnStateChanged));
public static readonly DependencyProperty ActionTypeProperty =
DependencyProperty.Register("ActionType", typeof(AiActionType), typeof(AiPromptbausteinButton), new PropertyMetadata(AiActionType.ServiceRecord, OnActionTypeChanged));
public event EventHandler<AiPromptbausteinPromptVM> PromptAccepted;
public AiPromptbausteinSelectionComplexViewModel AllPromptsViewModel { get; set; }
public AiPromptbausteinButton()
{
InitializeComponent();
}
public AiPromptbausteinButtonState State
{
get { return (AiPromptbausteinButtonState)GetValue(StateProperty); }
set { SetValue(StateProperty, value); }
}
public AiActionType ActionType
{
get { return (AiActionType)GetValue(ActionTypeProperty); }
set { SetValue(ActionTypeProperty, value); }
}
public bool CanExecute
{
get { return (bool)GetValue(CanExecuteProperty); }
set { SetValue(CanExecuteProperty, value); }
}
private static void OnStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (AiPromptbausteinButton)d;
var state = (AiPromptbausteinButtonState)e.NewValue;
control.UpdateState(state);
}
private static void OnActionTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (AiPromptbausteinButton)d;
var actionType = (AiActionType)e.NewValue;
control.UpdateActionType(actionType);
}
private static void OnCanExecuteChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (AiPromptbausteinButton)d;
var canExecute = (bool)e.NewValue;
control.UpdateCanExecute(canExecute);
}
public void AiPromptOpenAll()
{
BeWoApp.MainControl.WindowService.Show(AllPromptsViewModel);
}
public void AiPromptOpenFavorite()
{
popup_promptbaustein_favoriten.IsOpen = true;
}
private void btnOpenAi5_Click(object sender, RoutedEventArgs e)
{
AiPromptOpenAll();
}
private void btnOpenAi5_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
AiPromptOpenFavorite();
}
private void InitPromptbausteine(AiActionType actionType, List<AiPromptbausteinFolderDC> folders)
{
VMFactory.CreateAiPromptbausteinFolderListVM(folders, (listvm) =>
{
var viewmodel = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm);
viewmodel.PromptAccepted += PromptAccepted;
viewmodel.RequestClose += (s, e) => viewmodel.ResetSelection();
AllPromptsViewModel = viewmodel;
var viewmodel2 = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm, true);
viewmodel2.PromptAccepted += PromptAccepted;
popup_promptbaustein_favoriten.Closed += (s, e) => viewmodel2.ResetSelection();
var view2 = new AiPromptbausteinComplexSelectionFavoritenView(viewmodel2);
viewmodel2.SelectedFolder = viewmodel2.Folders.VMList[0];
view2.Padding = new Thickness(3);
view2.Background = FindResource("ObjectEditBackgroundBrush") as System.Windows.Media.Brush;
border_promptbaustein_favoriten.Child = view2;
State = AiPromptbausteinButtonState.Normal;
viewmodel.VMListReloaded += (s, e) => viewmodel2.ReloadVMList(false);
});
}
private void UpdateState(AiPromptbausteinButtonState state)
{
if (state == AiPromptbausteinButtonState.Normal && !CanExecute)
{
State = AiPromptbausteinButtonState.Disabled;
return;
}
switch (state)
{
case AiPromptbausteinButtonState.Hidden:
root.Visibility = Visibility.Collapsed;
root.IsEnabled = true;
btnOpenAi5.IsEnabled = true;
break;
case AiPromptbausteinButtonState.Normal:
root.Visibility = Visibility.Visible;
root.IsEnabled = true;
btnOpenAi5.IsEnabled = true;
break;
case AiPromptbausteinButtonState.Loading:
root.Visibility = Visibility.Visible;
root.IsEnabled = false;
btnOpenAi5.IsEnabled = false;
break;
case AiPromptbausteinButtonState.Disabled:
root.Visibility = Visibility.Visible;
root.IsEnabled = true;
btnOpenAi5.IsEnabled = false;
break;
default:
throw new NotImplementedException();
break;
}
}
private void UpdateActionType(AiActionType actionType)
{
ActionType = actionType;
if (!BeWoApp.AppSettings.ShowAI || !BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineView))
{
State = AiPromptbausteinButtonState.Hidden;
return;
}
State = AiPromptbausteinButtonState.Loading;
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteinFolder(actionType), folders => InitPromptbausteine(actionType, folders));
}
private void UpdateCanExecute(bool canExecute)
{
if (canExecute)
State = AiPromptbausteinButtonState.Normal;
else
State = AiPromptbausteinButtonState.Disabled;
}
}
}

View File

@@ -0,0 +1,858 @@
<UserControl
x:Class="BeWo.View.Controls.AI.AiPromptbausteinLibraryControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:administration="clr-namespace:BeWo.ViewModel.View.Administration"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:draw="clr-namespace:System.Drawing;assembly=System.Drawing"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:templateselectors="clr-namespace:BeWo.View.TemplateSelectors"
xmlns:vm="clr-namespace:BeWo.ViewModel"
x:Name="root"
d:DataContext="{d:DesignInstance Type=administration:AiPromptbausteinComplexTreeViewModel,
IsDesignTimeCreatable=True}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style
x:Key="PromptListBoxItem"
BasedOn="{StaticResource PhotoListBoxItem}"
TargetType="ListBoxItem" />
<DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}">
<Border
x:Name="border"
Background="#09000000"
BorderThickness="1"
CornerRadius="5"
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}">
<Border.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding PlacementTarget.Tag.OpenAddPromptDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Neuer Prompt">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding PlacementTarget.Tag.OpenEditPromptDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Bearbeiten">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding PlacementTarget.Tag.ChangeFavoritenStatePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="{Binding FavoritenHeader}">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding PlacementTarget.Tag.CopyPromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Kopieren">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding PlacementTarget.Tag.PastePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Einfügen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding PlacementTarget.Tag.DeletePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Löschen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</Border.ContextMenu>
<Grid
Margin="6"
Background="Transparent"
ContextMenuOpening="ListBox_ContextMenuOpening"
PreviewMouseDown="Grid_PreviewMouseDown_1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="6" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle
Grid.RowSpan="2"
Width="24"
Height="24"
Fill="White" />
<StackPanel Grid.Column="2" Orientation="Horizontal">
<TextBox
Height="21"
Margin="2,0,0,0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="True"
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
<TextBox
MaxWidth="500"
Padding="3,1,0,0"
VerticalAlignment="Center"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="Wrap" />
</StackPanel>
</TextBox.ToolTip>
</TextBox>
<TextBlock
x:Name="infobox"
Margin="0"
Padding="0">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding Path="IsSelected" RelativeSource="{RelativeSource AncestorType={x:Type ListBoxItem}}" />
<Binding Path="IsInfoVisible" />
</MultiBinding>
</TextBlock.Visibility>
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
(i)
</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel
Grid.Row="1"
Grid.Column="2"
Orientation="Horizontal">
<Border
x:Name="border1"
Width="46"
Margin="0,0,3,0"
Padding="3"
HorizontalAlignment="Left"
Background="#EEEDFE"
CornerRadius="7">
<TextBlock
Margin="1,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Text="Prompt"
TextWrapping="Wrap" />
</Border>
<!--<TextBlock
Margin="3,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10">
Bearbeitet vor x Minuten
</TextBlock>-->
</StackPanel>
</Grid>
</Border>
</DataTemplate>
<DataTemplate x:Key="AiPromptbausteinRoutineItemTemplate" DataType="vm:AiPromptbausteinRoutineVM">
<Border
x:Name="border"
Background="#09000000"
CornerRadius="5"
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}">
<Border.Style>
<Style TargetType="Border">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Transparent" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsValid}" Value="False">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="IsEnabled" Value="False" />
<Setter Property="IsHitTestVisible" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Border.InputBindings>
<KeyBinding Key="Delete" Command="{Binding PlacementTarget.Tag.DeleteRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
<KeyBinding Key="Enter" Command="{Binding PlacementTarget.Tag.OpenEditRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
<KeyBinding Key="F" Command="{Binding PlacementTarget.Tag.ChangeFavoritenStateRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
</Border.InputBindings>
<Border.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding PlacementTarget.Tag.OpenAddRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Neue Routine">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding PlacementTarget.Tag.OpenEditRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Bearbeiten">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem
x:Name="favorite2"
Command="{Binding PlacementTarget.Tag.ChangeFavoritenStateRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
Header="{Binding FavoritenHeader}">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding PlacementTarget.Tag.DeleteRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Löschen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</Border.ContextMenu>
<Grid
Margin="6"
Background="Transparent"
ContextMenuOpening="ListBox_ContextMenuOpening"
PreviewMouseDown="Grid_PreviewMouseDown_2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="9" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle
Grid.RowSpan="2"
Width="24"
Height="24"
Fill="White" />
<StackPanel Grid.Column="2" Orientation="Horizontal">
<TextBox
Height="21"
Margin="0,0,0,0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="True"
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
<TextBox
MaxWidth="500"
Padding="3,1,0,0"
VerticalAlignment="Center"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="Wrap" />
</StackPanel>
</TextBox.ToolTip>
</TextBox>
</StackPanel>
<StackPanel
Grid.Row="1"
Grid.Column="2"
Margin="0,-1,0,0"
Orientation="Horizontal">
<Border
x:Name="border1"
Width="46"
Margin="0,0,3,0"
Padding="3"
HorizontalAlignment="Left"
Background="#E1F5EE"
CornerRadius="7">
<TextBlock
Margin="1,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Text="Routine"
TextWrapping="Wrap" />
</Border>
<TextBlock
Margin="3,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} Schritte">
<Binding Path="Steps.Count" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
<ListBox
Grid.Row="2"
Grid.Column="2"
Margin="3,9,3,3"
AllowDrop="False"
Background="Transparent"
BorderThickness="0"
Focusable="False"
IsHitTestVisible="False"
ItemsSource="{Binding Steps.VMList}"
Visibility="{Binding Steps.VMList.Count, Converter={StaticResource CollectionCountToVisibilityConverter}}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock
x:Name="arrow"
Margin="3"
VerticalAlignment="Center"
Text="&#x2794;" />
<Border
x:Name="border1"
Height="19"
Margin="0"
Padding="3"
HorizontalAlignment="Left"
Background="DarkGray"
CornerRadius="7">
<TextBlock
Margin="3,0,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Text="{Binding PromptReference.Title, StringFormat={}✦ {0}}"
TextWrapping="Wrap" />
</Border>
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
<Setter TargetName="arrow" Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding IsValid}" Value="false">
<Setter TargetName="border1" Property="Background" Value="LightCoral" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
<StackPanel
Grid.Row="3"
Grid.Column="2"
Orientation="Horizontal"
Visibility="{Binding IsValid, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=reverse}">
<Image
x:Name="imgWarning"
Grid.Column="2"
Height="20"
Margin="6,0"
Source="{Binding Source={x:Static draw:SystemIcons.Warning}, Converter={StaticResource IconToImageSourceConverter}, Mode=OneWay}" />
<!-- Visibility="{Binding ElementName=btnOpenAi4, Path=Visibility}" -->
<Label Foreground="Red">
Ungültig
</Label>
</StackPanel>
</Grid>
</Border>
</DataTemplate>
<templateselectors:AiPromptbausteinFolderItemTemplateSelector
x:Key="AiPromptbausteinFolderItemTemplateSelector"
AiPromptbausteinPromptTemplate="{StaticResource AiPromptbausteinPromptItemTemplate}"
AiPromptbausteinRoutineTemplate="{StaticResource AiPromptbausteinRoutineItemTemplate}" />
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" MinWidth="200" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="3*" MinWidth="200" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GroupBox
Grid.Row="1"
Grid.Column="0"
Margin="0,7,0,0"
Padding="0"
HorizontalAlignment="Stretch"
Header="Bibliothek"
Style="{StaticResource ObjectEditGroupBox}">
<TreeView
x:Name="treeView"
MinHeight="100"
Padding="4,16,4,16"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowDrop="True"
BorderThickness="1,0,0,1"
ContextMenuOpening="treeView_ContextMenuOpening"
Focusable="True"
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}"
ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}"
PreviewMouseDown="Grid_PreviewMouseDown"
PreviewMouseRightButtonDown="OnPreviewMouseRightButtonDown"
SelectedItemChanged="treeView_SelectedItemChanged"
TreeViewItem.Selected="treeView_Selected">
<TreeView.Resources>
<Style x:Key="igoal_treeitemstyle" TargetType="TreeViewItem">
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
</Style>
</TreeView.Resources>
<TreeView.InputBindings>
<KeyBinding Key="Delete" Command="{Binding DeleteFolderCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenEditFolderDialogCommand}" />
<KeyBinding Key="N" Command="{Binding OpenAddFolderDialogCommand}" />
<!--<KeyBinding
Key="C"
Command="{Binding CopyFolderCommand}"
Modifiers="Ctrl" />
<KeyBinding
Key="V"
Command="{Binding PasteFolderCommand}"
Modifiers="Ctrl" />-->
</TreeView.InputBindings>
<TreeView.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem
Command="{Binding OpenAddFolderDialogCommand}"
Header="Neuer Ordner"
ToolTip="Shortcut: N">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem
Command="{Binding OpenEditFolderDialogCommand}"
Header="Bearbeiten"
ToolTip="Shortcut: Enter">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
</MenuItem.Icon>
</MenuItem>
<!--<Separator />
<MenuItem
Command="{Binding CopyFolderCommand}"
Header="Kopieren"
ToolTip="Shortcut: Strg+C">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem
Command="{Binding PasteFolderCommand}"
Header="Einfügen"
ToolTip="Shortcut: Strg+V">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
</MenuItem.Icon>
</MenuItem>-->
<Separator />
<MenuItem
Command="{Binding DeleteFolderCommand}"
Header="Löschen"
ToolTip="Shortcut: Entf">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TreeView.ContextMenu>
</TreeView>
</GroupBox>
<GridSplitter
Grid.Row="1"
Grid.Column="1"
Width="1"
HorizontalAlignment="Center"
Background="#878890" />
<Grid
Grid.Row="1"
Grid.Column="2"
Grid.ColumnSpan="2">
<Grid.Resources>
<Style TargetType="Grid">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=treeView, Path=SelectedItem}" Value="{x:Null}">
<Setter Property="Visibility" Value="Hidden" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<TabControl
x:Name="tabcontrol_1"
Padding="0"
BorderBrush="Gray"
BorderThickness="0,1,1,1"
SelectionChanged="TabControl_SelectionChanged">
<TabControl.Resources>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border
x:Name="Border"
Grid.Row="0"
Grid.Column="0"
MinHeight="20"
Padding="12,3,12,3"
Background="Transparent"
TextElement.FontFamily="Microsoft Sans Serif"
TextElement.FontSize="16"
TextElement.Foreground="{StaticResource TabItemHotTextBrush}">
<ContentPresenter
Height="18"
ContentSource="Header"
RecognizesAccessKey="True" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Panel.ZIndex" Value="100" />
<Setter TargetName="Border" Property="Background" Value="#22000000" />
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Background" Value="DarkRed" />
<Setter TargetName="Border" Property="BorderBrush" Value="Black" />
<Setter Property="Foreground" Value="DarkGray" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource {x:Type dxe:ListBoxEdit}}" TargetType="dxe:ListBoxEdit">
<Setter Property="Padding" Value="8,16" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="AllowDrop" Value="False" />
<Setter Property="ItemContainerStyle" Value="{StaticResource PromptListBoxItem}" />
<Setter Property="ItemTemplateSelector" Value="{StaticResource AiPromptbausteinFolderItemTemplateSelector}" />
<Setter Property="SelectedItem" Value="{Binding SelectedItem, Mode=TwoWay}" />
<Setter Property="SelectionMode" Value="Single" />
<Setter Property="ShowBorder" Value="False" />
<Setter Property="Focusable" Value="True" />
<Setter Property="IsTabStop" Value="True" />
<EventSetter Event="ContextMenuOpening" Handler="ListBox_ContextMenuOpening" />
<EventSetter Event="PreviewMouseDown" Handler="listBoxEdit3_PreviewMouseDown" />
</Style>
</TabControl.Resources>
<TabItem x:Name="tabItemAlle" Header="Alle">
<TabItem.InputBindings>
<KeyBinding Key="Delete" Command="{Binding DeleteItemCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenEditItemDialogCommand}" />
<KeyBinding
Key="C"
Command="{Binding CopyPromptCommand}"
Modifiers="Ctrl" />
<KeyBinding
Key="V"
Command="{Binding PastePromptCommand}"
Modifiers="Ctrl" />
<KeyBinding Key="F" Command="{Binding ChangeFavoritenStateItemCommand}" />
<KeyBinding Key="N" Command="{Binding OpenAddPromptDialogCommand}" />
</TabItem.InputBindings>
<Grid Background="Transparent">
<dxe:ListBoxEdit x:Name="listBoxEdit3" ItemsSource="{Binding SelectedFolder.AlleFolderItems, UpdateSourceTrigger=PropertyChanged}">
<dxe:ListBoxEdit.StyleSettings>
<dxe:ListBoxEditStyleSettings />
</dxe:ListBoxEdit.StyleSettings>
<dxe:ListBoxEdit.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding OpenAddPromptDialogCommand}" Header="Neuer Prompt">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding OpenAddRoutineDialogCommand}" Header="Neue Routine">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding PastePromptCommand}" Header="Einfügen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</dxe:ListBoxEdit.ContextMenu>
</dxe:ListBoxEdit>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding
Converter="{StaticResource CollectionCountToBoolConverter}"
ConverterParameter="reverse"
Path="SelectedFolder.AlleFolderItems.Count" />
<Binding Path="SelectedFolder.CanAddPrompt" />
</MultiBinding>
</StackPanel.Visibility>
<Path
Height="32"
Margin="6"
Data="{StaticResource GeometryFileAdd2}"
Fill="Black"
IsHitTestVisible="False"
Stretch="Uniform" />
<TextBlock IsHitTestVisible="False">
Hier sind noch keine Prompts/Routinen angelegt.
</TextBlock>
<Button
Width="150"
Margin="3,12,3,3"
Command="{Binding OpenAddPromptDialogCommand}"
Visibility="{Binding IsEditMode, ElementName=root, Converter={StaticResource BoolVisibilityConverter}}">
Ersten Prompt anlegen
</Button>
<Button
Width="150"
Margin="3,3,3,3"
Command="{Binding OpenAddRoutineDialogCommand}"
Visibility="{Binding IsEditMode, ElementName=root, Converter={StaticResource BoolVisibilityConverter}}">
Erste Routine anlegen
</Button>
</StackPanel>
</Grid>
</TabItem>
<TabItem x:Name="tabItemPrompts" Header="Prompts">
<TabItem.InputBindings>
<KeyBinding Key="Delete" Command="{Binding DeletePromptCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenEditPromptDialogCommand}" />
<KeyBinding
Key="C"
Command="{Binding CopyPromptCommand}"
Modifiers="Ctrl" />
<KeyBinding
Key="V"
Command="{Binding PastePromptCommand}"
Modifiers="Ctrl" />
<KeyBinding Key="F" Command="{Binding ChangeFavoritenStatePromptCommand}" />
<KeyBinding Key="N" Command="{Binding OpenAddPromptDialogCommand}" />
</TabItem.InputBindings>
<Grid Background="Transparent">
<dxe:ListBoxEdit x:Name="listBoxEdit1" ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}">
<dxe:ListBoxEdit.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding OpenAddPromptDialogCommand}" Header="Neuer Prompt">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding PastePromptCommand}" Header="Einfügen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</dxe:ListBoxEdit.ContextMenu>
</dxe:ListBoxEdit>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding
Converter="{StaticResource CollectionCountToBoolConverter}"
ConverterParameter="reverse"
Path="SelectedFolder.Prompts.Count" />
<Binding Path="SelectedFolder.CanAddPrompt" />
</MultiBinding>
</StackPanel.Visibility>
<Path
Height="32"
Margin="6"
Data="{StaticResource GeometryFileAdd2}"
Fill="Black"
IsHitTestVisible="False"
Stretch="Uniform" />
<TextBlock IsHitTestVisible="False">
Hier sind noch keine Prompts angelegt.
</TextBlock>
<Button
Width="150"
Margin="3,12,3,3"
Command="{Binding OpenAddPromptDialogCommand}"
Visibility="{Binding IsEditMode, ElementName=root, Converter={StaticResource BoolVisibilityConverter}}">
Ersten Prompt anlegen
</Button>
</StackPanel>
</Grid>
</TabItem>
<TabItem x:Name="tabItemRoutinen" Header="Routinen">
<TabItem.InputBindings>
<KeyBinding Key="Delete" Command="{Binding DeleteRoutineCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenEditRoutineDialogCommand}" />
<KeyBinding Key="F" Command="{Binding ChangeFavoritenStateRoutineCommand}" />
<KeyBinding Key="N" Command="{Binding OpenAddRoutineDialogCommand}" />
</TabItem.InputBindings>
<Grid Background="Transparent">
<dxe:ListBoxEdit x:Name="listBoxEdit2" ItemsSource="{Binding SelectedFolder.Routines, UpdateSourceTrigger=PropertyChanged}">
<dxe:ListBoxEdit.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding OpenAddRoutineDialogCommand}" Header="Neue Routine">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</dxe:ListBoxEdit.ContextMenu>
</dxe:ListBoxEdit>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding
Converter="{StaticResource CollectionCountToBoolConverter}"
ConverterParameter="reverse"
Path="SelectedFolder.Routines.Count" />
<Binding Path="SelectedFolder.CanAddRoutine" />
</MultiBinding>
</StackPanel.Visibility>
<Path
Height="32"
Margin="6"
Data="{StaticResource GeometryFileAdd2}"
Fill="Black"
IsHitTestVisible="False"
Stretch="Uniform" />
<TextBlock IsHitTestVisible="False">
Hier sind noch keine Routinen angelegt.
</TextBlock>
<Button
Width="150"
Margin="3,12,3,3"
Command="{Binding OpenAddRoutineDialogCommand}"
Visibility="{Binding IsEditMode, ElementName=root, Converter={StaticResource BoolVisibilityConverter}}">
Erste Routine anlegen
</Button>
</StackPanel>
</Grid>
</TabItem>
</TabControl>
<StackPanel
HorizontalAlignment="Right"
VerticalAlignment="Top"
Orientation="Horizontal">
<StackPanel.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding Path="SelectedFolder.CanAddPrompt" />
<Binding ElementName="root" Path="IsEditMode" />
</MultiBinding>
</StackPanel.Visibility>
<StackPanel.Resources>
<ResourceDictionary>
<Style BasedOn="{StaticResource HideDisabledButton}" TargetType="Button">
<Setter Property="Width" Value="120" />
<Setter Property="Height" Value="23" />
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</ResourceDictionary>
</StackPanel.Resources>
<Button x:Name="btn_addPrompt" Command="{Binding OpenAddPromptDialogCommand}">
<Button.Style>
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedIndex, ElementName=tabcontrol_1}" Value="0">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding SelectedIndex, ElementName=tabcontrol_1}" Value="1">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
+ Prompt
</Button>
<Button x:Name="btn_addRoutine" Command="{Binding OpenAddRoutineDialogCommand}">
<Button.Style>
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedIndex, ElementName=tabcontrol_1}" Value="0">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding SelectedIndex, ElementName=tabcontrol_1}" Value="2">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
+ Routine
</Button>
</StackPanel>
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,274 @@
using BeWo.ViewModel;
using DevExpress.Xpf.Editors;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace BeWo.View.Controls.AI
{
/// <summary>
/// Gemeinsame Promptbaustein-Bibliothek (TreeView + GridSplitter + TabControl),
/// genutzt von AiPromptbausteinComplexTreeView und AiPromptbausteinComplexSelectionView.
/// Der DataContext wird vom Host geerbt und muss IAiPromptbausteinComplexViewModel implementieren.
/// </summary>
public partial class AiPromptbausteinLibraryControl : UserControl
{
public AiPromptbausteinLibraryControl()
{
InitializeComponent();
}
private IAiPromptbausteinComplexViewModel ViewModel => DataContext as IAiPromptbausteinComplexViewModel;
public static readonly DependencyProperty PromptActivatedCommandProperty =
DependencyProperty.Register("PromptActivatedCommand", typeof(ICommand),
typeof(AiPromptbausteinLibraryControl), new PropertyMetadata(null));
public static readonly DependencyProperty RoutineActivatedCommandProperty =
DependencyProperty.Register("RoutineActivatedCommand", typeof(ICommand),
typeof(AiPromptbausteinLibraryControl), new PropertyMetadata(null));
/// <summary>
/// Wird bei Doppelklick auf einen Prompt ausgeführt (Verwaltung: Bearbeiten, Auswahl: Senden).
/// </summary>
public ICommand PromptActivatedCommand
{
get { return (ICommand)GetValue(PromptActivatedCommandProperty); }
set { SetValue(PromptActivatedCommandProperty, value); }
}
/// <summary>
/// Wird bei Doppelklick auf eine Routine ausgeführt (Verwaltung: Bearbeiten, Auswahl: Senden).
/// </summary>
public ICommand RoutineActivatedCommand
{
get { return (ICommand)GetValue(RoutineActivatedCommandProperty); }
set { SetValue(RoutineActivatedCommandProperty, value); }
}
public static readonly DependencyProperty IsEditModeProperty =
DependencyProperty.Register("IsEditMode", typeof(bool),
typeof(AiPromptbausteinLibraryControl), new PropertyMetadata(true, OnIsEditModeChanged));
/// <summary>
/// Schaltet den Bearbeitungsmodus (Kontextmenüs, Edit-Shortcuts, Anlegen-Buttons,
/// Ordner-Doppelklick-Bearbeiten). Default: eingeschaltet.
/// </summary>
public bool IsEditMode
{
get { return (bool)GetValue(IsEditModeProperty); }
set { SetValue(IsEditModeProperty, value); }
}
static void OnIsEditModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (AiPromptbausteinLibraryControl)d;
control.UpdateEditMode((bool)e.NewValue);
}
private Dictionary<FrameworkElement, InputBinding[]> _DisabledInputBindings;
void UpdateEditMode(bool isEditMode)
{
if (!isEditMode)
{
if (_DisabledInputBindings != null)
return;
_DisabledInputBindings = new Dictionary<FrameworkElement, InputBinding[]>();
foreach (var element in new FrameworkElement[] { treeView, tabItemAlle, tabItemPrompts, tabItemRoutinen })
{
_DisabledInputBindings[element] = element.InputBindings.Cast<InputBinding>().ToArray();
element.InputBindings.Clear();
}
}
else
{
if (_DisabledInputBindings == null)
return;
foreach (var entry in _DisabledInputBindings)
foreach (var binding in entry.Value)
entry.Key.InputBindings.Add(binding);
_DisabledInputBindings = null;
}
}
/// <summary>
/// Setzt die initiale Selektion: "Eigene" (zweites TreeViewItem, Index 1) wird vorausgewählt.
/// Greift nur, wenn der Container bereits erzeugt ist andernfalls übernimmt die
/// IsSelected-Bindung aus ReloadVMList/UpdateVMList die Vorauswahl.
/// </summary>
public void ResetInitialSelection()
{
if (treeView.ItemContainerGenerator.ContainerFromIndex(1) is TreeViewItem item)
item.IsSelected = true;
listBoxEdit1.UnSelectAll();
}
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(e.OriginalSource as DependencyObject);
if (treeViewItem != null)
{
treeViewItem.Focus();
e.Handled = true;
}
else
{
e.Handled = true;
if (ViewModel?.SelectedFolder == null)
return;
_LastTreeViewItem.IsSelected = false;
treeView.Focus();
}
}
static T VisualUpwardSearch<T>(DependencyObject source) where T : DependencyObject
{
while (source != null && !(source is T))
source = VisualTreeHelper.GetParent(source);
return source as T;
}
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (ViewModel is null)
return;
ViewModel.SelectedFolder = treeView.SelectedValue as AiPromptbausteinFolderVM;
}
private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
// Klicks auf die Scrollbar (z.B. horizontaler Scrollbalken) nicht abfangen,
// sonst lässt sich der Scrollbalken nicht bedienen.
if (VisualUpwardSearch<System.Windows.Controls.Primitives.ScrollBar>(e.OriginalSource as DependencyObject) != null)
return;
TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(e.OriginalSource as DependencyObject);
if (treeViewItem is null)
{
treeView.Focus();
e.Handled = true;
return;
}
if (e.ClickCount == 2)
{
if (!IsEditMode)
return;
if (!ViewModel.OpenEditFolderDialogCommand.CanExecute(null))
return;
ViewModel.OpenEditFolderDialogCommand.Execute(null);
e.Handled = true;
}
}
private TreeViewItem _LastTreeViewItem;
private void treeView_Selected(object sender, RoutedEventArgs e)
{
_LastTreeViewItem = e.OriginalSource as TreeViewItem;
}
private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
if (!IsEditMode)
{
e.Handled = true;
return;
}
ViewModel?.UpdateFolderCommands();
}
private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
if (!IsEditMode)
{
e.Handled = true;
return;
}
ViewModel?.UpdatePromptCommands();
}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
private void Grid_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
var cmd = PromptActivatedCommand;
if (cmd == null || !cmd.CanExecute(null))
return;
if (e.ClickCount == 2)
{
cmd.Execute(null);
e.Handled = true;
}
}
private void Grid_PreviewMouseDown_2(object sender, MouseButtonEventArgs e)
{
var cmd = RoutineActivatedCommand;
if (cmd == null || !cmd.CanExecute(null))
return;
if (e.ClickCount == 2)
{
cmd.Execute(null);
e.Handled = true;
}
}
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.OriginalSource is TabControl)
{
listBoxEdit1.UnSelectAll();
listBoxEdit2.UnSelectAll();
listBoxEdit3.UnSelectAll();
}
}
private void listBoxEdit3_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
return;
if (!(e.OriginalSource is UIElement))
{
return;
}
ListBoxItem listBoxItem = VisualUpwardSearch<ListBoxItem>(e.OriginalSource as DependencyObject);
if (listBoxItem is null)
{
((ListBoxEdit)sender).Focus();
e.Handled = true;
return;
}
}
}
}

View File

@@ -5,8 +5,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="root"
d:DesignWidth="28"
d:DesignHeight="28"
d:DesignWidth="28"
mc:Ignorable="d">
<Button
x:Name="btn"
@@ -14,10 +14,10 @@
Height="22"
Padding="0"
Click="btn_Click"
ToolTip="{Binding HelpToolTip, ElementName=root}"
Cursor="Hand"
FontSize="13"
FontWeight="Bold"
FontSize="13">
ToolTip="{Binding HelpToolTip, ElementName=root}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
@@ -25,9 +25,7 @@
Fill="White"
Stroke="#FF14549E"
StrokeThickness="1" />
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
@@ -40,11 +38,11 @@
</ControlTemplate>
</Button.Template>
<TextBlock
Text="?"
Foreground="#FF14549E"
FontWeight="Bold"
FontSize="14"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
VerticalAlignment="Center"
FontSize="14"
FontWeight="Bold"
Foreground="#FF14549E"
Text="?" />
</Button>
</UserControl>

View File

@@ -26,8 +26,8 @@
<Setter Property="IsMoveToPointEnabled" Value="True" />
</Style>
<Style BasedOn="{StaticResource PopupBlackLabel}" TargetType="{x:Type Label}" />
<Style BasedOn="{StaticResource BaseRadioButton}" TargetType="{x:Type RadioButton}" >
<Setter Property="Foreground" Value="Black"/>
<Style BasedOn="{StaticResource BaseRadioButton}" TargetType="{x:Type RadioButton}">
<Setter Property="Foreground" Value="Black" />
</Style>
</ResourceDictionary>
</UserControl.Resources>

View File

@@ -284,6 +284,7 @@
ItemsSource="{Binding ListVM.SelectedVM.Messages.VMList, UpdateSourceTrigger=PropertyChanged}"
ScrollViewer.CanContentScroll="False"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Tag="{Binding DataContext, ElementName=root}"
Visibility="{Binding IsNewConversationVisible, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=Reverse}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">

View File

@@ -5,6 +5,7 @@ using BeWo.ViewModel.ListViewModel;
using BeWo.ViewModel.View.AI;
using BS.Shared.Extensions;
using DevExpress.Mvvm;
using DevExpress.Xpf.Core.Native;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
@@ -30,6 +31,8 @@ namespace BeWo.View.Detail.AI
/// </summary>
public partial class AiConversationChatView : BeWoView
{
private bool _loaded = false;
public AiConversationChatView(AiConversationChatViewModel viewModel)
{
InitializeComponent();
@@ -59,14 +62,15 @@ namespace BeWo.View.Detail.AI
private void BeWoView_Loaded(object sender, RoutedEventArgs e)
{
if (BeWoApp.IsInDesignMode)
if (BeWoApp.IsInDesignMode || _loaded)
return;
_loaded = true;
ViewModel.ReloadConfigCommand.Execute(null);
ViewModel.ReloadConversationsCommand.Execute(null);
if (ViewModel.SendAfterLoaded)
ViewModel.StartConversationWithMessageCommand.Execute(null);
ViewModel.Start();
}
private void listview_conversations_SelectionChanged(object sender, SelectionChangedEventArgs e)

View File

@@ -1,12 +1,13 @@
<UserControl
<UserControl
x:Class="BeWo.View.Detail.AI.AiPromptbausteinComplexSelectionFavoritenView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ai="clr-namespace:BeWo.ViewModel.View.AI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:draw="clr-namespace:System.Drawing;assembly=System.Drawing"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:BeWo.View.Detail.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:templateselectors="clr-namespace:BeWo.View.TemplateSelectors"
xmlns:vm="clr-namespace:BeWo.ViewModel"
d:DataContext="{d:DesignInstance Type=ai:AiPromptbausteinSelectionComplexViewModel,
IsDesignTimeCreatable=True}"
@@ -22,9 +23,282 @@
<Style
x:Key="PromptListBoxItem"
BasedOn="{StaticResource PhotoListBoxItem}"
TargetType="dxe:ListBoxEditItem">
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
</Style>
TargetType="ListBoxItem" />
<DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}">
<Border
Background="#09000000"
BorderThickness="1"
CornerRadius="5">
<Grid
Margin="6"
Background="Transparent"
PreviewMouseUp="Item_MouseUp">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="6" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle
Grid.RowSpan="2"
Width="24"
Height="24"
Fill="White" />
<StackPanel Grid.Column="2" Orientation="Horizontal">
<TextBox
Height="21"
Margin="2,0,0,0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="True"
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
<TextBox
MaxWidth="500"
Padding="3,1,0,0"
VerticalAlignment="Center"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="Wrap" />
</StackPanel>
</TextBox.ToolTip>
</TextBox>
<TextBlock
x:Name="infobox"
Margin="0"
Padding="0"
Visibility="{Binding IsInfoVisible, Converter={StaticResource BoolVisibilityConverter}}">
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
(i)
</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel
Grid.Row="1"
Grid.Column="2"
Orientation="Horizontal">
<Border
x:Name="border1"
Width="46"
Margin="0,0,3,0"
Padding="3"
HorizontalAlignment="Left"
Background="#EEEDFE"
CornerRadius="7">
<TextBlock
Margin="1,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Text="Prompt"
TextWrapping="Wrap" />
</Border>
</StackPanel>
</Grid>
</Border>
</DataTemplate>
<DataTemplate x:Key="AiPromptbausteinRoutineItemTemplate" DataType="vm:AiPromptbausteinRoutineVM">
<Border
x:Name="border"
Background="#09000000"
CornerRadius="5"
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}">
<Border.Style>
<Style TargetType="Border">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Transparent" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsValid}" Value="False">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="IsEnabled" Value="False" />
<Setter Property="IsHitTestVisible" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid
Margin="6"
Background="Transparent"
PreviewMouseUp="Item_MouseUp">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="9" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle
Grid.RowSpan="2"
Width="24"
Height="24"
Fill="White" />
<StackPanel Grid.Column="2" Orientation="Horizontal">
<TextBox
Height="21"
Margin="0,0,0,0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="True"
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
<TextBox
MaxWidth="500"
Padding="3,1,0,0"
VerticalAlignment="Center"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="Wrap" />
</StackPanel>
</TextBox.ToolTip>
</TextBox>
</StackPanel>
<StackPanel
Grid.Row="1"
Grid.Column="2"
Margin="0,-1,0,0"
Orientation="Horizontal">
<Border
x:Name="border1"
Width="46"
Margin="0,0,3,0"
Padding="3"
HorizontalAlignment="Left"
Background="#E1F5EE"
CornerRadius="7">
<TextBlock
Margin="1,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Text="Routine"
TextWrapping="Wrap" />
</Border>
<TextBlock
Margin="3,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} Schritte">
<Binding Path="Steps.Count" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
<ListBox
Grid.Row="2"
Grid.Column="2"
Margin="3,9,3,3"
AllowDrop="False"
Background="Transparent"
BorderThickness="0"
Focusable="False"
IsHitTestVisible="False"
ItemsSource="{Binding Steps.VMList}"
Visibility="{Binding Steps.VMList.Count, Converter={StaticResource CollectionCountToVisibilityConverter}}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock
x:Name="arrow"
Margin="3"
VerticalAlignment="Center"
Text="&#x2794;" />
<Border
x:Name="border1"
Height="19"
Margin="0"
Padding="3"
HorizontalAlignment="Left"
Background="DarkGray"
CornerRadius="7">
<TextBlock
Margin="3,0,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Text="{Binding PromptReference.Title, StringFormat={}✦ {0}}"
TextWrapping="Wrap" />
</Border>
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
<Setter TargetName="arrow" Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding IsValid}" Value="false">
<Setter TargetName="border1" Property="Background" Value="LightCoral" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
<StackPanel
Grid.Row="3"
Grid.Column="2"
Orientation="Horizontal"
Visibility="{Binding IsValid, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=reverse}">
<Image
x:Name="imgWarning"
Grid.Column="2"
Height="20"
Margin="6,0"
Source="{Binding Source={x:Static draw:SystemIcons.Warning}, Converter={StaticResource IconToImageSourceConverter}, Mode=OneWay}" />
<!-- Visibility="{Binding ElementName=btnOpenAi4, Path=Visibility}" -->
<Label Foreground="Red">
Ungültig
</Label>
</StackPanel>
</Grid>
</Border>
</DataTemplate>
<templateselectors:AiPromptbausteinFolderItemTemplateSelector
x:Key="AiPromptbausteinFolderItemTemplateSelector"
AiPromptbausteinPromptTemplate="{StaticResource AiPromptbausteinPromptItemTemplate}"
AiPromptbausteinRoutineTemplate="{StaticResource AiPromptbausteinRoutineItemTemplate}" />
</ResourceDictionary>
</UserControl.Resources>
<Grid>
@@ -33,7 +307,6 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GroupBox
x:Name="groupbox2"
@@ -41,74 +314,119 @@
Header="Favoriten"
Style="{StaticResource ObjectEditGroupBox}">
<Grid>
<dxe:ListBoxEdit
x:Name="listBoxEdit1"
Padding="4,16,4,16"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
EditValue="{Binding SelectedPrompt, Mode=TwoWay}"
ItemContainerStyle="{StaticResource PromptListBoxItem}"
ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}"
SelectionMode="Single"
<TabControl
x:Name="tabcontrol_1"
Padding="0"
BorderBrush="Gray"
BorderThickness="0,1,1,1"
SelectionChanged="TabControl_SelectionChanged"
Visibility="{Binding HasFavoriten, Converter={StaticResource BoolVisibilityConverter}}">
<dxe:ListBoxEdit.ItemTemplate>
<DataTemplate>
<Grid
Margin="0,3,0,0"
Background="Transparent"
MouseEnter="Grid_MouseEnter"
MouseUp="Grid_MouseUp">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBox
Height="21"
Margin="0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="True"
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
<TextBox
MaxWidth="500"
Padding="3,1,0,0"
VerticalAlignment="Center"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="Wrap" />
</StackPanel>
</TextBox.ToolTip>
</TextBox>
<TextBlock
Grid.Column="1"
Margin="0"
Padding="0"
Visibility="{Binding IsInfoVisible, Converter={StaticResource BoolVisibilityConverter}}">
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
(i)
</Hyperlink>
</TextBlock>
</Grid>
</DataTemplate>
</dxe:ListBoxEdit.ItemTemplate>
</dxe:ListBoxEdit>
<TabControl.Resources>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border
x:Name="Border"
Grid.Row="0"
Grid.Column="0"
MinHeight="20"
Padding="12,3,12,3"
Background="Transparent"
TextElement.FontFamily="Microsoft Sans Serif"
TextElement.FontSize="16"
TextElement.Foreground="{StaticResource TabItemHotTextBrush}">
<ContentPresenter
Height="18"
ContentSource="Header"
RecognizesAccessKey="True" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Panel.ZIndex" Value="100" />
<Setter TargetName="Border" Property="Background" Value="#22000000" />
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Background" Value="DarkRed" />
<Setter TargetName="Border" Property="BorderBrush" Value="Black" />
<Setter Property="Foreground" Value="DarkGray" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource {x:Type dxe:ListBoxEdit}}" TargetType="dxe:ListBoxEdit">
<Setter Property="Padding" Value="8,16" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="AllowDrop" Value="False" />
<Setter Property="ItemContainerStyle" Value="{StaticResource PromptListBoxItem}" />
<Setter Property="ItemTemplateSelector" Value="{StaticResource AiPromptbausteinFolderItemTemplateSelector}" />
<Setter Property="SelectedItem" Value="{Binding SelectedItem, Mode=TwoWay}" />
<Setter Property="SelectionMode" Value="Single" />
<Setter Property="ShowBorder" Value="False" />
</Style>
</TabControl.Resources>
<TabItem Header="Alle">
<Grid Background="Transparent">
<dxe:ListBoxEdit x:Name="listBoxEdit3" ItemsSource="{Binding SelectedFolder.AlleFolderItems, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsHitTestVisible="False">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding
Converter="{StaticResource CollectionCountToBoolConverter}"
ConverterParameter="reverse"
Path="SelectedFolder.AlleFolderItems.Count" />
</MultiBinding>
</TextBlock.Visibility>
Keine Favoriten vorhanden.
</TextBlock>
</Grid>
</TabItem>
<TabItem Header="Prompts">
<Grid Background="Transparent">
<dxe:ListBoxEdit x:Name="listBoxEdit1" ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsHitTestVisible="False">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding
Converter="{StaticResource CollectionCountToBoolConverter}"
ConverterParameter="reverse"
Path="SelectedFolder.Prompts.Count" />
</MultiBinding>
</TextBlock.Visibility>
Keine Prompt-Favoriten vorhanden.
</TextBlock>
</Grid>
</TabItem>
<TabItem Header="Routinen">
<Grid Background="Transparent">
<dxe:ListBoxEdit x:Name="listBoxEdit2" ItemsSource="{Binding SelectedFolder.Routines, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsHitTestVisible="False">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding
Converter="{StaticResource CollectionCountToBoolConverter}"
ConverterParameter="reverse"
Path="SelectedFolder.Routines.Count" />
</MultiBinding>
</TextBlock.Visibility>
Keine Routinen-Favoriten vorhanden.
</TextBlock>
</Grid>
</TabItem>
</TabControl>
<TextBlock
Margin="3"
HorizontalAlignment="Center"
@@ -119,92 +437,5 @@
Bitte legen Sie in der Verwaltung Ihre gewünschten Prompt-Favoriten fest.</TextBlock>
</Grid>
</GroupBox>
<!--<GroupBox
Grid.Row="1"
Grid.Column="2"
Header="Details"
Style="{StaticResource ObjectEditGroupBox}">
<Grid
MaxWidth="700"
HorizontalAlignment="Stretch"
Background="#fdfdfd">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" MinWidth="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" MinWidth="100" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0">Name</Label>
<TextBox
Grid.Row="0"
Grid.Column="2"
IsEnabled="{Binding IsEditingMode}"
Text="{Binding ViewModel.Title, UpdateSourceTrigger=PropertyChanged}" />
<Label
Grid.Row="1"
Grid.Column="0"
Content="Beschreibung" />
<TextBox
Grid.Row="1"
Grid.Column="2"
IsEnabled="{Binding IsEditingMode}"
MaxLength="1024"
Style="{StaticResource TextBoxNotice}"
Text="{Binding ViewModel.Description, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label
Grid.Row="2"
Grid.Column="0"
Content="Prompt" />
<TextBox
Grid.Row="2"
Grid.Column="2"
IsEnabled="{Binding IsEditingMode}"
MaxLength="1024"
Style="{StaticResource TextBoxNoticeLarge}"
Text="{Binding ViewModel.Prompt, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label
Grid.Row="3"
Grid.Column="0"
Content="Ersteller:" />
<comboboxes:ComboBoxEmployeeSearch
Grid.Row="3"
Grid.Column="2"
Margin="3"
IsEnabled="False"
SelectedCompactEmployeeDC="{Binding ViewModel.Creator}" />
<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
<dxe:CheckEdit
Grid.Row="4"
Grid.Column="2"
Margin="3"
IsChecked="{Binding ViewModel.IsPublic}"
IsEnabled="{Binding IsEditingMode, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</GroupBox>-->
<!--<Button
Grid.Row="1"
Grid.ColumnSpan="3"
Command="{Binding SendCommand}"
Style="{StaticResource PrimaryButton}"
Visibility="{Binding HasFavoriten, Converter={StaticResource BoolVisibilityConverter}}">
Absenden
</Button>-->
</Grid>
</UserControl>

View File

@@ -1,25 +1,15 @@
using BeWo.ViewModel.View.AI;
using BeWo.ViewModel;
using System;
using System.Collections.Generic;
using BeWo.ViewModel.View.AI;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BeWo.View.Detail.AI
{
/// <summary>
/// Interaktionslogik für AiPromptbausteinComplexSelectionView.xaml
/// Interaktionslogik für AiPromptbausteinComplexSelectionFavoritenView.xaml
/// Reine Auswahl-Ansicht der Favoriten (keine Bearbeitung) — ein Klick auf einen Eintrag sendet sofort.
/// </summary>
public partial class AiPromptbausteinComplexSelectionFavoritenView : UserControl
{
@@ -36,17 +26,27 @@ namespace BeWo.View.Detail.AI
ViewModel.InitVMList();
listBoxEdit1.UnSelectAll();
listBoxEdit2.UnSelectAll();
listBoxEdit3.UnSelectAll();
};
}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
private void Item_MouseUp(object sender, MouseButtonEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
if (e.ChangedButton != MouseButton.Left)
return;
// Klick auf den (i)-Hyperlink soll nur den Link öffnen, nicht senden
if ((e.OriginalSource as FrameworkElement)?.Name == "infobox")
return;
var vm = (sender as FrameworkElement)?.DataContext as AbstractBaseVM;
if (vm is null)
return;
ViewModel.SelectedItem = vm;
private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
{
if (!ViewModel.SendCommand.CanExecute(null))
return;
@@ -54,19 +54,20 @@ namespace BeWo.View.Detail.AI
e.Handled = true;
}
private void Grid_MouseEnter(object sender, MouseEventArgs e)
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var grid = sender as Grid;
if (e.OriginalSource is TabControl)
{
listBoxEdit1.UnSelectAll();
listBoxEdit2.UnSelectAll();
listBoxEdit3.UnSelectAll();
}
}
if (grid is null)
return;
var vm = grid.DataContext as AiPromptbausteinPromptVM;
if (vm is null)
return;
ViewModel.SelectedPrompt = vm;
}
}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
}
}

View File

@@ -1,310 +1,48 @@
<UserControl
<view:BeWoView
x:Class="BeWo.View.Detail.AI.AiPromptbausteinComplexSelectionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ai="clr-namespace:BeWo.ViewModel.View.AI"
xmlns:controls="clr-namespace:BeWo.View.Controls.AI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:BeWo.View.Detail.AI"
xmlns:local1="clr-namespace:BeWo.View.Detail.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BeWo.ViewModel"
xmlns:view="clr-namespace:BeWo.View"
d:DataContext="{d:DesignInstance Type=ai:AiPromptbausteinSelectionComplexViewModel,
IsDesignTimeCreatable=True}"
d:DesignHeight="450"
d:DesignWidth="800"
Background="{StaticResource ObjectEditBackgroundBrush}"
mc:Ignorable="d">
<UserControl.Resources>
<view:BeWoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style
x:Key="PromptListBoxItem"
BasedOn="{StaticResource PhotoListBoxItem}"
TargetType="ListBoxItem">
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
</Style>
</ResourceDictionary>
</UserControl.Resources>
</view:BeWoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Rectangle
Grid.ColumnSpan="3"
Height="6"
Fill="{DynamicResource ServiceRecordContentBrush}" />
<Rectangle Height="6" Fill="{DynamicResource ServiceRecordContentBrush}" />
<Grid Grid.Row="1" Margin="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="200" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="2*" MinWidth="200" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GroupBox
x:Name="groupBox1"
Grid.Column="0"
HorizontalAlignment="Stretch"
Header="Ordner"
Style="{StaticResource ObjectEditGroupBox}">
<TreeView
x:Name="treeView"
MinHeight="100"
Padding="4,16,4,16"
AllowDrop="True"
ContextMenuOpening="treeView_ContextMenuOpening"
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}"
ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}"
PreviewMouseDown="Grid_PreviewMouseDown"
PreviewMouseRightButtonDown="OnPreviewMouseRightButtonDown"
SelectedItemChanged="treeView_SelectedItemChanged"
TreeViewItem.Selected="treeView_Selected">
<TreeView.Resources>
<Style x:Key="igoal_treeitemstyle" TargetType="TreeViewItem">
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
</Style>
</TreeView.Resources>
<TreeView.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding OpenAddFolderDialogCommand}" Header="Neu">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding OpenEditFolderDialogCommand}" Header="Bearbeiten">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding DeleteFolderCommand}" Header="Löschen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TreeView.ContextMenu>
</TreeView>
</GroupBox>
<GridSplitter
x:Name="splitter"
Grid.Column="1"
Width="1"
HorizontalAlignment="Center"
Background="#878890" />
<GroupBox
x:Name="groupbox2"
Grid.Column="2"
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
Header="Prompts"
Style="{StaticResource ObjectEditGroupBox}">
<dxe:ListBoxEdit
x:Name="listBoxEdit1"
Padding="4,16,4,16"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowDrop="False"
ContextMenuOpening="ListBox_ContextMenuOpening"
EditValue="{Binding SelectedPrompt, Mode=TwoWay}"
ItemContainerStyle="{StaticResource PromptListBoxItem}"
ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}"
SelectionMode="Single">
<dxe:ListBoxEdit.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding OpenAddPromptDialogCommand}" Header="Neu">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding OpenEditPromptDialogCommand}" Header="Bearbeiten">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem
x:Name="favorite"
Command="{Binding ChangeFavoritenStatePromptCommand}"
Header="Favorit hinzufügen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding DeletePromptCommand}" Header="Löschen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</dxe:ListBoxEdit.ContextMenu>
<dxe:ListBoxEdit.ItemTemplate>
<DataTemplate>
<Grid
Margin="0,3,0,0"
Background="Transparent"
PreviewMouseDown="Grid_PreviewMouseDown_1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBox
Height="21"
Margin="0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="True"
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
<TextBox
MaxWidth="500"
Padding="3,1,0,0"
VerticalAlignment="Center"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="Wrap" />
</StackPanel>
</TextBox.ToolTip>
</TextBox>
<TextBlock
Grid.Column="1"
Margin="0"
Padding="0"
Visibility="{Binding IsInfoVisible, Converter={StaticResource BoolVisibilityConverter}}">
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
(i)
</Hyperlink>
</TextBlock>
</Grid>
</DataTemplate>
</dxe:ListBoxEdit.ItemTemplate>
</dxe:ListBoxEdit>
</GroupBox>
<!--<GroupBox
Grid.Row="1"
Grid.Column="2"
Header="Details"
Style="{StaticResource ObjectEditGroupBox}">
<Grid
MaxWidth="700"
HorizontalAlignment="Stretch"
Background="#fdfdfd">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" MinWidth="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" MinWidth="100" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0">Name</Label>
<TextBox
Grid.Row="0"
Grid.Column="2"
IsEnabled="{Binding IsEditingMode}"
Text="{Binding ViewModel.Title, UpdateSourceTrigger=PropertyChanged}" />
<Label
Grid.Row="1"
Grid.Column="0"
Content="Beschreibung" />
<TextBox
Grid.Row="1"
Grid.Column="2"
IsEnabled="{Binding IsEditingMode}"
MaxLength="1024"
Style="{StaticResource TextBoxNotice}"
Text="{Binding ViewModel.Description, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label
Grid.Row="2"
Grid.Column="0"
Content="Prompt" />
<TextBox
Grid.Row="2"
Grid.Column="2"
IsEnabled="{Binding IsEditingMode}"
MaxLength="1024"
Style="{StaticResource TextBoxNoticeLarge}"
Text="{Binding ViewModel.Prompt, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label
Grid.Row="3"
Grid.Column="0"
Content="Ersteller:" />
<comboboxes:ComboBoxEmployeeSearch
Grid.Row="3"
Grid.Column="2"
Margin="3"
IsEnabled="False"
SelectedCompactEmployeeDC="{Binding ViewModel.Creator}" />
<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
<dxe:CheckEdit
Grid.Row="4"
Grid.Column="2"
Margin="3"
IsChecked="{Binding ViewModel.IsPublic}"
IsEnabled="{Binding IsEditingMode, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</GroupBox>-->
<controls:AiPromptbausteinLibraryControl
x:Name="libraryControl"
IsEditMode="{Binding CanOpenContextMenu}"
PromptActivatedCommand="{Binding SendCommand}"
RoutineActivatedCommand="{Binding SendCommand}" />
<Button
Grid.Row="1"
Grid.ColumnSpan="3"
MinWidth="50"
Margin="6"
Command="{Binding SendCommand}"
Style="{StaticResource PrimaryButton}">
Absenden
</Button>
Content="{Binding AcceptButtonText}"
Style="{StaticResource PrimaryButton}" />
</Grid>
</Grid>
</UserControl>
</view:BeWoView>

View File

@@ -1,27 +1,12 @@
using BeWo.ViewModel.View.AI;
using BeWo.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BeWo.ViewModel.View.AI;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Diagnostics;
namespace BeWo.View.Detail.AI
{
/// <summary>
/// Interaktionslogik für AiPromptbausteinComplexSelectionView.xaml
/// </summary>
public partial class AiPromptbausteinComplexSelectionView : UserControl
public partial class AiPromptbausteinComplexSelectionView : BeWoView
{
public AiPromptbausteinSelectionComplexViewModel ViewModel { get; set; }
@@ -35,100 +20,8 @@ namespace BeWo.View.Detail.AI
{
ViewModel.InitVMList();
TreeViewItem item = treeView.ItemContainerGenerator.ContainerFromIndex(0) as TreeViewItem;
if (item != null)
{
item.IsSelected = true;
item.IsSelected = false;
}
listBoxEdit1.UnSelectAll();
libraryControl.ResetInitialSelection();
};
}
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (ViewModel is null)
return;
ViewModel.SelectedFolder = treeView.SelectedValue as AiPromptbausteinFolderVM;
}
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
if (treeViewItem != null)
{
treeViewItem.Focus();
e.Handled = true;
}
else
{
e.Handled = true;
if (ViewModel.SelectedFolder == null)
return;
_LastTreeViewItem.IsSelected = false;
treeView.Focus();
}
}
static TreeViewItem VisualUpwardSearch(DependencyObject source)
{
while (source != null && !(source is TreeViewItem))
source = VisualTreeHelper.GetParent(source);
return source as TreeViewItem;
}
private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
if (treeViewItem is null)
return;
if (e.ClickCount == 2)
{
ViewModel.OpenEditFolderDialogCommand.Execute(null);
e.Handled = true;
}
}
private TreeViewItem _LastTreeViewItem;
private void treeView_Selected(object sender, RoutedEventArgs e)
{
_LastTreeViewItem = e.OriginalSource as TreeViewItem;
}
private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
ViewModel.UpdateFolderCommands();
}
private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
ViewModel.UpdatePromptCommands();
favorite.Header = (ViewModel.SelectedPrompt?.IsFavorite ?? false) ? "Favorit entfernen" : "Favorit hinzufügen";
}
private void Grid_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
if (!ViewModel.SendCommand.CanExecute(null))
return;
if (e.ClickCount == 2)
{
ViewModel.SendCommand.Execute(null);
e.Handled = true;
}
}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
}
}

View File

@@ -1,18 +1,15 @@
<view:BeWoView
<view:BeWoView
x:Class="BeWo.View.Detail.AI.AiPromptbausteinComplexTreeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:administration="clr-namespace:BeWo.ViewModel.View.Administration"
xmlns:comboboxes="clr-namespace:BeWo.View.Controls.ComboBoxes"
xmlns:controls="clr-namespace:BeWo.View.Controls.AI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
xmlns:local1="clr-namespace:BeWo.View.Detail.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:view="clr-namespace:BeWo.View"
xmlns:vm="clr-namespace:BeWo.ViewModel"
x:Name="root"
d:DataContext="{d:DesignInstance Type=administration:AiPromptbausteinComplexTreeViewModel,
IsDesignTimeCreatable=True}"
IsDesignTimeCreatable=True}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
@@ -21,235 +18,14 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style
x:Key="PromptListBoxItem"
BasedOn="{StaticResource PhotoListBoxItem}"
TargetType="ListBoxItem">
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
</Style>
</ResourceDictionary>
</view:BeWoView.Resources>
<GroupBox Style="{StaticResource ObjectEditGroupBox}">
<GroupBox.Header>
Aktuell definierte KI-Prompts
</GroupBox.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="200" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="2*" MinWidth="200" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel
Grid.Row="0"
Grid.Column="0"
Orientation="Horizontal" />
<StackPanel
Grid.Row="0"
Grid.Column="2"
HorizontalAlignment="Right"
Orientation="Horizontal" />
<GroupBox
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Stretch"
Header="Ordner"
Style="{StaticResource ObjectEditGroupBox}">
<TreeView
x:Name="treeView"
MinHeight="100"
Padding="4,16,4,16"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowDrop="True"
ContextMenuOpening="treeView_ContextMenuOpening"
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}"
ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}"
PreviewMouseDown="Grid_PreviewMouseDown"
PreviewMouseRightButtonDown="OnPreviewMouseRightButtonDown"
SelectedItemChanged="treeView_SelectedItemChanged"
TreeViewItem.Selected="treeView_Selected">
<TreeView.Resources>
<Style x:Key="igoal_treeitemstyle" TargetType="TreeViewItem">
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
</Style>
</TreeView.Resources>
<TreeView.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding OpenAddFolderDialogCommand}" Header="Neu">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding OpenEditFolderDialogCommand}" Header="Bearbeiten">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding CopyFolderCommand}" Header="Kopieren">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding PasteFolderCommand}" Header="Einfügen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding DeleteFolderCommand}" Header="Löschen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TreeView.ContextMenu>
</TreeView>
</GroupBox>
<GridSplitter
Grid.Row="1"
Grid.Column="1"
Width="1"
HorizontalAlignment="Center"
Background="#878890" />
<GroupBox
Grid.Row="1"
Grid.Column="2"
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
Header="Prompts"
Style="{StaticResource ObjectEditGroupBox}">
<dxe:ListBoxEdit
x:Name="listBoxEdit1"
Padding="4,16,4,16"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowDrop="False"
ContextMenuOpening="ListBox_ContextMenuOpening"
ItemContainerStyle="{StaticResource PromptListBoxItem}"
ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedPrompt, Mode=TwoWay}"
SelectionMode="Single">
<dxe:ListBoxEdit.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding OpenAddPromptDialogCommand}" Header="Neu">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding OpenEditPromptDialogCommand}" Header="Bearbeiten">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem
x:Name="favorite"
Command="{Binding ChangeFavoritenStatePromptCommand}"
Header="Kopieren">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding CopyPromptCommand}" Header="Kopieren">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding PastePromptCommand}" Header="Einfügen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding DeletePromptCommand}" Header="Löschen">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</dxe:ListBoxEdit.ContextMenu>
<dxe:ListBoxEdit.ItemTemplate>
<DataTemplate>
<Grid
Margin="0,3,0,0"
Background="Transparent"
PreviewMouseDown="Grid_PreviewMouseDown_1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBox
Height="21"
Margin="0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="True"
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
<TextBox
MaxWidth="500"
Padding="3,1,0,0"
VerticalAlignment="Center"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="Wrap" />
</StackPanel>
</TextBox.ToolTip>
</TextBox>
<TextBlock
Grid.Column="1"
Margin="0"
Padding="0"
Visibility="{Binding IsInfoVisible, Converter={StaticResource BoolVisibilityConverter}}">
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
(i)
</Hyperlink>
</TextBlock>
</Grid>
</DataTemplate>
</dxe:ListBoxEdit.ItemTemplate>
</dxe:ListBoxEdit>
</GroupBox>
</Grid>
<controls:AiPromptbausteinLibraryControl
PromptActivatedCommand="{Binding OpenEditPromptDialogCommand}"
RoutineActivatedCommand="{Binding OpenEditRoutineDialogCommand}" />
</GroupBox>
</view:BeWoView>

View File

@@ -1,44 +1,18 @@
using BeWo.Core;
using BeWo.ViewModel;
using BeWo.ViewModel.View.Administration;
using DevExpress.Mvvm;
using DevExpress.Xpf.Accordion;
using DevExpress.Xpf.Core.Native;
using DevExpress.Xpf.Editors;
using DevExpress.XtraEditors.TextEditController.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BeWo.View.Detail.AI
{
/// <summary>
/// Interaktionslogik für AiPromptbausteinTreeView.xaml
/// Interaktionslogik für AiPromptbausteinComplexTreeView.xaml
/// </summary>
public partial class AiPromptbausteinComplexTreeView : BeWoView
{
public bool IsDragging = false;
public AiPromptbausteinComplexTreeView(AiPromptbausteinComplexTreeViewModel viewModel = null)
{
InitializeComponent();
if (viewModel == null )
viewModel = new AiPromptbausteinComplexTreeViewModel(BeWoApp.MainControl.WindowService, BS.Shared.AiActionType.ServiceRecordConversation);
if (viewModel == null)
viewModel = new AiPromptbausteinComplexTreeViewModel(BeWoApp.WindowService, BS.Shared.AiActionType.ServiceRecordConversation);
DataContext = ViewModel = viewModel;
@@ -48,124 +22,5 @@ namespace BeWo.View.Detail.AI
public AiPromptbausteinComplexTreeViewModel ViewModel { get; set; }
public override bool IsDirty => ViewModel is object && ViewModel.IsDirty;
protected override void Save() => ViewModel.SaveVMList();
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
if (treeViewItem != null)
{
treeViewItem.Focus();
e.Handled = true;
}
else
{
e.Handled = true;
if (ViewModel.SelectedFolder == null)
return;
_LastTreeViewItem.IsSelected = false;
treeView.Focus();
}
}
static TreeViewItem VisualUpwardSearch(DependencyObject source)
{
while (source != null && !(source is TreeViewItem))
source = VisualTreeHelper.GetParent(source);
return source as TreeViewItem;
}
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (ViewModel is null)
return;
ViewModel.SelectedFolder = treeView.SelectedValue as AiPromptbausteinFolderVM;
}
private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
if (treeViewItem is null)
return;
if (e.ClickCount == 2)
{
ViewModel.OpenEditFolderDialogCommand.Execute(null);
e.Handled = true;
}
}
private TreeViewItem _LastTreeViewItem;
private void treeView_Selected(object sender, RoutedEventArgs e)
{
_LastTreeViewItem = e.OriginalSource as TreeViewItem;
}
private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
ViewModel.UpdateFolderCommands();
}
private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
ViewModel.UpdatePromptCommands();
favorite.Header = (ViewModel.SelectedPrompt?.IsFavorite ?? false) ? "Favorit entfernen" : "Favorit hinzufügen";
}
//private void listBox_Prompts_PreviewMouseUp(object sender, MouseButtonEventArgs e)
//{
// IsDragging = false;
//}
//private void listBox_Prompts_Drop(object sender, DragEventArgs e)
//{
// HitTestResult hitTest = VisualTreeHelper.HitTest(listBoxEdit1, e.GetPosition(listBoxEdit1));
// ListBoxEditItem item = LayoutHelper.FindParentObject<ListBoxEditItem>((DependencyObject)hitTest.VisualHit);
// int insertIndex = ViewModel.SelectedFolder.SubPrompts.VMList.IndexOf((AiPromptbausteinPromptVM)item.Content);
// ViewModel.SelectedFolder.SubPrompts.VMList.Remove((AiPromptbausteinPromptVM)e.Data.GetData(typeof(AiPromptbausteinPromptVM)));
// if (listBoxEdit1.SelectedIndex > insertIndex)
// insertIndex++;
// ViewModel.SelectedFolder.SubPrompts.VMList.Insert(insertIndex, (AiPromptbausteinPromptVM)e.Data.GetData(typeof(AiPromptbausteinPromptVM)));
//}
//private void listBox_Prompts_DragOver(object sender, DragEventArgs e)
//{
// e.Effects = DragDropEffects.Move;
//}
//private void listBox_Prompts_MouseMove(object sender, MouseEventArgs e)
//{
// if (IsDragging && listBoxEdit1.SelectedItem != null)
// {
// DragDrop.DoDragDrop(listBoxEdit1, listBoxEdit1.SelectedItem, DragDropEffects.Move);
// }
//}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
private void Grid_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
if (!ViewModel.OpenEditPromptDialogCommand.CanExecute(null))
return;
if (e.ClickCount == 2)
{
ViewModel.OpenEditPromptDialogCommand.Execute(null);
e.Handled = true;
}
}
}
}

View File

@@ -1,4 +1,4 @@
<UserControl
<view:BeWoView
x:Class="BeWo.View.Detail.AI.AiPromptbausteinFolderView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -8,19 +8,22 @@
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:view="clr-namespace:BeWo.View"
xmlns:viewmodel="clr-namespace:BeWo.ViewModel.View.Administration"
Width="auto"
Height="auto"
d:DataContext="{d:DesignInstance Type=viewmodel:AiPromptbausteinFolderViewModel}"
Background="{StaticResource ObjectEditBackgroundBrush}"
Focusable="True"
mc:Ignorable="d">
<UserControl.Resources>
<view:BeWoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label" />
</ResourceDictionary>
</UserControl.Resources>
</view:BeWoView.Resources>
<Grid
MaxWidth="700"
Margin="3"
@@ -28,7 +31,7 @@
<Grid Margin="8,4,8,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" MinWidth="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="3*" MinWidth="100" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
@@ -60,7 +63,7 @@
<Label
Grid.Row="2"
Grid.Column="0"
Content="Ersteller:" />
Content="Ersteller" />
<comboboxes:ComboBoxEmployeeSearch
Grid.Row="2"
Grid.Column="2"
@@ -74,7 +77,7 @@
Grid.Column="2"
Margin="3"
IsChecked="{Binding ViewModel.IsPublic}"
IsEnabled="{Binding IsEditingMode, UpdateSourceTrigger=PropertyChanged}" />
IsEnabled="{Binding ViewModel.CanShareEdit, UpdateSourceTrigger=PropertyChanged}" />
<StackPanel
Grid.Row="6"
@@ -84,17 +87,17 @@
Orientation="Horizontal">
<Button
Width="100"
Command="{Binding CancelCommand}"
Command="ApplicationCommands.Close"
Visibility="Visible">
Abbrechen
</Button>
<Button
Width="100"
Command="{Binding AcceptCommand}"
Command="{Binding SaveCommand}"
Content="{Binding AcceptButtonText}"
Visibility="Visible" />
</StackPanel>
</Grid>
</Grid>
</UserControl>
</view:BeWoView>

View File

@@ -20,13 +20,29 @@ namespace BeWo.View.Detail.AI
/// <summary>
/// Interaktionslogik für AiPromptbausteinFolderView.xaml
/// </summary>
public partial class AiPromptbausteinFolderView : UserControl
public partial class AiPromptbausteinFolderView : BeWoView
{
public AiPromptbausteinFolderViewModel ViewModel
{
get => DataContext as AiPromptbausteinFolderViewModel;
set => DataContext = value;
}
public AiPromptbausteinFolderView(AiPromptbausteinFolderViewModel vm)
{
InitializeComponent();
DataContext = vm;
ViewModel = vm;
}
public override bool IsDirty
{
get => ViewModel?.ViewModel?.IsDirty ?? false;
}
protected override void Save()
{
ViewModel.SaveCommand.Execute(null);
}
}
}

View File

@@ -1,4 +1,4 @@
<UserControl
<view:BeWoView
x:Class="BeWo.View.Detail.AI.AiPromptbausteinPromptView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -8,19 +8,22 @@
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:view="clr-namespace:BeWo.View"
xmlns:viewmodel="clr-namespace:BeWo.ViewModel.View.Administration"
Width="auto"
Height="auto"
d:DataContext="{d:DesignInstance Type=viewmodel:AiPromptbausteinPromptViewModel}"
Background="{StaticResource ObjectEditBackgroundBrush}"
Focusable="True"
mc:Ignorable="d">
<UserControl.Resources>
<view:BeWoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label" />
</ResourceDictionary>
</UserControl.Resources>
</view:BeWoView.Resources>
<Grid
MaxWidth="700"
Margin="3"
@@ -28,7 +31,7 @@
<Grid Margin="8,4,8,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" MinWidth="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="3*" MinWidth="100" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
@@ -56,6 +59,7 @@
Grid.Row="1"
Grid.Column="2"
MaxHeight="100"
Margin="3,6,3,6"
IsEnabled="{Binding ViewModel.CanEdit}"
MaxLength="1024"
Style="{StaticResource TextBoxNotice}"
@@ -72,13 +76,18 @@
IsEnabled="{Binding ViewModel.CanEdit}"
Style="{StaticResource TextBoxNoticeLarge}"
Text="{Binding ViewModel.Prompt, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" Visibility="{Binding ViewModel.IsPromptVisible, Converter={StaticResource BoolVisibilityConverter}}" />
<Label Grid.Row="2"
Grid.Column="2" Foreground="DarkGray" FontSize="10"
Visibility="{Binding ViewModel.IsPromptVisible, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=Reverse}">
TextWrapping="Wrap"
Visibility="{Binding ViewModel.IsPromptVisible, Converter={StaticResource BoolVisibilityConverter}}" />
<Label
Grid.Row="2"
Grid.Column="2"
FontSize="10"
Foreground="DarkGray"
HorizontalAlignment="Center"
Visibility="{Binding ViewModel.IsPromptVisible, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=Reverse}">
nicht sichtbar
</Label>
<Label
Grid.Row="3"
Grid.Column="0"
@@ -86,17 +95,17 @@ Grid.Column="2" Foreground="DarkGray" FontSize="10"
<comboboxes:ComboBoxEmployeeSearch
Grid.Row="3"
Grid.Column="2"
Margin="3"
Margin="3,6,3,6"
IsEnabled="False"
SelectedCompactEmployeeDC="{Binding ViewModel.Creator}" />
<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
<!--<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
<dxe:CheckEdit
Grid.Row="4"
Grid.Column="2"
Margin="3"
IsChecked="{Binding ViewModel.IsPublic}"
IsEnabled="{Binding ViewModel.CanShareEdit, UpdateSourceTrigger=PropertyChanged}" />
IsEnabled="{Binding ViewModel.CanShareEdit, UpdateSourceTrigger=PropertyChanged}" />-->
<Label Grid.Row="5" Grid.Column="0">Favorit</Label>
<dxe:CheckEdit
@@ -115,17 +124,17 @@ Grid.Column="2" Foreground="DarkGray" FontSize="10"
Orientation="Horizontal">
<Button
Width="100"
Command="{Binding CancelCommand}"
Command="ApplicationCommands.Close"
Visibility="Visible">
Abbrechen
</Button>
<Button
Width="100"
Command="{Binding AcceptCommand}"
Command="{Binding SaveCommand}"
Content="{Binding AcceptButtonText}"
Visibility="Visible" />
</StackPanel>
</Grid>
</Grid>
</UserControl>
</view:BeWoView>

View File

@@ -20,13 +20,29 @@ namespace BeWo.View.Detail.AI
/// <summary>
/// Interaktionslogik für AiPromptbausteinPromptView.xaml
/// </summary>
public partial class AiPromptbausteinPromptView : UserControl
{
public partial class AiPromptbausteinPromptView : BeWoView
{
public AiPromptbausteinPromptViewModel ViewModel
{
get => DataContext as AiPromptbausteinPromptViewModel;
set => DataContext = value;
}
public AiPromptbausteinPromptView(AiPromptbausteinPromptViewModel vm)
{
InitializeComponent();
DataContext = vm;
ViewModel = vm;
}
public override bool IsDirty
{
get => ViewModel?.ViewModel?.IsDirty ?? false;
}
protected override void Save()
{
ViewModel.SaveCommand.Execute(null);
}
}
}

View File

@@ -1,4 +1,4 @@
<UserControl
<view:BeWoView
x:Class="BeWo.View.Detail.AI.AiPromptbausteinPromptView2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -8,23 +8,29 @@
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:view="clr-namespace:BeWo.View"
xmlns:viewmodel="clr-namespace:BeWo.ViewModel.View.Administration"
x:Name="root"
Width="500"
Height="400"
Background="{StaticResource ObjectEditBackgroundBrush}">
Background="{StaticResource ObjectEditBackgroundBrush}"
Focusable="True">
<UserControl.InputBindings>
<KeyBinding Key="Esc" Command="ApplicationCommands.Close" />
</UserControl.InputBindings>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label" />
</ResourceDictionary>
</UserControl.Resources>
<Grid HorizontalAlignment="Stretch">
<Grid Margin="8,4,8,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" MinWidth="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="3*" MinWidth="100" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
@@ -51,6 +57,7 @@
Grid.Row="1"
Grid.Column="2"
MaxHeight="100"
Margin="3,6,3,6"
MaxLength="1024"
Style="{StaticResource TextBoxNotice}"
Text="{Binding PromptVM.Description, UpdateSourceTrigger=PropertyChanged, ElementName=root}"
@@ -74,23 +81,23 @@
<comboboxes:ComboBoxEmployeeSearch
Grid.Row="3"
Grid.Column="2"
Margin="3"
Margin="3,6,3,6"
IsEnabled="False"
SelectedCompactEmployeeDC="{Binding PromptVM.Creator, ElementName=root}" />
<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
<!--<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
<dxe:CheckEdit
Grid.Row="4"
Grid.Column="2"
Margin="3"
IsChecked="{Binding PromptVM.IsPublic, ElementName=root}"
IsEnabled="{Binding PromptVM.CanShareEdit, UpdateSourceTrigger=PropertyChanged, ElementName=root}" />
IsEnabled="{Binding PromptVM.CanShareEdit, UpdateSourceTrigger=PropertyChanged, ElementName=root}" />-->
<Label Grid.Row="5" Grid.Column="0">Favorit</Label>
<dxe:CheckEdit
Grid.Row="5"
Grid.Column="2"
Margin="3"
Margin="3,0,3,0"
IsChecked="{Binding PromptVM.IsFavorite, ElementName=root}"
IsEnabled="true" />
@@ -103,7 +110,7 @@
Orientation="Horizontal">
<Button
Width="100"
Command="{Binding CancelCommand, ElementName=root}"
Command="ApplicationCommands.Close"
Visibility="Collapsed">
Abbrechen
</Button>
@@ -116,5 +123,5 @@
</StackPanel>
</Grid>
</Grid>
</UserControl>
</view:BeWoView>

View File

@@ -21,7 +21,7 @@ namespace BeWo.View.Detail.AI
/// <summary>
/// Interaktionslogik für AiPromptbausteinPromptView.xaml
/// </summary>
public partial class AiPromptbausteinPromptView2 : UserControl
public partial class AiPromptbausteinPromptView2 : BeWoView
{
public static readonly DependencyProperty SaveCommandProperty =
DependencyProperty.Register("SaveCommand", typeof(ICommand), typeof(AiPromptbausteinPromptView2), new PropertyMetadata(null));

View File

@@ -0,0 +1,224 @@
<view:BeWoView
x:Class="BeWo.View.Detail.AI.AiPromptbausteinRoutineView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:comboboxes="clr-namespace:BeWo.View.Controls.ComboBoxes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:BeWo.View.Detail.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:shared="clr-namespace:BS.Shared;assembly=BS.Shared"
xmlns:view="clr-namespace:BeWo.View"
xmlns:viewmodel="clr-namespace:BeWo.ViewModel.View.Administration"
d:DataContext="{d:DesignInstance Type=viewmodel:AiPromptbausteinRoutineViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
Background="{StaticResource ObjectEditBackgroundBrush}"
Focusable="True"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label" />
<Style BasedOn="{StaticResource PopupBlackRadioButton}" TargetType="RadioButton" />
</ResourceDictionary>
</UserControl.Resources>
<Grid HorizontalAlignment="Stretch">
<Grid Margin="8,4,8,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" MinWidth="80" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="3*" MinWidth="100" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0">Name</Label>
<TextBox
Grid.Row="0"
Grid.Column="2"
Text="{Binding ViewModel.Title, UpdateSourceTrigger=PropertyChanged}" />
<Label
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Right"
Content="Beschreibung" />
<TextBox
Grid.Row="1"
Grid.Column="2"
MaxHeight="100"
Margin="3,6,3,3"
MaxLength="1024"
Style="{StaticResource TextBoxNotice}"
Text="{Binding ViewModel.Description, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label
Grid.Row="2"
Grid.Column="0"
Content="Kontext-Eingabe-Typ" />
<StackPanel
Grid.Row="2"
Grid.Column="2"
Margin="3,3"
Orientation="Horizontal">
<RadioButton IsChecked="{Binding ViewModel.RoutineType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static shared:AiRoutineType.Chain}}">Kette</RadioButton>
<RadioButton IsChecked="{Binding ViewModel.RoutineType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static shared:AiRoutineType.Stack}}">Stapel</RadioButton>
</StackPanel>
<Label
Grid.Row="3"
Grid.Column="0"
Content="Promptbausteine" />
<ListBox
x:Name="steps"
Grid.Row="3"
Grid.Column="2"
Margin="3"
HorizontalContentAlignment="Center"
ItemsSource="{Binding ViewModel.Steps.VMList}"
SelectedItem="{Binding SelectedStep}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="3" Orientation="Horizontal">
<!--<TextBlock
x:Name="arrow"
Margin="3"
VerticalAlignment="Center"
Text="&#x2794;" />-->
<Border
x:Name="border1"
Height="19"
Margin="0"
Padding="3"
HorizontalAlignment="Left"
Background="DarkGray"
CornerRadius="7">
<TextBlock
Margin="3,0,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Text="{Binding PromptReference.Title, StringFormat={}✦ {0}}"
TextWrapping="Wrap" />
</Border>
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsValid}" Value="false">
<Setter TargetName="border1" Property="Background" Value="LightCoral" />
</DataTrigger>
</DataTemplate.Triggers>
<!--<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
<Setter TargetName="arrow" Property="Visibility" Value="Collapsed" />
</DataTrigger>
</DataTemplate.Triggers>-->
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<StackPanel
Grid.Row="4"
Grid.Column="2"
Margin="0,0,0,3"
HorizontalAlignment="Center"
Orientation="Horizontal">
<StackPanel.Resources>
<ResourceDictionary>
<Style BasedOn="{StaticResource PrimaryButton}" TargetType="Button">
<Setter Property="Width" Value="24" />
</Style>
</ResourceDictionary>
</StackPanel.Resources>
<Button Click="Button_Plus_Click">+</Button>
<Button Command="{Binding DeleteStepCommand}" CommandParameter="{Binding SelectedStep}">
-
</Button>
<Button
Margin="9,3,3,3"
Command="{Binding MoveStepUpCommand}"
CommandParameter="{Binding SelectedStep}">
<Path
Width="8"
Data="{StaticResource Lucide.ChevronUp}"
Fill="White"
Stretch="Uniform" />
</Button>
<Button Command="{Binding MoveStepDownCommand}" CommandParameter="{Binding SelectedStep}">
<Path
Width="8"
Data="{StaticResource Lucide.ChevronDown}"
Fill="White"
Stretch="Uniform" />
</Button>
<Popup
x:Name="myPopup"
Width="600"
Height="400"
Placement="Top"
PlacementTarget="{Binding ElementName=myButton}"
StaysOpen="False">
<Border
x:Name="myPopupBorder"
BorderBrush="Black"
BorderThickness="1">
<TextBlock Text="Ich bin ein Popup!" />
</Border>
</Popup>
</StackPanel>
<Label
Grid.Row="5"
Grid.Column="0"
Content="Ersteller" />
<comboboxes:ComboBoxEmployeeSearch
Grid.Row="5"
Grid.Column="2"
Margin="3"
IsEnabled="False"
SelectedCompactEmployeeDC="{Binding ViewModel.Creator}" />
<!--<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
<dxe:CheckEdit
Grid.Row="4"
Grid.Column="2"
Margin="3"
IsChecked="{Binding ViewModel.IsPublic}"
IsEnabled="{Binding ViewModel.CanShareEdit, UpdateSourceTrigger=PropertyChanged}" />-->
<Label Grid.Row="6" Grid.Column="0">Favorit</Label>
<dxe:CheckEdit
Grid.Row="6"
Grid.Column="2"
Margin="3"
IsChecked="{Binding ViewModel.IsFavorite}"
IsEnabled="true" />
<StackPanel
Grid.Row="7"
Grid.ColumnSpan="3"
Margin="0,19,0,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button Width="100" Command="ApplicationCommands.Close">
Abbrechen
</Button>
<Button
Width="100"
Command="{Binding SaveCommand}"
Content="{Binding AcceptButtonText}"
Visibility="Visible" />
</StackPanel>
</Grid>
</Grid>
</view:BeWoView>

View File

@@ -0,0 +1,89 @@
using BeWo.ViewModel;
using BeWo.ViewModel.ListViewModel;
using BeWo.ViewModel.View.Administration;
using BeWo.ViewModel.View.AI;
using BS.Shared.DataContracts.Feature.AI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BeWo.View.Detail.AI
{
/// <summary>
/// Interaktionslogik für AiPromptbausteinRoutineView.xaml
/// </summary>
public partial class AiPromptbausteinRoutineView : BeWoView
{
public AiPromptbausteinRoutineViewModel ViewModel
{
get => DataContext as AiPromptbausteinRoutineViewModel;
set => DataContext = value;
}
public AiPromptbausteinRoutineView(AiPromptbausteinRoutineViewModel viewmodel)
{
InitializeComponent();
ViewModel = viewmodel;
var viewmodel2 = new AiPromptbausteinSelectionComplexViewModel(ViewModel.ViewModel.ActionType, ViewModel.FolderListVM, false, false);
var control = new AiPromptbausteinComplexSelectionView(viewmodel2);
viewmodel2.ItemAccepted += (s, e) =>
{
if (e is null)
return;
if (e is AiPromptbausteinRoutineVM)
{
MessageBox.Show("Es können keine Routinen hinzugefügt werden.");
return;
}
var prompt = e as AiPromptbausteinPromptVM;
if (prompt.DataContract.Version is null)
{
MessageBox.Show("Es können keine Promptbausteine hinzugefügt werden, die noch nicht gespeichert wurden. Speichern Sie bitte zuvor.");
return;
}
var step = new AiPromptbausteinRoutineStepDC();
step.ReferencePrompt = prompt.DataContract;
step.ReferenceVersion = prompt.DataContract.Version.Value;
step.IsValid = true;
var step_vm = new AiPromptbausteinRoutineStepVM(step);
ViewModel.ViewModel.Steps.VMList.Add(step_vm);
myPopup.IsOpen = false;
};
myPopupBorder.Child = control;
}
private void Button_Plus_Click(object sender, RoutedEventArgs e)
{
myPopup.IsOpen = true;
}
public override bool IsDirty
{
get => ViewModel?.ViewModel?.IsDirty ?? false;
}
protected override void Save()
{
ViewModel.SaveCommand.Execute(null);
}
}
}

View File

@@ -230,7 +230,7 @@ namespace BeWo.View.Detail.Accounting
var dialog = new GkvAbrechnungDialogViewModel(vm);
dialog.RequestClose += (s, ee) => Detail_Window_Closing(s, new CancelEventArgs());
dialog.RequestCloseFinal += (s, ee) => Detail_Window_Closing(s, new CancelEventArgs());
BeWoApp.MainControl.WindowService.ShowGkvAbrechnungDetailWindow(dialog);
}

View File

@@ -292,8 +292,6 @@ namespace BeWo.View.Detail
#endif
}
public DelegateCommand OpenAiWindowCommand { get; }
public Dictionary<TableID, long[]> GetVisibleInformationReferences()
{
var visible = ViewModel;
@@ -310,20 +308,21 @@ namespace BeWo.View.Detail
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var customer_oid = ViewModel.DataContract.CustomerOid;
var context = GetVisibleInformationReferences();
// private AiConversationChatViewModel getAiConversationChatViewModel()
// {
// throw new NotImplementedException();
// //var customer_oid = ViewModel.DataContract.CustomerOid;
// //var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerDetail, context, customer_oid);
// // var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerDetail, context, customer_oid);
return vm;
}
// // return vm;
//}
private void OpenAiWindow()
{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
}
//private void OpenAiWindow()
//{
// MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
//}
void Image_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
{

View File

@@ -1,114 +1,211 @@
<localView:BeWoView x:Class="BeWo.View.Detail.SendMailView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:localView="clr-namespace:BeWo.View" xmlns:val="clr-namespace:BeWo.Validation" xmlns:proxy="clr-namespace:BeWo.ServiceProxy" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" xmlns:s="clr-namespace:System;assembly=mscorlib" VerticalAlignment="Stretch" Focusable="True" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:localSearchView="clr-namespace:BeWo.View.Search">
<localView:BeWoView.Resources>
<Style x:Key="ButtonFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="WarningButton" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Image Width="16" Height="16" Source="..\..\Ressources\Icons\warning-16x16.png" />
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true" />
<Trigger Property="ToggleButton.IsChecked" Value="true" />
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#ADADAD" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<localView:BeWoView
x:Class="BeWo.View.Detail.SendMailView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:localSearchView="clr-namespace:BeWo.View.Search"
xmlns:localView="clr-namespace:BeWo.View"
xmlns:proxy="clr-namespace:BeWo.ServiceProxy"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:val="clr-namespace:BeWo.Validation"
Width="Auto"
Height="Auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Focusable="True">
<localView:BeWoView.Resources>
<Style x:Key="ButtonFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle
Margin="2"
SnapsToDevicePixels="true"
Stroke="Black"
StrokeDashArray="1 2"
StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="WarningButton" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Image
Width="16"
Height="16"
Source="..\..\Ressources\Icons\warning-16x16.png" />
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true" />
<Trigger Property="ToggleButton.IsChecked" Value="true" />
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#ADADAD" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</localView:BeWoView.Resources>
<Grid Width="Auto" Height="Auto">
<!--uc:ShadowChrome-->
<GroupBox Style="{StaticResource PopUpWindowStyle}">
<GroupBox.Header>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,0">
<Image Source="..\..\Ressources\Icons\Email.png" RenderTransformOrigin="0.5,0.5" Width="Auto" Height="28" Margin="0,0,0,0">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
<SkewTransform AngleX="0" AngleY="0" />
<RotateTransform Angle="0" />
<TranslateTransform X="0" Y="0" />
</TransformGroup>
</Image.RenderTransform>
</Image>
<TextBox Text="Mail senden" Margin="10,4,0,0" Background="{x:Null}" Foreground="{DynamicResource MainGroupBoxForegroundBrush}" FontSize="20" BorderBrush="{x:Null}" VerticalAlignment="Stretch" BorderThickness="0,0,0,0" Padding="0,0,0,0" />
</StackPanel>
</GroupBox.Header>
<Grid Margin="0,3,0,0" Background="{StaticResource ObjectEditBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Fill="{DynamicResource ServiceRecordContentBrush}" Height="6" />
<Grid x:Name="rootGrid" Grid.Row="1" Margin="10,10,10,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
</localView:BeWoView.Resources>
<Grid Width="Auto" Height="Auto">
<!-- uc:ShadowChrome -->
<GroupBox Style="{StaticResource PopUpWindowStyle}">
<GroupBox.Header>
<StackPanel
Margin="0,0,0,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Image
Width="Auto"
Height="28"
Margin="0,0,0,0"
RenderTransformOrigin="0.5,0.5"
Source="..\..\Ressources\Icons\Email.png">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
<SkewTransform AngleX="0" AngleY="0" />
<RotateTransform Angle="0" />
<TranslateTransform X="0" Y="0" />
</TransformGroup>
</Image.RenderTransform>
</Image>
<TextBox
Margin="10,4,0,0"
Padding="0,0,0,0"
VerticalAlignment="Stretch"
Background="{x:Null}"
BorderBrush="{x:Null}"
BorderThickness="0,0,0,0"
FontSize="20"
Foreground="{DynamicResource MainGroupBoxForegroundBrush}"
Text="Mail senden" />
</StackPanel>
</GroupBox.Header>
<Grid Margin="0,3,0,0" Background="{StaticResource ObjectEditBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Height="6" Fill="{DynamicResource ServiceRecordContentBrush}" />
<Grid
x:Name="rootGrid"
Grid.Row="1"
Margin="10,10,10,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--<Label Content="An:" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0" Margin="0 0 0 10" />-->
<Button Content="An:" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0" Margin="0 0 0 10" Click="AddButton_Click" />
<!--<TextBox x:Name="receiverTextBox" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" PreviewKeyDown="receiverTextBox_KeyDown"/>-->
<WrapPanel Name="receiverWrapPanel" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" />
<!--<Button Content="Hinzufügen" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="0" Margin="10,0,0,0" Click="AddButton_Click"/>-->
<!--<Label Content="An:" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0" Margin="0 0 0 10" />-->
<Button
Grid.Row="0"
Grid.Column="0"
Margin="0,0,0,10"
HorizontalAlignment="Left"
Click="AddButton_Click"
Content="An:" />
<!--<TextBox x:Name="receiverTextBox" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" PreviewKeyDown="receiverTextBox_KeyDown"/>-->
<WrapPanel
Name="receiverWrapPanel"
Grid.Row="0"
Grid.Column="1"
VerticalAlignment="Stretch" />
<!--<Button Content="Hinzufügen" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="0" Margin="10,0,0,0" Click="AddButton_Click"/>-->
<!--<uc:PopUpEdit Margin="3" Grid.Column="3" DeleteButtonVisibility="Collapsed" HorizontalAlignment="Stretch" IsReadOnly="True" Name="popupedit_employee" PopUpClick="popupedit_employee_PopUpClick" />-->
<!--<uc:PopUpEdit Margin="3" Grid.Column="3" DeleteButtonVisibility="Collapsed" HorizontalAlignment="Stretch" IsReadOnly="True" Name="popupedit_employee" PopUpClick="popupedit_employee_PopUpClick" />-->
<Label Content="Betreff:" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="1" />
<TextBox x:Name="subjectTextBox" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="1" />
<Label
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Left"
Content="Betreff:" />
<TextBox
x:Name="subjectTextBox"
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Stretch" />
</Grid>
<WrapPanel Margin="0 10 0 10">
<RadioButton GroupName="priorityGroup" IsChecked="False" Name="lowPriorityRadioButton">Nidrige Priorität</RadioButton>
<RadioButton GroupName="priorityGroup" IsChecked="True" Name="normalPriorityRadioButton" Margin="10 0 10 0">Normale Priorität</RadioButton>
<RadioButton GroupName="priorityGroup" IsChecked="False" Name="highPriorityRadioButton">Hohe Priorität</RadioButton>
</WrapPanel>
</Grid>
<WrapPanel Margin="0,10,0,10">
<RadioButton
Name="lowPriorityRadioButton"
GroupName="priorityGroup"
IsChecked="False">
Nidrige Priorität
</RadioButton>
<RadioButton
Name="normalPriorityRadioButton"
Margin="10,0,10,0"
GroupName="priorityGroup"
IsChecked="True">
Normale Priorität
</RadioButton>
<RadioButton
Name="highPriorityRadioButton"
GroupName="priorityGroup"
IsChecked="False">
Hohe Priorität
</RadioButton>
</WrapPanel>
</StackPanel>
</StackPanel>
<Popup Margin="10" Grid.Row="2" Name="popup_employee" StaysOpen="False" Placement="MousePoint" Width="370" Height="250" Closed="popup_Closed" Opened="popup_Opened">
<localSearchView:EmployeeSearchView ItemSelected="EmployeeSearchView_EmployeeSelected" />
</Popup>
<Popup
Name="popup_employee"
Grid.Row="2"
Width="370"
Height="250"
Margin="10"
Closed="popup_Closed"
Opened="popup_Opened"
Placement="MousePoint"
StaysOpen="False">
<localSearchView:EmployeeSearchView ItemSelected="EmployeeSearchView_EmployeeSelected" />
</Popup>
<TextBox Grid.Row="1" HorizontalAlignment="Stretch" x:Name="mailTextBox" VerticalAlignment="Stretch" AcceptsReturn="True" AcceptsTab="True" />
<TextBox
x:Name="mailTextBox"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
AcceptsReturn="True"
AcceptsTab="True" />
<GroupBox Padding="7" Style="{StaticResource ObjectEditGroupBox}" Header="Anhang Hinzufügen" Grid.Row="2">
<!--<Grid>
<GroupBox
Grid.Row="2"
Padding="7"
Header="Anhang Hinzufügen"
Style="{StaticResource ObjectEditGroupBox}">
<!--<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
@@ -131,64 +228,124 @@
<ListBox VerticalAlignment="Bottom" Height="48" IsSynchronizedWithCurrentItem="True" Name="attachmentList" Grid.Row="2" Grid.ColumnSpan="5"/>
</Grid>-->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Datei" />
<uc:PopUpEdit IsReadOnly="True" Name="popupedit_file" Grid.Row="0" Grid.Column="1" Margin="3" Height="23" DeleteButtonVisibility="Collapsed" PopUpClick="popupedit_file_PopUpClick" />
<Label
Grid.Row="0"
Grid.Column="0"
Content="Datei" />
<uc:PopUpEdit
Name="popupedit_file"
Grid.Row="0"
Grid.Column="1"
Height="23"
Margin="3"
DeleteButtonVisibility="Collapsed"
IsReadOnly="True"
PopUpClick="popupedit_file_PopUpClick" />
<Label Grid.Row="1" Grid.Column="0" Content="Beschreibung" />
<TextBox Name="fileNoticeTextbox" Margin="3" Height="23" Grid.Row="1" Grid.Column="1" />
<Label
Grid.Row="1"
Grid.Column="0"
Content="Beschreibung" />
<TextBox
Name="fileNoticeTextbox"
Grid.Row="1"
Grid.Column="1"
Height="23"
Margin="3" />
<Grid Grid.Row="2" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button HorizontalAlignment="Left" Name="button_uploadDocument" Margin="3" Height="25" Grid.Column="0" Click="button_uploadDocument_Click" Content="Datei hinzufügen" />
<Button HorizontalAlignment="Left" Name="button_removeAttachment" Margin="3" Height="25" Grid.Column="1" Click="button_removeAttachment_Click" Content="Anhang entfernen" />
</Grid>
</Grid>
<Grid Grid.Row="2" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Name="button_uploadDocument"
Grid.Column="0"
Height="25"
Margin="3"
HorizontalAlignment="Left"
Click="button_uploadDocument_Click"
Content="Datei hinzufügen" />
<Button
Name="button_removeAttachment"
Grid.Column="1"
Height="25"
Margin="3"
HorizontalAlignment="Left"
Click="button_removeAttachment_Click"
Content="Anhang entfernen" />
</Grid>
</Grid>
<ListBox MinWidth="128" IsSynchronizedWithCurrentItem="True" Name="attachmentList" Grid.Column="1" />
<ListBox
Name="attachmentList"
Grid.Column="1"
MinWidth="128"
IsSynchronizedWithCurrentItem="True" />
</Grid>
</Grid>
</GroupBox>
</Grid>
</GroupBox>
</Grid>
</Grid>
<Border Grid.Row="2" Grid.ColumnSpan="3" Height="40" Margin="0,10,0,0" VerticalAlignment="Stretch" Background="#FF000000">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#19000000" Offset="0" />
<GradientStop Color="#33FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.OpacityMask>
</Grid>
<Border
Grid.Row="2"
Grid.ColumnSpan="3"
Height="40"
Margin="0,10,0,0"
VerticalAlignment="Stretch"
Background="#FF000000">
<Border.OpacityMask>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0" Color="#19000000" />
<GradientStop Offset="1" Color="#33FFFFFF" />
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
<StackPanel Grid.ColumnSpan="3" Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Height="Auto" Margin="5,10,0,0" HorizontalAlignment="Right">
<Button x:Name="btnSave" Content="Senden und schließen" Margin="0,0,3,0" Command="ApplicationCommands.Save" Height="25" />
<Button x:Name="btnClose" Content="Abbrechen" Margin="0,0,3,0" Command="ApplicationCommands.Close" Height="25" />
</StackPanel>
</Grid>
</GroupBox>
</Border>
<StackPanel
Grid.Row="2"
Grid.ColumnSpan="3"
Height="Auto"
Margin="5,10,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
x:Name="btnSave"
Height="25"
Margin="0,0,3,0"
Command="ApplicationCommands.Save"
Content="Senden und schließen" />
<Button
x:Name="btnClose"
Height="25"
Margin="0,0,3,0"
Command="ApplicationCommands.Close"
Content="Abbrechen" />
</StackPanel>
</Grid>
</GroupBox>
<!--/uc:ShadowChrome-->
</Grid>
<!-- /uc:ShadowChrome -->
</Grid>
</localView:BeWoView>

View File

@@ -1,130 +1,215 @@
<localView:BeWoView x:Class="BeWo.View.Detail.ViewMailView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:localView="clr-namespace:BeWo.View" xmlns:val="clr-namespace:BeWo.Validation" xmlns:proxy="clr-namespace:BeWo.ServiceProxy" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" xmlns:s="clr-namespace:System;assembly=mscorlib" VerticalAlignment="Stretch" Focusable="True" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:localSearchView="clr-namespace:BeWo.View.Search">
<localView:BeWoView.Resources>
<Style x:Key="ButtonFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="WarningButton" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Image Width="16" Height="16" Source="..\..\Ressources\Icons\warning-16x16.png" />
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true" />
<Trigger Property="ToggleButton.IsChecked" Value="true" />
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#ADADAD" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<localView:BeWoView
x:Class="BeWo.View.Detail.ViewMailView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:localSearchView="clr-namespace:BeWo.View.Search"
xmlns:localView="clr-namespace:BeWo.View"
xmlns:proxy="clr-namespace:BeWo.ServiceProxy"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:val="clr-namespace:BeWo.Validation"
Width="Auto"
Height="Auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Focusable="True">
<localView:BeWoView.Resources>
<Style x:Key="ButtonFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle
Margin="2"
SnapsToDevicePixels="true"
Stroke="Black"
StrokeDashArray="1 2"
StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="WarningButton" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Image
Width="16"
Height="16"
Source="..\..\Ressources\Icons\warning-16x16.png" />
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true" />
<Trigger Property="ToggleButton.IsChecked" Value="true" />
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#ADADAD" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</localView:BeWoView.Resources>
<Grid Width="Auto" Height="Auto">
<!--uc:ShadowChrome-->
<GroupBox Style="{StaticResource PopUpWindowStyle}">
<GroupBox.Header>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,0">
<Image Source="..\..\Ressources\Icons\Email.png" RenderTransformOrigin="0.5,0.5" Width="Auto" Height="28" Margin="0,0,0,0">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
<SkewTransform AngleX="0" AngleY="0" />
<RotateTransform Angle="0" />
<TranslateTransform X="0" Y="0" />
</TransformGroup>
</Image.RenderTransform>
</Image>
<TextBox Text="Mail-Ansicht" Margin="10,5,0,0" Background="{x:Null}" Foreground="{DynamicResource MainGroupBoxForegroundBrush}" FontSize="20" BorderBrush="{x:Null}" VerticalAlignment="Stretch" BorderThickness="0,0,0,0" Padding="0,0,0,0" />
</StackPanel>
</GroupBox.Header>
<Grid Margin="0,3,0,0" Background="{StaticResource ObjectEditBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Fill="{DynamicResource ServiceRecordContentBrush}" Height="6" />
<Grid x:Name="rootGrid" Grid.Row="1" Margin="10,10,10,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
</localView:BeWoView.Resources>
<Grid Width="Auto" Height="Auto">
<!-- uc:ShadowChrome -->
<GroupBox Style="{StaticResource PopUpWindowStyle}">
<GroupBox.Header>
<StackPanel
Margin="0,0,0,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Image
Width="Auto"
Height="28"
Margin="0,0,0,0"
RenderTransformOrigin="0.5,0.5"
Source="..\..\Ressources\Icons\Email.png">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
<SkewTransform AngleX="0" AngleY="0" />
<RotateTransform Angle="0" />
<TranslateTransform X="0" Y="0" />
</TransformGroup>
</Image.RenderTransform>
</Image>
<TextBox
Margin="10,5,0,0"
Padding="0,0,0,0"
VerticalAlignment="Stretch"
Background="{x:Null}"
BorderBrush="{x:Null}"
BorderThickness="0,0,0,0"
FontSize="20"
Foreground="{DynamicResource MainGroupBoxForegroundBrush}"
Text="Mail-Ansicht" />
</StackPanel>
</GroupBox.Header>
<Grid Margin="0,3,0,0" Background="{StaticResource ObjectEditBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Height="6" Fill="{DynamicResource ServiceRecordContentBrush}" />
<Grid
x:Name="rootGrid"
Grid.Row="1"
Margin="10,10,10,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Von:" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0" />
<TextBox x:Name="senderTextBox" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" IsReadOnly="True" />
<!--<Button Content="Hinzufügen" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="0" Margin="10,0,0,0" Click="AddButton_Click"/>-->
<Label
Grid.Row="0"
Grid.Column="0"
HorizontalAlignment="Left"
Content="Von:" />
<TextBox
x:Name="senderTextBox"
Grid.Row="0"
Grid.Column="1"
VerticalAlignment="Stretch"
IsReadOnly="True" />
<!--<Button Content="Hinzufügen" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="0" Margin="10,0,0,0" Click="AddButton_Click"/>-->
<Label Content="Betreff:" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="1" />
<TextBox x:Name="subjectTextBox" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="1" IsReadOnly="True" />
<Label
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Left"
Content="Betreff:" />
<TextBox
x:Name="subjectTextBox"
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Stretch"
IsReadOnly="True" />
</Grid>
<!--<WrapPanel Margin="0 10 0 10">
</Grid>
<!--<WrapPanel Margin="0 10 0 10">
<RadioButton GroupName="priorityGroup" IsChecked="False" Name="lowPriorityRadioButton">Nidrige Priorität</RadioButton>
<RadioButton GroupName="priorityGroup" IsChecked="True" Name="normalPriorityRadioButton" Margin="10 0 10 0">Normale Priorität</RadioButton>
<RadioButton GroupName="priorityGroup" IsChecked="False" Name="highPriorityRadioButton">Hohe Priorität</RadioButton>
</WrapPanel>-->
<Label Margin="0 10 0 10" Name="priorityLabel" />
<Label Name="priorityLabel" Margin="0,10,0,10" />
</StackPanel>
</StackPanel>
<TextBox Grid.Row="1" HorizontalAlignment="Stretch" x:Name="mailTextBox" VerticalAlignment="Stretch" IsReadOnly="True" />
<TextBox
x:Name="mailTextBox"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsReadOnly="True" />
<!--<TextBox Grid.Row="2" x:Name="attachmentTextBox" IsReadOnly="True"/>-->
<WrapPanel Grid.Row="2" x:Name="attachmentWrapPanel">
<Label Margin="0 5 5 0">Anhänge:</Label>
</WrapPanel>
</Grid>
<!--<TextBox Grid.Row="2" x:Name="attachmentTextBox" IsReadOnly="True"/>-->
<WrapPanel x:Name="attachmentWrapPanel" Grid.Row="2">
<Label Margin="0,5,5,0">Anhänge:</Label>
</WrapPanel>
</Grid>
</Grid>
<Border Grid.Row="2" Grid.ColumnSpan="3" Height="40" Margin="0,10,0,0" VerticalAlignment="Stretch" Background="#FF000000">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#19000000" Offset="0" />
<GradientStop Color="#33FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.OpacityMask>
</Grid>
<Border
Grid.Row="2"
Grid.ColumnSpan="3"
Height="40"
Margin="0,10,0,0"
VerticalAlignment="Stretch"
Background="#FF000000">
<Border.OpacityMask>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0" Color="#19000000" />
<GradientStop Offset="1" Color="#33FFFFFF" />
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
<StackPanel Grid.ColumnSpan="3" Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Height="Auto" Margin="5,10,0,0" HorizontalAlignment="Right">
<!--<Button x:Name="btnSave" Content="Senden und schließen" Margin="0,0,3,0" Command="ApplicationCommands.Save" Height="25" />-->
<Button x:Name="btnClose" Content="Schließen" Margin="0,0,3,0" Command="ApplicationCommands.Close" Height="25" />
</StackPanel>
</Grid>
</GroupBox>
</Border>
<StackPanel
Grid.Row="2"
Grid.ColumnSpan="3"
Height="Auto"
Margin="5,10,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<!--<Button x:Name="btnSave" Content="Senden und schließen" Margin="0,0,3,0" Command="ApplicationCommands.Save" Height="25" />-->
<Button
x:Name="btnClose"
Height="25"
Margin="0,0,3,0"
Command="ApplicationCommands.Close"
Content="Schließen" />
</StackPanel>
</Grid>
</GroupBox>
<!--/uc:ShadowChrome-->
</Grid>
<!-- /uc:ShadowChrome -->
</Grid>
</localView:BeWoView>

View File

@@ -2,6 +2,7 @@
x:Class="BeWo.View.Detail.Zeiterfassung.ServiceRecordEditView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ai="clr-namespace:BeWo.View.Controls.AI"
xmlns:core="clr-namespace:BS.Shared.Core;assembly=BS.Shared"
xmlns:detail="clr-namespace:BeWo.View.Detail"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
@@ -16,7 +17,6 @@
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:val="clr-namespace:BeWo.Validation"
xmlns:zeit="clr-namespace:BeWo.View.Detail.Zeiterfassung"
xmlns:ai="clr-namespace:BeWo.View.Controls.AI"
x:Name="root"
Width="Auto"
Height="Auto"
@@ -1508,12 +1508,11 @@
<StackPanel
x:Name="stackpanel_ai"
Grid.Row="1"
Grid.ColumnSpan="2"
Grid.ColumnSpan="2"
Margin="3,3,3,6"
HorizontalAlignment="Right"
DataContext=""
Orientation="Horizontal"
Visibility="{Binding IsAiDocuButtonVisible, Converter={StaticResource BoolVisibilityConverter}}">
Orientation="Horizontal">
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@@ -1521,25 +1520,10 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</StackPanel.Resources>
<Button
x:Name="btn_AiPromptbausteinUndo"
Margin="3,0,0,0"
Command="{Binding UndoEditAiActionCommand}"
Style="{StaticResource ButtonPreviousStyle}"
Visibility="{Binding IsEditUndoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
<Button
x:Name="btn_AiPromptbausteinRedo"
Margin="3,0,3,0"
Command="{Binding RedoEditAiActionCommand}"
Style="{StaticResource ButtonRedoStyle}"
Visibility="{Binding IsEditRedoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
<ai:AiPromptbausteinButton
Margin="3,0,0,0"
x:Name="btn_AiPromptbaustein"
ActionType="ServiceRecordDocumentation"
CanExecute="{Binding EditVM.Notice, Converter={StaticResource StringEmptyBoolConverter}}"
PromptAccepted="btn_AiPromptbaustein_PromptAccepted" />
<ai:AiChatButton
x:Name="btn_ai_docu"
AiChatButtonOrientation="Right"
DataContext="{Binding Path=AiChatButtonDocumentationEditViewModel}" />
</StackPanel>

View File

@@ -26,6 +26,7 @@ using DevExpress.Xpf.Editors;
using DevExpress.Xpf.RichEdit;
using SupportConceptService = BeWo.Core.Service.SupportConceptService;
using System.Windows.Media;
using BeWo.ViewModel.Controls.AI;
namespace BeWo.View.Detail.Zeiterfassung
{
@@ -1169,9 +1170,9 @@ namespace BeWo.View.Detail.Zeiterfassung
}
}
private void btn_AiPromptbaustein_PromptAccepted(object sender, AiPromptbausteinPromptVM e)
{
ViewModel.EditPromptAccepted(sender, e);
}
public void SetAiViewmodel(AiChatButtonWithHistoryViewModel aiChatButtonWithHistoryView)
{
btn_ai_docu.DataContext = aiChatButtonWithHistoryView;
}
}
}

View File

@@ -1707,7 +1707,7 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</StackPanel.Resources>
<StackPanel
<!--<StackPanel
HorizontalAlignment="Right"
Orientation="Horizontal"
Visibility="{Binding IsAiDocuButtonVisible, Converter={StaticResource BoolVisibilityConverter}}">
@@ -1729,8 +1729,12 @@
Margin="3,0,0,0"
ActionType="ServiceRecordDocumentation"
CanExecute="{Binding PrototypeVM.Notice, Converter={StaticResource StringEmptyBoolConverter}}"
PromptAccepted="btn_AiPromptbaustein2_PromptAccepted" />
</StackPanel>
ItemAccepted="btn_AiPromptbaustein2_ItemAccepted" />-->
<ai:AiChatButton
x:Name="btn_ai_docu"
AiChatButtonOrientation="Right"
DataContext="{Binding AiChatButtonDocumentationViewModel}" />
<!--</StackPanel>-->
<ai1:VoiceToTextButtonControl Margin="6,0,0,0" TargetTextBox="{Binding ElementName=dokumentationsTextBox}" />
@@ -1779,11 +1783,11 @@
<TextBox.InputBindings>
<KeyBinding
Key="Z"
Command="{Binding UndoAiActionCommand}"
Command="{Binding AiChatButtonDocumentationViewModel.UndoAiActionCommand}"
Modifiers="Ctrl" />
<KeyBinding
Key="Y"
Command="{Binding RedoAiActionCommand}"
Command="{Binding AiChatButtonDocumentationViewModel.RedoAiActionCommand}"
Modifiers="Ctrl" />
</TextBox.InputBindings>
</TextBox>
@@ -3334,13 +3338,20 @@
Margin="0"
VerticalAlignment="Center"
Orientation="Horizontal">
<ai:AiConversationButton
<ai:AiChatButton x:Name="btn_ai_conv" DataContext="{Binding AiChatButtonConversationViewModel}">
<ai:AiChatButton.Resources>
<ResourceDictionary>
<Style BasedOn="{StaticResource NavigationToolbarButtonStyle}" TargetType="{x:Type Button}" />
</ResourceDictionary>
</ai:AiChatButton.Resources>
</ai:AiChatButton>
<!--<ai:AiConversationButton
x:Name="ai_conversation_btn"
Margin="10,0,0,0"
ActionType="ServiceRecordConversation"
ItemAccepted="ItemAccepted"
OpenAiWindowClick="AiConversationButton_OpenAiWindowClick"
PromptAccepted="PromptAccepted"
State="{Binding AiConversationButtonState}" />
State="{Binding AiConversationButtonState}" />-->
</StackPanel>
<StackPanel
Grid.Column="2"

View File

@@ -53,8 +53,9 @@ using DependencyObject = System.Windows.DependencyObject;
using BeWo.View.Windows;
using BeWo.Core.Commands;
using BeWo.ViewModel.View.AI;
using BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords;
using System.Text;
using BS.Shared.DataContracts.Feature.AI;
using System.Windows.Data;
namespace BeWo.View.Detail.Zeiterfassung
{
@@ -347,10 +348,11 @@ namespace BeWo.View.Detail.Zeiterfassung
srGridControl.FilterChanged += SrGridControl_FilterChanged;
srGridControl.ItemsSourceChanged += SrGridControl_ItemsSourceChanged;
}
public ICommand OpenAiWindowCommand { get; set; }
public ICommand OpenAiChatPromptWindowCommand { get; set; }
pViewModel.AiChatButtonConversationViewModel.GetAiVisualContext = () => getAiVisualContext();
pViewModel.AiChatButtonDocumentationViewModel.GetAiVisualContext = () => getAiVisualContext2();
pViewModel.AiChatButtonDocumentationEditViewModel.GetAiVisualContext = () => getAiVisualContext3();
}
private void SrGridControl_ItemsSourceChanged(object sender, DevExpress.Xpf.Grid.ItemsSourceChangedEventArgs e)
{
@@ -1180,18 +1182,22 @@ namespace BeWo.View.Detail.Zeiterfassung
BeWoView serviceRecordEditView;
if (vm.GroupOid != null)
ViewModel.AiChatButtonDocumentationEditViewModel.ClearHistory();
if (vm.GroupOid != null)
{
serviceRecordEditView = new ServiceRecordGroupEditView();
}
else
{
serviceRecordEditView = new ServiceRecordEditView();
}
var view = new ServiceRecordEditView();
ViewModel.ResetEditAiAction();
ViewModel.AiChatButtonDocumentationEditViewModel.CheckContextSize();
popup_content.Child = serviceRecordEditView;
serviceRecordEditView = view;
}
popup_content.Child = serviceRecordEditView;
double height = MainControl.ActualHeight * 0.8;
double width = 810;
@@ -2257,7 +2263,7 @@ namespace BeWo.View.Detail.Zeiterfassung
ComboBoxTreeViewControl.TreeViewSourceList = ViewModel.PrototypeVM.GoalTree;
}
ViewModel.ResetAiAction();
ViewModel.AiChatButtonDocumentationViewModel.ClearHistory();
}
return lValid;
@@ -5078,51 +5084,40 @@ namespace BeWo.View.Detail.Zeiterfassung
ComboBoxTreeViewControl.TreeViewSourceList = ViewModel.PrototypeVM.GoalTree;
}
private void AiConversationButton_OpenAiWindowClick(object sender, RoutedEventArgs e)
{
OpenAiWindow();
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
private AiViewContextDC getAiVisualContext()
{
var records = GetVisibleRecordVMs();
var context = ViewModel.GetVisibleInformationReferences(records);
var oid = supportConceptSelectionControl.SelectedItem.SupportConceptTreeNodeDC.SupportConcept.SupportConceptOid;
var canSendNewMessage = ViewModel.AiConversationButtonState == Controls.AI.AiConversationButtonState.Normal;
var oid = supportConceptSelectionControl.SelectedItem.SupportConceptTreeNodeDC.SupportConcept.SupportConceptOid;
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.ServiceRecord, context, oid, canSendNewMessage);
var dc = new AiViewContextDC()
{
Primary = oid,
References = context
};
return vm;
return dc;
}
private void OpenAiWindow()
private AiViewContextDC getAiVisualContext2()
{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
var context = getAiVisualContext();
context.Secondary = ViewModel.PrototypeVM.Notice;
return context;
}
private void PromptAccepted(object sender, AiPromptbausteinPromptVM prompt)
{
if (prompt is null)
throw new NotImplementedException();
private AiViewContextDC getAiVisualContext3()
{
var context = getAiVisualContext();
// 1. Information aufbereiten
// 1.1 Prompt
var prompt_oid = prompt.DataContract.Oid.Value;
var prompt_version = prompt.DataContract.Version;
context.Secondary = ViewModel.EditVM.Notice;
// 1.2 Restliche Informationen
var vm = getAiConversationChatViewModel();
return context;
}
// 2 Validieren
// 3 Auswerten
vm.MessageInput = prompt.Prompt;
vm.SendAfterLoaded = true;
MainControl.WindowService.ShowAiConversationWindow(vm);
}
private IEnumerable<ServiceRecordVM> GetVisibleRecordVMs()
private IEnumerable<ServiceRecordVM> GetVisibleRecordVMs()
{
var list = new List<ServiceRecordVM>();
@@ -5146,11 +5141,6 @@ namespace BeWo.View.Detail.Zeiterfassung
return list;
}
private void btn_AiPromptbaustein2_PromptAccepted(object sender, AiPromptbausteinPromptVM e)
{
ViewModel.PromptAccepted(sender, e);
}
}
//public class RowBackgroundHelper

View File

@@ -0,0 +1,60 @@
<view:BeWoView
x:Class="BeWo.View.Developer.DeveloperView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:developer="clr-namespace:BeWo.ViewModel.View.Developer"
xmlns:local="clr-namespace:BeWo.View.Developer"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:view="clr-namespace:BeWo.View"
d:DataContext="{d:DesignInstance Type=developer:DesignDeveloperViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<view:BeWoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource {x:Type Label}}" TargetType="Label">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Margin" Value="3,6" />
</Style>
</ResourceDictionary>
</view:BeWoView.Resources>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TabControl SelectedIndex="1">
<TabItem Header="Allgemein" />
<TabItem Header="WPF">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="45" />
<ColumnDefinition Width="90" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="45" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Column="1">KeyboardFocus:</Label>
<TextBox
Grid.Column="2"
IsReadOnly="True"
Text="{Binding KeyboardFocus}" />
<Label Grid.Row="1" Grid.Column="1">LogicalFocus:</Label>
<TextBox
Grid.Row="1"
Grid.Column="2"
IsReadOnly="True"
Text="{Binding LogicalFocus}" />
</Grid>
</TabItem>
<TabItem Header="Logs" />
<TabItem Header="Configs" />
</TabControl>
</Grid>
</view:BeWoView>

View File

@@ -0,0 +1,38 @@
using BeWo.ViewModel.View.Administration;
using BeWo.ViewModel.View.Developer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BeWo.View.Developer
{
/// <summary>
/// Interaktionslogik für DeveloperView.xaml
/// </summary>
public partial class DeveloperView : BeWoView
{
public DeveloperViewModel ViewModel
{
get => DataContext as DeveloperViewModel;
set => DataContext = value;
}
public DeveloperView(DeveloperViewModel viewModel)
{
InitializeComponent();
ViewModel = viewModel;
}
}
}

View File

@@ -1,19 +1,20 @@
<localView:BeWoView x:Class="BeWo.View.Document.SingleTemplateSelectionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:localView="clr-namespace:BeWo.View"
xmlns:localViewControls="clr-namespace:BeWo.View.Controls"
xmlns:localSearchView="clr-namespace:BeWo.View.Search"
xmlns:val="clr-namespace:BeWo.Validation"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:core="clr-namespace:BS.Shared.Core;assembly=BS.Shared"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxre="http://schemas.devexpress.com/winfx/2008/xaml/richedit"
xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
Focusable="True">
<localView:BeWoView
x:Class="BeWo.View.Document.SingleTemplateSelectionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="clr-namespace:BS.Shared.Core;assembly=BS.Shared"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
xmlns:dxre="http://schemas.devexpress.com/winfx/2008/xaml/richedit"
xmlns:localSearchView="clr-namespace:BeWo.View.Search"
xmlns:localView="clr-namespace:BeWo.View"
xmlns:localViewControls="clr-namespace:BeWo.View.Controls"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:val="clr-namespace:BeWo.Validation"
Focusable="True">
<Grid Background="{StaticResource ObjectEditBackgroundBrush}">
<Grid.ColumnDefinitions>
@@ -29,49 +30,125 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Margin="0,0,0,0" x:Name="lblTemplate" Content="Vorlage:"/>
<dxg:TreeListControl x:Name="treelistcontrol_template" Grid.Row="1" Grid.ColumnSpan="2" Margin="5,0,5,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<Label
x:Name="lblTemplate"
Margin="0,0,0,0"
Content="Vorlage:" />
<dxg:TreeListControl
x:Name="treelistcontrol_template"
Grid.Row="1"
Grid.ColumnSpan="2"
Margin="5,0,5,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<dxg:TreeListControl.Columns>
<dxg:TreeListColumn FieldName="Name" CellToolTipBinding="{Binding Description}"/>
<dxg:TreeListColumn FieldName="SortName" AllowSorting="True" SortIndex="0" SortOrder="Ascending" Visible="False"/>
<dxg:TreeListColumn CellToolTipBinding="{Binding Description}" FieldName="Name" />
<dxg:TreeListColumn
AllowSorting="True"
FieldName="SortName"
SortIndex="0"
SortOrder="Ascending"
Visible="False" />
</dxg:TreeListControl.Columns>
<dxg:TreeListControl.View>
<dxg:TreeListView x:Name="TreeView_template" ShowColumnHeaders="False" ShowIndicator="False" ShowHorizontalLines="False" ShowVerticalLines="False" AutoWidth="True"
AllowEditing="False" ShowNodeImages="True" PrintNodeImages="True" MouseDoubleClick="TreeView_template_MouseDoubleClick"
KeyFieldName="{Binding DocumentTreeItemVM.DocTreeItemOid}" ParentFieldName="Binding DocumentTreeItemVM.ParentOid">
</dxg:TreeListView>
<dxg:TreeListView
x:Name="TreeView_template"
AllowEditing="False"
AutoWidth="True"
KeyFieldName="{Binding DocumentTreeItemVM.DocTreeItemOid}"
MouseDoubleClick="TreeView_template_MouseDoubleClick"
ParentFieldName="Binding DocumentTreeItemVM.ParentOid"
PrintNodeImages="True"
ShowColumnHeaders="False"
ShowHorizontalLines="False"
ShowIndicator="False"
ShowNodeImages="True"
ShowVerticalLines="False" />
</dxg:TreeListControl.View>
</dxg:TreeListControl>
<!--<CheckBox x:Name="chkSaveDoc" Content="Dokument abspeichern" Grid.Row="2" Checked="CheckBox_Checked" Margin="5,8,0,0" Unchecked="CheckBox_Unchecked" />-->
<Label x:Name="lblFileName" Grid.Row="2" Margin="0,3,0,0" Content="Name:" />
<TextBox x:Name="txtFileName" Grid.Row="2" Grid.Column="1" Margin="3,3,0,0" HorizontalAlignment="Stretch"/>
<dxg:TreeListControl x:Name="treelistcontrol_folderStructureForSelection" Grid.Row="4" Grid.ColumnSpan="2" DefaultSorting="Name" Margin="5,5,5,0" VerticalAlignment="Stretch" Visibility="Visible">
<Label
x:Name="lblFileName"
Grid.Row="2"
Margin="0,3,0,0"
Content="Name:" />
<TextBox
x:Name="txtFileName"
Grid.Row="2"
Grid.Column="1"
Margin="3,3,0,0"
HorizontalAlignment="Stretch" />
<dxg:TreeListControl
x:Name="treelistcontrol_folderStructureForSelection"
Grid.Row="4"
Grid.ColumnSpan="2"
Margin="5,5,5,0"
VerticalAlignment="Stretch"
DefaultSorting="Name"
Visibility="Visible">
<dxg:TreeListControl.Columns>
<dxg:TreeListColumn FieldName="Name" AllowSorting="True"/>
<dxg:TreeListColumn AllowSorting="True" FieldName="Name" />
</dxg:TreeListControl.Columns>
<dxg:TreeListControl.View>
<dxg:TreeListView x:Name="TreeView_folderStructureForSelection" ShowColumnHeaders="False" ShowIndicator="False" ShowHorizontalLines="False" ShowVerticalLines="False" AutoWidth="True"
AllowEditing="False" ShowNodeImages="True" PrintNodeImages="True"
KeyFieldName="{Binding DocumentTreeItemVM.DocTreeItemOid}" ParentFieldName="Binding DocumentTreeItemVM.ParentOid">
</dxg:TreeListView>
<dxg:TreeListView
x:Name="TreeView_folderStructureForSelection"
AllowEditing="False"
AutoWidth="True"
KeyFieldName="{Binding DocumentTreeItemVM.DocTreeItemOid}"
ParentFieldName="Binding DocumentTreeItemVM.ParentOid"
PrintNodeImages="True"
ShowColumnHeaders="False"
ShowHorizontalLines="False"
ShowIndicator="False"
ShowNodeImages="True"
ShowVerticalLines="False" />
</dxg:TreeListControl.View>
</dxg:TreeListControl>
<WrapPanel Grid.Row="5" Grid.ColumnSpan="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0 5 5 5">
<Button Margin="10 0 0 0"
Name="button_aufklappenAllGoals" Click="button_aufklappenAll_Click"
HorizontalAlignment="Left">Alle aufklappen</Button>
<Button Margin="5 0 0 0"
Name="button_zuklappenAllGoals" Click="button_zuklappenAll_Click"
HorizontalAlignment="Left">Alle zuklappen</Button>
<WrapPanel
Grid.Row="5"
Grid.ColumnSpan="1"
Margin="0,5,5,5"
HorizontalAlignment="Left"
VerticalAlignment="Bottom">
<Button
Name="button_aufklappenAllGoals"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Click="button_aufklappenAll_Click">
Alle aufklappen
</Button>
<Button
Name="button_zuklappenAllGoals"
Margin="5,0,0,0"
HorizontalAlignment="Left"
Click="button_zuklappenAll_Click">
Alle zuklappen
</Button>
</WrapPanel>
<WrapPanel Grid.Row="5" Grid.Column="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0 5 5 5">
<Button x:Name="Button_SelectTemplate" Content="Dokument erstellen" Margin="0 0 5 0" Click="Button_CreateTemplateForSelection_Click" />
<Button x:Name="Button_SelectFolder" Content="Dokument speichern" Margin="0 0 5 0" Click="Button_SelectFolder_Click" />
<Button x:Name="Button_Cancel_OnlyOne" Content="Abbrechen" Click="Button_Cancel_Click" />
<WrapPanel
Grid.Row="5"
Grid.Column="1"
Margin="0,5,5,5"
HorizontalAlignment="Right"
VerticalAlignment="Bottom">
<Button
x:Name="Button_SelectTemplate"
Margin="0,0,5,0"
Click="Button_CreateTemplateForSelection_Click"
Content="Dokument erstellen" />
<Button
x:Name="Button_SelectFolder"
Margin="0,0,5,0"
Click="Button_SelectFolder_Click"
Content="Dokument speichern" />
<Button
x:Name="Button_Cancel_OnlyOne"
Click="Button_Cancel_Click"
Content="Abbrechen" />
</WrapPanel>
</Grid>

View File

@@ -233,19 +233,20 @@ namespace BeWo.View.Navigation
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
//private AiConversationChatViewModel getAiConversationChatViewModel()
//{
// throw new NotImplementedException();
//// var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerNavigation, context);
//// var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerNavigation, context);
return vm;
}
//// return vm;
//}
private void OpenAiWindow()
{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
}
//private void OpenAiWindow()
//{
// MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
//}
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
{

View File

@@ -108,19 +108,20 @@ namespace BeWo.View.Navigation
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
//private AiConversationChatViewModel getAiConversationChatViewModel()
//{
// throw new NotImplementedException();
// //var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.EmployeeNavigation, context);
// //var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.EmployeeNavigation, context);
return vm;
}
// //return vm;
//}
private void OpenAiWindow()
{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
}
//private void OpenAiWindow()
//{
// MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
//}
private bool MainNavigationView_ArchiveObject(IFilterableDC obj)
{

View File

@@ -267,24 +267,6 @@
Click="btnDelete_Click"
Content="Löschen"
Style="{StaticResource NavigationToolbarButtonStyle}" />
<StackPanel
Margin="0"
Orientation="Horizontal"
Visibility="Collapsed">
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</StackPanel.Resources>
<Button
x:Name="btnOpenAi2"
Margin="10,0,0,0"
Command="{Binding Path=OpenAiWindowCommand, RelativeSource={RelativeSource AncestorType={x:Type localView:BeWoView}}}"
Content="AI Chat Window"
Style="{StaticResource NavigationToolbarButtonStyle}" />
</StackPanel>
<TextBlock
x:Name="textblock_link"
Margin="20,0,0,0"

View File

@@ -86,8 +86,6 @@ namespace BeWo.View.Navigation
OpenSelectedObject();
}
};
OpenAiWindowCommand = new DelegateCommand(null, () => false);
}
public delegate bool ArchiveObjectDelegate(IFilterableDC obj);
@@ -128,8 +126,6 @@ namespace BeWo.View.Navigation
public event CopyObjectDelegate CopyObject;
public DelegateCommand OpenAiWindowCommand { get; set; }
public bool ArchiveButtonVisible
{
get

View File

@@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -34,8 +35,6 @@ namespace BeWo.View.Navigation
{
InitializeComponent();
//mainNavigationView.OpenAiWindowCommand = CommandFactory.GetAiViewCommand(OpenAiWindow, UserRightType.AiModuleChatView);
mainNavigationView.Sorter = new OrganisationSorter();
mainNavigationView.ArchiveButtonVisible =
@@ -74,19 +73,20 @@ namespace BeWo.View.Navigation
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
//private AiConversationChatViewModel getAiConversationChatViewModel()
//{
// throw new NotImplementedException();
// //var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context);
// //var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context);
return vm;
}
// //return vm;
//}
private void OpenAiWindow()
{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
}
//private void OpenAiWindow()
//{
// MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
//}
private void mainNavigationView_CreateNewObject()
{

View File

@@ -24,6 +24,7 @@ using DevExpress.XtraBars.Docking;
using BeWo.ViewModel.View.AI;
using DevExpress.Xpf.Editors;
using BS.Shared.Translation;
using System;
namespace BeWo.View.Navigation
{
@@ -42,8 +43,6 @@ namespace BeWo.View.Navigation
{
InitializeComponent();
//mainNavigationView.OpenAiWindowCommand = CommandFactory.GetAiViewCommand(OpenAiWindow, UserRightType.AiModuleChatView);
mainNavigationView.Sorter = new PersonSorter();
mainNavigationView.ArchiveButtonVisible = BeWoApp.LoggedOnUser.HasRight(UserRightType.Person_AllowArchiving);
@@ -149,19 +148,20 @@ namespace BeWo.View.Navigation
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
//private AiConversationChatViewModel getAiConversationChatViewModel()
//{
// throw new NotImplementedException();
// //var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.PersonNavigation, context);
// //var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.PersonNavigation, context);
return vm;
}
// //return vm;
//}
private void OpenAiWindow()
{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
}
//private void OpenAiWindow()
//{
// MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
//}
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
{

View File

@@ -49,8 +49,6 @@ namespace BeWo.View.Navigation
{
this.InitializeComponent();
//mainNavigationView.OpenAiWindowCommand = CommandFactory.GetAiViewCommand(OpenAiWindow, UserRightType.AiModuleChatView);
this.mainNavigationView.Sorter = new SupportConceptSorter();
this.mainNavigationView.ArchiveButtonVisible = BeWoApp.LoggedOnUser.HasRight(UserRightType.SupportConceptView_AllowArchiving);
this.mainNavigationView.ShowArchivedObjectsVisible = true;
@@ -225,19 +223,21 @@ namespace BeWo.View.Navigation
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
//private AiConversationChatViewModel getAiConversationChatViewModel()
//{
// throw new NotImplementedException();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConceptNavigation, context);
// //var context = GetVisibleInformationReferences();
return vm;
}
// //var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConceptNavigation, context);
private void OpenAiWindow()
{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
}
// //return vm;
//}
//private void OpenAiWindow()
//{
// MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
//}
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
{

View File

@@ -0,0 +1,29 @@
using BeWo.ViewModel;
using DevExpress.Web.Internal.XmlProcessor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace BeWo.View.TemplateSelectors
{
public class AiPromptbausteinFolderItemTemplateSelector : DataTemplateSelector
{
public DataTemplate AiPromptbausteinPromptTemplate { get; set; }
public DataTemplate AiPromptbausteinRoutineTemplate { get; set; }
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
if (item is AiPromptbausteinPromptVM prompt)
return AiPromptbausteinPromptTemplate;
if (item is AiPromptbausteinRoutineVM routine)
return AiPromptbausteinRoutineTemplate;
throw new NotImplementedException("item is not AiPromptbausteinPromptVM or AiPromptbausteinRoutineVM");
}
}
}

View File

@@ -17,6 +17,9 @@
TextOptions.TextFormattingMode="Display"
WindowStartupLocation="CenterOwner"
WindowStyle="None">
<Window.InputBindings>
<KeyBinding Key="Esc" Command="ApplicationCommands.Close" />
</Window.InputBindings>
<Window.DataContext>
<view:WindowViewModel />
</Window.DataContext>
@@ -35,9 +38,15 @@
<Grid x:Name="rootGrid">
<GroupBox
x:Name="rootGroupBox"
x:FieldModifier="public"
MouseDoubleClick="RootGroupBox_OnMouseDoubleClick"
MouseLeftButtonDown="RootGroupBox_OnMouseLeftButtonDown"
Style="{DynamicResource PopUpWindowStyle}" />
Style="{DynamicResource PopUpWindowStyle}">
<GroupBox.CommandBindings>
<CommandBinding Command="ApplicationCommands.Close" Executed="CommandBinding_Close_Executed" />
<CommandBinding Command="ApplicationCommands.Save" Executed="CommandBinding_Save_Executed" />
</GroupBox.CommandBindings>
</GroupBox>
<Grid
x:Name="_WaitingLayer"
HorizontalAlignment="Stretch"

View File

@@ -253,6 +253,41 @@ namespace BeWo.View.Windows
{
if (!ServiceFacade.IsWaiting() && _WaitLayer != null)
EndWaiting();
if (rootGroupBox.Content is IInputElement element && element.Focusable)
{
Keyboard.Focus(element);
}
}
private void CommandBinding_Close_Executed(object sender, ExecutedRoutedEventArgs e)
{
var content = rootGroupBox.Content;
if (content is BeWoView view)
{
var canSave = view.DataContext is AcceptCancelDialogViewModel viewModel
&& viewModel.SaveCommand.CanExecute(null);
if ((!canSave) || view.DoSaveCheck())
{
Close();
}
else
{
e.Handled = true;
}
}
}
private void CommandBinding_Save_Executed(object sender, ExecutedRoutedEventArgs e)
{
var content = rootGroupBox.Content;
if (content is BeWoView view)
{
view.SaveData();
}
}
}
}

View File

@@ -68,6 +68,7 @@ namespace BeWo.ViewModel
protected abstract DCType MapToDataContract(DCType pDataContract, bool doCommit);
// Methode dient dem aktualiseren eines existierendes VM mit einem neuen DC (z.B. Serverupdate)
public virtual void UpdateByDataContract(DCType pDataContract)
{
throw new NotImplementedException();

View File

@@ -7,6 +7,7 @@ using BeWo.ServiceProxy;
using BeWo.ViewModel.ListViewModel;
using BS.Shared;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Extensions;
using DevExpress.Mvvm;
using DevExpress.Xpf.Core.Native;
using Newtonsoft.Json;
@@ -73,7 +74,7 @@ namespace BeWo.ViewModel
public string Context => DataContract.Context;
public Dictionary<TableID, long[]> ContextBeWoObjects => DataContract.ContextBeWoObjects;
public AiDataContextType Context_Type => DataContract.ContextType;
public UIContext UIContext => (UIContext)DataContract.UIContext;
public AiActionType AiActionType => DataContract.ActionType;
protected override void InitByDataContract(AiConversationDC pDataContract)
{
@@ -115,6 +116,12 @@ namespace BeWo.ViewModel
return new AiConversationMessageListVM(messages);
}
public void AddMessages(List<AiConversationMessageDC> messages)
{
var filter = getFilter(messages);
Messages.VMList.AddRange(filter.VMList);
}
public void ResetDisplayname()
{
Displayname = DataContract.Displayname;

View File

@@ -19,9 +19,15 @@ namespace BeWo.ViewModel
private bool _IsPublic;
private int _Position;
private bool _IsExpanded;
private bool _IsSelected;
private AiActionType _ActionType;
private AiPromptbausteinFolderListVM _SubFolders;
private AiPromptbausteinPromptListVM _SubPrompts;
private AiPromptbausteinRoutineListVM _SubRoutines;
private bool _CanAddFolder;
private bool _CanAddPrompt;
private bool _CanAddRoutine;
private bool _CanEdit;
public AiPromptbausteinFolderVM(AiPromptbausteinFolderDC dc) : base(dc, dc.Oid)
{
@@ -36,8 +42,6 @@ namespace BeWo.ViewModel
var success = SetProperty(ref _Title, value, nameof(Title), () => DataContract.Title);
if (!success)
return;
FirePropertyChanged(nameof(Displayname));
}
}
@@ -55,7 +59,7 @@ namespace BeWo.ViewModel
public CompactEmployeeDC Creator
{
get => DataContract.Creator;
get => _Creator;
set => SetProperty(ref _Creator, value, nameof(Creator), () => DataContract.Creator);
}
@@ -77,16 +81,60 @@ namespace BeWo.ViewModel
set => SetProperty(ref _IsExpanded, value, nameof(IsExpanded));
}
public bool IsSelected
{
get => _IsSelected;
set => SetProperty(ref _IsSelected, value, nameof(IsSelected));
}
public AiActionType ActionType
{
get => _ActionType;
set => SetProperty(ref _ActionType, value, nameof(ActionType), () => DataContract.ActionType);
}
public bool CanAddFolder
{
get => _CanAddFolder;
set => SetProperty(ref _CanAddFolder, value, nameof(CanAddFolder));
}
public bool CanAddPrompt
{
get => _CanAddPrompt;
set => SetProperty(ref _CanAddPrompt, value, nameof(CanAddPrompt));
}
public bool CanAddRoutine
{
get => _CanAddRoutine;
set => SetProperty(ref _CanAddRoutine, value, nameof(CanAddRoutine));
}
public bool CanEdit
{
get => _CanEdit;
set => SetProperty(ref _CanEdit, value && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit), nameof(CanEdit));
}
public AiPromptbausteinFolderListVM SubFolders
{
get => _SubFolders;
set => SetProperty(ref _SubFolders, value, nameof(SubFolders));
set
{
var success = SetProperty(ref _SubFolders, value, nameof(SubFolders));
if (!success)
return;
_SubFolders.VMList.ListChanged += (s, e) => {
FirePropertyChanged(nameof(TotalPromptCount));
FirePropertyChanged(nameof(TotalRoutineCount));
FirePropertyChanged(nameof(AlleFolderItems));
if (e.ListChangedType == System.ComponentModel.ListChangedType.ItemChanged)
return;
FirePropertyChanged(nameof(Prompts));
FirePropertyChanged(nameof(Routines));
};
}
}
public AiPromptbausteinPromptListVM SubPrompts
@@ -99,7 +147,8 @@ namespace BeWo.ViewModel
return;
_SubPrompts.VMList.ListChanged += (s, e) => {
FirePropertyChanged(nameof(Displayname));
FirePropertyChanged(nameof(TotalPromptCount));
FirePropertyChanged(nameof(AlleFolderItems));
if (e.ListChangedType == System.ComponentModel.ListChangedType.ItemChanged)
return;
@@ -109,6 +158,40 @@ namespace BeWo.ViewModel
}
}
public AiPromptbausteinRoutineListVM SubRoutines
{
get => _SubRoutines;
set
{
var success = SetProperty(ref _SubRoutines, value, nameof(SubRoutines));
if (!success)
return;
_SubRoutines.VMList.ListChanged += (s, e) => {
FirePropertyChanged(nameof(TotalRoutineCount));
FirePropertyChanged(nameof(AlleFolderItems));
if (e.ListChangedType == System.ComponentModel.ListChangedType.ItemChanged)
return;
FirePropertyChanged(nameof(Routines));
};
}
}
public List<AbstractBaseVM> AlleFolderItems
{
get
{
var l1 = Prompts.Cast<AbstractBaseVM>();
var l2 = Routines.Cast<AbstractBaseVM>();
var l12 = l1.Union(l2);
return l12.ToList();
}
}
public List<AiPromptbausteinPromptVM> Prompts
{
get
@@ -126,20 +209,21 @@ namespace BeWo.ViewModel
}
}
public bool CanAddFolder
public List<AiPromptbausteinRoutineVM> Routines
{
get => DataContract.CanAddFolder;
set => DataContract.CanAddFolder = value;
}
public bool CanAddPrompt
{
get => DataContract.CanAddPrompt;
set => DataContract.CanAddPrompt = value;
}
public bool CanEdit
{
get => DataContract.CanEdit && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit);
set => DataContract.CanEdit = value;
get
{
var res = new List<AiPromptbausteinRoutineVM>();
res.AddRange(SubRoutines.VMList);
foreach (var folder in SubFolders.VMList)
{
res.AddRange(folder.Routines);
}
return res;
}
}
public bool IsNewFeature
@@ -151,22 +235,15 @@ namespace BeWo.ViewModel
get => !IsNewFeature;
}
public bool CanShareEdit
{
get => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteinShare) && Creator?.EmployeeOid is long owner && owner == BeWoApp.CompactLoggedOnEmployee.EmployeeOid;
}
public AiPromptbausteinFolderVM Parent { get; set; }
public FontWeight FontWeight => !IsNew && Parent is null ? FontWeights.SemiBold : FontWeights.Medium;
public bool HasSubFolders => SubFolders is object && SubFolders.Count > 0;
public string Displayname
{
get
{
if (TotalPromptCount > 0)
{
return $"{Title} ({TotalPromptCount})";
}
return Title;
}
}
public int TotalPromptCount
{
@@ -183,6 +260,21 @@ namespace BeWo.ViewModel
}
}
public int TotalRoutineCount
{
get
{
var total = SubRoutines.Count;
foreach (var folder in SubFolders.VMList)
{
total += folder.TotalRoutineCount;
}
return total;
}
}
protected override void InitByDataContract(AiPromptbausteinFolderDC pDataContract)
{
_Title = pDataContract.Title;
@@ -193,8 +285,13 @@ namespace BeWo.ViewModel
_Position = pDataContract.Position;
_IsExpanded = pDataContract.IsExpanded;
_ActionType = pDataContract.ActionType;
_SubFolders = new AiPromptbausteinFolderListVM(pDataContract.SubFolders, this);
_CanAddFolder = pDataContract.CanAddFolder;
_CanAddPrompt = pDataContract.CanAddPrompt;
_CanAddRoutine = pDataContract.CanAddRoutine;
_CanEdit = pDataContract.CanEdit;
SubFolders = new AiPromptbausteinFolderListVM(pDataContract.SubFolders, this);
SubPrompts = new AiPromptbausteinPromptListVM(pDataContract.SubPrompts);
SubRoutines = new AiPromptbausteinRoutineListVM(pDataContract.SubRoutines);
}
protected override AiPromptbausteinFolderDC MapToDataContract(AiPromptbausteinFolderDC pDataContract, bool doCommit)
@@ -208,12 +305,18 @@ namespace BeWo.ViewModel
pDataContract.ActionType = _ActionType;
pDataContract.SubFolders = _SubFolders.CopyToDCList(doCommit);
pDataContract.SubPrompts = _SubPrompts.CopyToDCList(doCommit);
pDataContract.SubRoutines = _SubRoutines.CopyToDCList(doCommit);
return pDataContract;
}
public override void UpdateByDataContract(AiPromptbausteinFolderDC pDataContract)
{
if(IsNew)
IsNew = false;
DataContract = pDataContract;
Title = pDataContract.Title;
Description = pDataContract.Description;
IsPublic = pDataContract.IsPublic;

View File

@@ -19,7 +19,6 @@ namespace BeWo.ViewModel
private bool _ShowPromptByTenant;
private bool _IsOwnsoftPrompt;
private string _OwnsoftRefLink;
private bool _IsSelected;
private bool _IsFavorite;
private AiActionType _ActionType;
@@ -106,26 +105,15 @@ namespace BeWo.ViewModel
set => SetProperty(ref _IsFavorite, value, nameof(IsFavorite), () => DataContract.IsFavorite, nameof(FontWeight));
}
public bool CanShareEdit
{
get => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteinShare);
}
public bool CanEdit
{
get => DataContract.CanEdit && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit);
set => DataContract.CanEdit = value;
}
public bool IsSelected
{
get => _IsSelected;
set => SetProperty(ref _IsSelected, value, nameof(IsSelected), nameof(IsInfoVisible));
}
public bool IsInfoVisible
{
get => IsOwnsoftPrompt && !string.IsNullOrWhiteSpace(OwnsoftRefLink) && IsSelected;
get => IsOwnsoftPrompt && !string.IsNullOrWhiteSpace(OwnsoftRefLink);
}
public FontWeight FontWeight
@@ -138,6 +126,8 @@ namespace BeWo.ViewModel
get => ShowPrompt && ShowPromptByTenant;
}
public string FavoritenHeader => IsFavorite ? "Favorit entfernen" : "Favorit hinzufügen";
protected override void InitByDataContract(AiPromptbausteinPromptDC pDataContract)
{
_Title = pDataContract.Title;
@@ -176,6 +166,9 @@ namespace BeWo.ViewModel
public override void UpdateByDataContract(AiPromptbausteinPromptDC pDataContract)
{
if (IsNew)
IsNew = false;
Title = pDataContract.Title;
Description = pDataContract.Description;
ParentFolderOid = pDataContract.ParentFolderOid;
@@ -189,6 +182,10 @@ namespace BeWo.ViewModel
OwnsoftRefLink = pDataContract.OwnsoftRefLink;
IsFavorite = pDataContract.IsFavorite;
ActionType = pDataContract.ActionType;
DataContract = pDataContract;
SetDirty(false);
}
public override bool IsDirty

View File

@@ -26,7 +26,7 @@ namespace BeWo.ViewModel
public AiPromptbausteinPromptDC PromptReference
{
get => _PromptReference;
set => SetProperty(ref _PromptReference, value, nameof(PromptReference), () => DataContract.PromptReference);
set => SetProperty(ref _PromptReference, value, nameof(PromptReference), () => DataContract.ReferencePrompt);
}
public long ReferenceVersion
@@ -35,20 +35,40 @@ namespace BeWo.ViewModel
set => SetProperty(ref _ReferenceVersion, value, nameof(ReferenceVersion), () => DataContract.ReferenceVersion);
}
public bool IsValid
{
get => DataContract.IsValid;
}
protected override void InitByDataContract(AiPromptbausteinRoutineStepDC pDataContract)
{
_Position = pDataContract.Position;
_PromptReference = pDataContract.PromptReference;
_PromptReference = pDataContract.ReferencePrompt;
_ReferenceVersion = pDataContract.ReferenceVersion;
}
protected override AiPromptbausteinRoutineStepDC MapToDataContract(AiPromptbausteinRoutineStepDC pDataContract, bool doCommit)
{
pDataContract.Position = _Position;
pDataContract.PromptReference = _PromptReference;
pDataContract.ReferencePrompt = _PromptReference;
pDataContract.ReferenceVersion = _ReferenceVersion;
return pDataContract;
}
public override void UpdateByDataContract(AiPromptbausteinRoutineStepDC pDataContract)
{
DataContract = pDataContract;
Position = pDataContract.Position;
PromptReference = pDataContract.ReferencePrompt;
ReferenceVersion = pDataContract.ReferenceVersion;
}
public void SetIsValid(bool isValid)
{
DataContract.IsValid = isValid;
FirePropertyChanged(nameof(IsValid));
}
}
}

View File

@@ -1,9 +1,11 @@
using System;
using System.Linq;
using BeWo.ViewModel.ListViewModel;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Extensions;
namespace BeWo.ViewModel
{
@@ -17,6 +19,7 @@ namespace BeWo.ViewModel
private int _Position;
private bool _IsFavorite;
private AiActionType _ActionType;
private AiRoutineType _RoutineType;
private bool _CanEdit;
private AiPromptbausteinRoutineStepListVM _Steps;
@@ -73,6 +76,12 @@ namespace BeWo.ViewModel
set => SetProperty(ref _ActionType, value, nameof(ActionType), () => DataContract.ActionType);
}
public AiRoutineType RoutineType
{
get => _RoutineType;
set => SetProperty(ref _RoutineType, value, nameof(RoutineType), () => DataContract.RoutineType);
}
public bool CanEdit
{
get => _CanEdit;
@@ -85,6 +94,14 @@ namespace BeWo.ViewModel
set => SetProperty(ref _Steps, value, nameof(Steps));
}
public string FavoritenHeader => IsFavorite ? "Favorit entfernen" : "Favorit hinzufügen";
public override bool IsDirty => base.IsDirty || Steps.IsDirty;
public bool IsValid
{
get => Steps.Count > 0 && Steps.VMList.All(x => x.IsValid);
}
protected override void InitByDataContract(AiPromptbausteinRoutineDC pDataContract)
{
_Title = pDataContract.Title;
@@ -95,6 +112,7 @@ namespace BeWo.ViewModel
_Position = pDataContract.Position;
_IsFavorite = pDataContract.IsFavorite;
_ActionType = pDataContract.ActionType;
_RoutineType = pDataContract.RoutineType;
_CanEdit = pDataContract.CanEdit;
_Steps = new AiPromptbausteinRoutineStepListVM(pDataContract.Steps);
@@ -110,11 +128,27 @@ namespace BeWo.ViewModel
pDataContract.Position = _Position;
pDataContract.IsFavorite = _IsFavorite;
pDataContract.ActionType = _ActionType;
pDataContract.RoutineType = _RoutineType;
pDataContract.CanEdit = _CanEdit;
pDataContract.Steps = _Steps.CopyToDCList(doCommit);
pDataContract.Steps = _Steps.CopyToDCList(true);
return pDataContract;
}
public override void UpdateByDataContract(AiPromptbausteinRoutineDC pDataContract)
{
if (IsNew)
IsNew = false;
DataContract = pDataContract;
Title = pDataContract.Title;
Description = pDataContract.Description;
IsPublic = pDataContract.IsPublic;
IsFavorite = pDataContract.IsFavorite;
RoutineType = pDataContract.RoutineType;
Steps.UpdateByDataContracts(pDataContract.Steps);
}
}
}

View File

@@ -0,0 +1,207 @@
using BeWo.ServiceProxy;
using BeWo.View.Controls.AI;
using BeWo.View.Detail.AI;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.DataContracts.Feature.AI;
using DevExpress.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;
namespace BeWo.ViewModel.Controls.AI
{
public enum AiChatButtonState
{
Hidden,
Normal,
Loading,
Warning,
Disabled
}
public class AiChatButtonViewModel : AbstractBaseVM
{
private bool isVisible;
private bool canExecute;
private AiChatButtonState buttonState;
public AiActionType ActionType { get; protected set; }
public bool IsFavoritenOpen { get; set; }
public List<AiMenuItemTemplate> AssistentCommands { get; protected set; }
public virtual bool IsHistoryEnabled => false;
public virtual bool IsHistoryVisible => false;
public bool IsEnabled => BeWoApp.AppSettings.ShowAI && BeWoApp.HasLoggedOnUserRight(GetUserRightType());
public bool IsVisible
{
get => isVisible;
set => SetProperty(ref isVisible, value, nameof(IsVisible));
}
public bool CanExecute
{
get => canExecute;
set => SetProperty(ref canExecute, value, nameof(CanExecute));
}
public AiChatButtonState ButtonState
{
get => buttonState;
set
{
if (!SetProperty(ref buttonState, value, nameof(ButtonState)))
return;
FirePropertyChanged(nameof(IsContextSizeTooBig));
FirePropertyChanged(nameof(CanSendNewMessage));
FirePropertyChanged(nameof(CanOpenConversation));
CommandManager.InvalidateRequerySuggested();
}
}
public Func<AiViewContextDC> GetAiVisualContext { get; set; }
public AiPromptbausteinSelectionComplexViewModel AllPromptsViewModel { get; set; }
public DelegateCommand OpenConversationPopupCommand { get; protected set; }
public DelegateCommand OpenAllPromptsPopupCommand { get; protected set; }
public DelegateCommand OpenFavoritePromptsPopupCommand { get; protected set; }
public bool IsContextSizeTooBig => ButtonState == AiChatButtonState.Warning;
public virtual bool CanSendNewMessage => ButtonState == AiChatButtonState.Normal;
public bool CanOpenConversation => ButtonState == AiChatButtonState.Normal || ButtonState == AiChatButtonState.Warning;
public AiChatButtonViewModel(AiActionType aiActionType)
{
ActionType = aiActionType;
if (!IsEnabled)
return;
canExecute = false;
isVisible = false;
OpenConversationPopupCommand = new DelegateCommand(OpenConversationPopup, () => CanOpenConversation);
OpenAllPromptsPopupCommand = new DelegateCommand(OpenAllPromptsPopup, () => CanSendNewMessage);
OpenFavoritePromptsPopupCommand = new DelegateCommand(OpenFavoritePromptsPopup, () => CanSendNewMessage);
ButtonState = AiChatButtonState.Loading;
}
public void CheckContextSize()
{
if (!IsEnabled)
return;
ButtonState = AiChatButtonState.Loading;
var context = GetAiVisualContext();
if (context != null)
{
if (context.Primary is null)
{
IsVisible = false;
ButtonState = AiChatButtonState.Disabled;
return;
}
IsVisible = true;
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CheckContextSize(ActionType, context),
isValid =>
{
if (isValid)
ButtonState = AiChatButtonState.Normal;
else
ButtonState = AiChatButtonState.Warning;
},
(exp) => ButtonState = AiChatButtonState.Disabled);
}
}
public void ReloadData(bool value, Action<AiActionType, List<AiPromptbausteinFolderDC>> initPromptbausteine)
{
if (!IsEnabled)
return;
var actionType = ActionType;
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteinFolder(actionType), folders => initPromptbausteine(actionType, folders),
null,
true);
}
public void ItemAccepted(AbstractBaseVM e)
{
if (e is AiPromptbausteinPromptVM prompt)
{
var vm = GetConversationViewModel();
vm.InputItem = prompt;
BeWoApp.WindowService.Show(vm);
return;
}
else if (e is AiPromptbausteinRoutineVM routine)
{
var vm = GetConversationViewModel();
vm.InputItem = routine;
BeWoApp.WindowService.Show(vm);
return;
}
throw new NotImplementedException();
}
private protected AiConversationChatViewModel GetConversationViewModel()
{
var context = GetAiVisualContext();
var chat_viewmodel = VMFactory.CreateAiConversationChatViewModel(ActionType, context, AssistentCommands, CanSendNewMessage);
return chat_viewmodel;
}
private protected void OpenConversationPopup()
{
BeWoApp.WindowService.Show(GetConversationViewModel());
}
private protected void OpenAllPromptsPopup()
{
BeWoApp.WindowService.Show(AllPromptsViewModel);
}
private protected void OpenFavoritePromptsPopup()
{
IsFavoritenOpen = true;
FirePropertyChanged(nameof(IsFavoritenOpen));
}
private UserRightType GetUserRightType()
{
switch (ActionType)
{
case AiActionType.ServiceRecord:
break;
case AiActionType.ServiceRecordConversation:
return UserRightType.AiModuleServiceRecordChat;
case AiActionType.ServiceRecordDocumentation:
return UserRightType.AiModuleServiceRecordDocu;
default:
break;
}
throw new InvalidOperationException($"UserRightType '{ActionType}' not implemented");
}
}
public class AiMenuItemTemplate
{
public string Icon { get; set; }
public string Name { get; set; }
public DelegateCommand<AiConversationMessageVM> Command { get; set; }
}
}

View File

@@ -0,0 +1,153 @@
using BS.Shared;
using BS.Shared.Interface;
using DevExpress.Mvvm;
using DevExpress.XtraPrinting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.ViewModel.Controls.AI
{
public class AiChatButtonWithHistoryViewModel : AiChatButtonViewModel
{
private readonly ITextProvider _provider;
private readonly string _key;
private int _currentIndex;
public List<string> History { get; set; }
public string CurrentValue
{
get => _provider.GetText(_key);
set => _provider.SetText(_key, value);
}
public int CurrentIndex
{
get => _currentIndex;
set {
if(SetProperty(ref _currentIndex, value, nameof(CurrentIndex)))
{
FirePropertyChanged(nameof(IsUndoButtonVisible));
FirePropertyChanged(nameof(IsRedoButtonVisible));
}
}
}
public override bool IsHistoryEnabled => true;
public override bool IsHistoryVisible => History.Count > 1;
public bool IsUndoButtonVisible => CurrentIndex > 0;
public bool IsRedoButtonVisible => CurrentIndex < History.Count - 1;
public DelegateCommand UndoAiActionCommand { get; protected set; }
public DelegateCommand RedoAiActionCommand { get; protected set; }
public AiChatButtonWithHistoryViewModel(AiActionType aiActionType, ITextProvider provider, string key) : base(aiActionType)
{
History = new List<string>();
CurrentIndex = 0;
AssistentCommands = new List<AiMenuItemTemplate>()
{
new AiMenuItemTemplate()
{
Command = new DelegateCommand<AiConversationMessageVM>(x => AddValue(x.Message)),
Icon = null,
Name = "Anfügen"
},
new AiMenuItemTemplate()
{
Command = new DelegateCommand<AiConversationMessageVM>(x => ReplaceValue(x.Message)),
Icon = null,
Name = "Ersetzen"
},
};
UndoAiActionCommand = new DelegateCommand(UndoAiAction);
RedoAiActionCommand = new DelegateCommand(RedoAiAction);
_provider = provider;
_key = key;
}
public override bool CanSendNewMessage => base.CanSendNewMessage && !string.IsNullOrEmpty(CurrentValue);
public void ClearHistory()
{
History.Clear();
History.Add(CurrentValue);
CurrentIndex = 0;
FirePropertyChanged(nameof(IsHistoryVisible));
}
public void UndoAiAction()
{
if (CurrentIndex <= 0)
return;
CurrentIndex--;
CurrentValue = History[CurrentIndex];
}
public void RedoAiAction()
{
if (CurrentIndex >= History.Count - 1)
return;
CurrentIndex++;
CurrentValue = History[CurrentIndex];
}
public void AddValue(string s)
{
var sb = new StringBuilder();
sb.AppendLine("Antwort:");
sb.AppendLine(s);
sb.AppendLine();
sb.AppendLine("Original:");
sb.AppendLine(CurrentValue);
var str = sb.ToString();
accept(str);
}
public void ReplaceValue(string str)
{
accept(str);
}
private void accept(string str)
{
var idx = CurrentIndex;
var count = History.Count;
var last_idx = count - 1;
if (last_idx > idx)
{
History.RemoveRange(idx + 1, last_idx - idx);
}
if (History.Count == 0)
{
History.Add(CurrentValue);
}
else if (CurrentValue != History[CurrentIndex])
{
History.Add(CurrentValue);
CurrentIndex++;
}
History.Add(str);
CurrentIndex++;
CurrentValue = str;
FirePropertyChanged(nameof(IsHistoryVisible));
}
}
}

View File

@@ -0,0 +1,18 @@
using DevExpress.Mvvm;
namespace BeWo.ViewModel
{
/// <summary>
/// Gemeinsamer Vertrag der Promptbaustein-ViewModels (Verwaltung + Auswahl),
/// gegen den das AiPromptbausteinLibraryControl im Code-Behind arbeitet.
/// </summary>
public interface IAiPromptbausteinComplexViewModel
{
AiPromptbausteinFolderVM SelectedFolder { get; set; }
DelegateCommand OpenEditFolderDialogCommand { get; }
void UpdateFolderCommands();
void UpdatePromptCommands();
}
}

View File

@@ -291,5 +291,10 @@ namespace BeWo.ViewModel.ListViewModel
{
return null;
}
}
public virtual void UpdateByDataContracts(List<DCType> pDataContracts)
{
throw new NotImplementedException();
}
}
}

View File

@@ -90,7 +90,7 @@ namespace BeWo.ViewModel.ListViewModel
Displayname = "Displayname Megamegalange Deluxe Op 3000",
Messages = messages_dc,
Modell = model,
UIContext = AiContextType.ServiceRecord,
ActionType = AiActionType.ServiceRecordDocumentation,
Updated = DateTime.Now,
};
@@ -116,7 +116,7 @@ namespace BeWo.ViewModel.ListViewModel
Created = DateTime.Now,
Displayname = "Dummy Num " + i.ToString(),
Modell = model,
UIContext = AiContextType.ServiceRecord,
ActionType = AiActionType.ServiceRecordDocumentation,
Updated = DateTime.Now,
};

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Extensions;
namespace BeWo.ViewModel.ListViewModel
{
@@ -13,5 +14,43 @@ namespace BeWo.ViewModel.ListViewModel
{
}
public override void UpdateByDataContracts(List<AiPromptbausteinRoutineStepDC> pDataContracts)
{
var count_a = Count;
var count_b = pDataContracts.Count;
// 1-k updaten
var count_toupdate = Math.Min(count_a, count_b);
for ( var i = 0; i < count_toupdate; i++)
{
var a = VMList[i];
var b = pDataContracts[i];
a.UpdateByDataContract(b);
}
if (count_a == count_b)
return;
if(count_a > count_b)
{
for (var i = count_a - 1; i > count_toupdate - 1; i--)
{
VMList.RemoveAt(i);
}
}
else
{
for (int i = count_toupdate; i < count_b; i++)
{
var dc = pDataContracts[i];
var vm = new AiPromptbausteinRoutineStepVM(dc);
VMList.Add(vm);
}
}
FirePropertyChanged(nameof(Count));
}
}
}

View File

@@ -79,7 +79,7 @@ namespace BeWo.ViewModel.ListViewModel
// Holt bereits geladene
if (invoice_base.XRechnungStoredFileVM is StoredFileVM vm && vm.Data is byte[] bytes)
{
BeWoApp.MainControl.WindowService.ShowERechnungWindow(new MemoryStream(bytes));
BeWoApp.WindowService.ShowERechnungWindow(new MemoryStream(bytes));
return;
}
@@ -103,7 +103,7 @@ namespace BeWo.ViewModel.ListViewModel
invoice_base.XRechnungStoredFileVM.Data = bytes;
BeWoApp.MainControl.WindowService.ShowERechnungWindow(new MemoryStream(bytes));
BeWoApp.WindowService.ShowERechnungWindow(new MemoryStream(bytes));
}
else
{

View File

@@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
@@ -13,6 +14,7 @@ using BeWo.Core.Commands;
using BeWo.Core.Service;
using BeWo.ServiceProxy;
using BeWo.View.Controls.AI;
using BeWo.ViewModel.Controls.AI;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.Core;
@@ -20,7 +22,9 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords;
using BS.Shared.Exceptions;
using BS.Shared.Extensions;
using BS.Shared.Interface;
using BS.Shared.Services;
using DevExpress.Mvvm;
using DevExpress.Xpf.Editors.ExpressionEditor;
@@ -30,7 +34,7 @@ using DispatcherObject = System.Windows.Threading.DispatcherObject;
namespace BeWo.ViewModel.ListViewModel
{
public class ServiceRecordListVM : AbstractDCListMapperVM<ServiceRecordDC, ServiceRecordVM>
public class ServiceRecordListVM : AbstractDCListMapperVM<ServiceRecordDC, ServiceRecordVM>, ITextProvider
{
public static string PropertyName_CustomerNodes = "CustomerNodes";
public static string PropertyName_Information = "Information";
@@ -100,21 +104,12 @@ namespace BeWo.ViewModel.ListViewModel
//private static List<DarreichungsformDC> _AllDosageForms;
private List<string> _AiActionHistory;
private int _AiActionHistoryIndex;
private AiConversationButtonState _AiConversationButtonState;
public ICommand UndoAiActionCommand { get; set; }
public ICommand RedoAiActionCommand { get; set; }
private List<string> _EditAiActionHistory;
private int _EditAiActionHistoryIndex;
public ICommand UndoEditAiActionCommand { get; set; }
public ICommand RedoEditAiActionCommand { get; set; }
public AiUserSettingVM AiUserSetting { get; set; }
public AiChatButtonViewModel AiChatButtonConversationViewModel { get; set; }
public AiChatButtonWithHistoryViewModel AiChatButtonDocumentationViewModel { get; set; }
public AiChatButtonWithHistoryViewModel AiChatButtonDocumentationEditViewModel { get; set; }
public ServiceRecordListVM(
Dictionary<ServiceCategoryDC, List<ServiceDescriptionDC>> pCategory2Services,
IEnumerable<ValueListEntryDC> pAllGoalCategories,
@@ -187,42 +182,14 @@ namespace BeWo.ViewModel.ListViewModel
private void InitAiStuff()
{
//var vm_doku = new AiPromptbausteinSelectionComplexViewModel(AiActionType.ServiceRecordDocumentation);
AiChatButtonConversationViewModel
= new AiChatButtonViewModel(AiActionType.ServiceRecordConversation);
//vm_doku.PromptAccepted += PromptAccepted;
AiChatButtonDocumentationViewModel
= new AiChatButtonWithHistoryViewModel(AiActionType.ServiceRecordDocumentation, this, "docu");
//OpenAiPromptSelectionCommand = CommandFactory.GetAiViewCommand(
// () => BeWoApp.MainControl.WindowService.Show(vm_doku),
// null,
// () => !string.IsNullOrWhiteSpace(AktuellerDokutext));
UndoAiActionCommand = new DelegateCommand(UndoAiAction);
RedoAiActionCommand = new DelegateCommand(RedoAiAction);
//var vm_edit_doku = new AiPromptbausteinSelectionComplexViewModel(AiActionType.ServiceRecordDocumentation);
//vm_edit_doku.PromptAccepted += EditPromptAccepted;
//OpenEditAiPromptSelectionCommand = CommandFactory.GetAiViewCommand(() =>
//{
// _EditAiActionHistory = new List<string>();
// _EditAiActionHistory.Add(AktuellerEditDokutext);
// _EditAiActionHistoryIndex = 0;
// BeWoApp.MainControl.WindowService.Show(vm_edit_doku);
//},
//null,
//() => !string.IsNullOrWhiteSpace(AktuellerEditDokutext));
UndoEditAiActionCommand = new DelegateCommand(UndoEditAiAction);
RedoEditAiActionCommand = new DelegateCommand(RedoEditAiAction);
_AiActionHistory = new List<string>();
_AiActionHistory.Add(AktuellerDokutext);
_AiActionHistoryIndex = 0;
_EditAiActionHistory = new List<string>();
_EditAiActionHistory.Add(AktuellerEditDokutext);
_EditAiActionHistoryIndex = 0;
AiChatButtonDocumentationEditViewModel
= new AiChatButtonWithHistoryViewModel(AiActionType.ServiceRecordDocumentation, this, "edit_docu");
}
private void InitAiTranscriptionStuff()
@@ -240,12 +207,6 @@ namespace BeWo.ViewModel.ListViewModel
FirePropertyChanged(nameof(AiUserSetting));
}
public AiConversationButtonState AiConversationButtonState
{
get => _AiConversationButtonState;
set => SetProperty(ref _AiConversationButtonState, value, nameof(AiConversationButtonState));
}
public IEnumerable<ServiceRecordVM> CurrentVisibleVMs { get; set; }
public string AktuellerDokutext
{
@@ -253,9 +214,6 @@ namespace BeWo.ViewModel.ListViewModel
set
{
PrototypeVM.Notice = value;
FirePropertyChanged(nameof(IsAiDocuButtonCanExecute));
FirePropertyChanged(nameof(IsRedoButtonVisible));
FirePropertyChanged(nameof(IsUndoButtonVisible));
}
}
public string AktuellerEditDokutext
@@ -264,8 +222,6 @@ namespace BeWo.ViewModel.ListViewModel
set
{
EditVM.Notice = value;
FirePropertyChanged(nameof(IsEditUndoButtonVisible));
FirePropertyChanged(nameof(IsEditRedoButtonVisible));
}
}
@@ -273,269 +229,13 @@ namespace BeWo.ViewModel.ListViewModel
public bool IsAiChatButtonVisible => SelectedCustomerNode is object && IsAiModuleEnabled && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordChat);
public bool IsAiDocuButtonVisible => SelectedCustomerNode is object && IsAiModuleEnabled && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordDocu);
public bool IsAiRowVisible => IsAiDocuButtonVisible || VoiceToTextButtonControl.HasRightToUseAIVoice;
public bool IsAiDocuButtonCanExecute => !string.IsNullOrWhiteSpace(AktuellerDokutext);
public bool IsUndoButtonVisible => _AiActionHistoryIndex > 0;
public bool IsRedoButtonVisible => _AiActionHistoryIndex < _AiActionHistory.Count - 1;
public bool IsEditUndoButtonVisible => _EditAiActionHistoryIndex > 0;
public bool IsEditRedoButtonVisible => _EditAiActionHistoryIndex < (_EditAiActionHistory?.Count ?? 0) - 1;
public void PromptAccepted(object sender, AiPromptbausteinPromptVM prompt)
{
if (prompt is null)
throw new NotImplementedException();
// 1. Information aufbereiten
// 1.1 Prompt
var prompt_oid = prompt.DataContract.Oid.Value;
var prompt_version = prompt.DataContract.Version;
// 1.2 Hilfeplan
var support_concept = SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConcept;
var support_concept_oid = support_concept.SupportConceptOid;
var support_concept_version = support_concept.SupportConceptVersion;
// 1.3 Aktuelles Doku Feld
var doku_feld = AktuellerDokutext;
// 1.4 Sichtbaren Zeiterfassungseinträge
var service_records = CurrentVisibleVMs;
var sr_refs = service_records.Select(x => new BeWoRefDC(x.DataContract.ServiceRecordOid.Value, x.DataContract.ServiceRecordVersion));
// 1.5 Costbearer
var costbearer = SelectedCustomerNode.SupportConceptTreeNodeDC.CostBearer;
var cb_oid = costbearer.CostBearerOid.Value;
var cb_ver = costbearer.CostBearerVersion;
// Service Aufruf
var req = new AiFunctionDocRequest()
{
AiPromptbausteinPrompt = new BeWoRefDC(prompt_oid, prompt_version),
SupportConcept = new BeWoRefDC(support_concept_oid, support_concept_version),
ServiceRecords = sr_refs,
CostBearer = new BeWoRefDC(cb_oid, cb_ver),
Dokumentation = doku_feld,
};
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.ExecuteAiFunctionServiceRecordDocumentation(req),
callback =>
{
var viewModel = new AiPromptbausteinActionResultViewModel();
viewModel.Result = callback.Result;
viewModel.Accept_Button_Clicked += (s, e) =>
{
var sb = new StringBuilder();
sb.AppendLine("AI Antwort:");
sb.AppendLine(viewModel.Result);
sb.AppendLine();
sb.AppendLine("Original:");
sb.AppendLine(AktuellerDokutext);
var str = sb.ToString();
var idx = _AiActionHistoryIndex;
var count = _AiActionHistory.Count;
if (count - 1 > idx)
{
_AiActionHistory.RemoveRange(idx + 1, count - idx - 1);
}
if (AktuellerDokutext != _AiActionHistory[_AiActionHistoryIndex])
{
_AiActionHistory.Add(AktuellerDokutext);
_AiActionHistoryIndex++;
}
_AiActionHistory.Add(str);
_AiActionHistoryIndex++;
AktuellerDokutext = str;
};
viewModel.Replace_Button_Clicked += (s, e) =>
{
var str = viewModel.Result;
var idx = _AiActionHistoryIndex;
var count = _AiActionHistory.Count;
if (count - 1 > idx)
{
_AiActionHistory.RemoveRange(idx + 1, count - idx - 1);
}
if (AktuellerDokutext != _AiActionHistory[_AiActionHistoryIndex])
{
_AiActionHistory.Add(AktuellerDokutext);
_AiActionHistoryIndex++;
}
_AiActionHistory.Add(str);
_AiActionHistoryIndex++;
AktuellerDokutext = str;
};
viewModel.Retry_Button_Clicked += (s, e) =>
{
PromptAccepted(sender, prompt);
};
BeWoApp.MainControl.WindowService.Show(viewModel);
}
);
}
public void EditPromptAccepted(object sender, AiPromptbausteinPromptVM prompt)
{
if (prompt is null)
throw new NotImplementedException();
// 1. Information aufbereiten
// 1.1 Prompt
var prompt_oid = prompt.DataContract.Oid.Value;
var prompt_version = prompt.DataContract.Version;
// 1.2 Hilfeplan
var support_concept = SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConcept;
var support_concept_oid = support_concept.SupportConceptOid;
var support_concept_version = support_concept.SupportConceptVersion;
// 1.3 Aktuelles Doku Feld
var doku_feld = AktuellerEditDokutext;
// 1.4 Sichtbaren Zeiterfassungseinträge
var service_records = CurrentVisibleVMs;
var sr_refs = service_records.Select(x => new BeWoRefDC(x.DataContract.ServiceRecordOid.Value, x.DataContract.ServiceRecordVersion));
// 1.5 Costbearer
var costbearer = SelectedCustomerNode.SupportConceptTreeNodeDC.CostBearer;
var cb_oid = costbearer.CostBearerOid.Value;
var cb_ver = costbearer.CostBearerVersion;
// Service Aufruf
var req = new AiFunctionDocRequest()
{
AiPromptbausteinPrompt = new BeWoRefDC(prompt_oid, prompt_version),
SupportConcept = new BeWoRefDC(support_concept_oid, support_concept_version),
ServiceRecords = sr_refs,
CostBearer = new BeWoRefDC(cb_oid, cb_ver),
Dokumentation = doku_feld,
};
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.ExecuteAiFunctionServiceRecordDocumentation(req),
callback =>
{
var viewModel = new AiPromptbausteinActionResultViewModel();
viewModel.Result = callback.Result;
viewModel.Accept_Button_Clicked += (s, e) =>
{
var sb = new StringBuilder();
sb.AppendLine("AI Antwort:");
sb.AppendLine(viewModel.Result);
sb.AppendLine();
sb.AppendLine("Original:");
sb.AppendLine(AktuellerEditDokutext);
var str = sb.ToString();
var idx = _EditAiActionHistoryIndex;
var count = _EditAiActionHistory.Count;
if (count - 1 > idx)
{
_EditAiActionHistory.RemoveRange(idx + 1, count - idx - 1);
}
if (AktuellerEditDokutext != _EditAiActionHistory[_EditAiActionHistoryIndex])
{
_EditAiActionHistory.Add(AktuellerEditDokutext);
_EditAiActionHistoryIndex++;
}
_EditAiActionHistory.Add(str);
_EditAiActionHistoryIndex++;
AktuellerEditDokutext = str;
};
viewModel.Replace_Button_Clicked += (s, e) =>
{
var str = viewModel.Result;
var idx = _EditAiActionHistoryIndex;
var count = _EditAiActionHistory.Count;
if (count - 1 > idx)
{
_EditAiActionHistory.RemoveRange(idx + 1, count - idx - 1);
}
if (AktuellerEditDokutext != _EditAiActionHistory[_EditAiActionHistoryIndex])
{
_EditAiActionHistory.Add(AktuellerEditDokutext);
_EditAiActionHistoryIndex++;
}
_EditAiActionHistory.Add(str);
_EditAiActionHistoryIndex++;
AktuellerEditDokutext = str;
};
viewModel.Retry_Button_Clicked += (s, e) =>
{
PromptAccepted(sender, prompt);
};
BeWoApp.MainControl.WindowService.Show(viewModel);
}
);
}
public void UpdateViewYearFilter(IEnumerable<ServiceRecordVM> enumerable)
{
if (!IsAiChatButtonVisible)
{
AiConversationButtonState = AiConversationButtonState.Hidden;
return;
}
AiConversationButtonState = AiConversationButtonState.Loading;
var context = GetVisibleInformationReferences(enumerable);
if (context != null)
{
var context2 = context.ToDictionary(kv => kv.Key, kv => kv.Value.ToList());
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CheckContextSize(AiContextType.ServiceRecord, context2, null),
isValid =>
{
if (isValid)
AiConversationButtonState = AiConversationButtonState.Normal;
else
AiConversationButtonState = AiConversationButtonState.Warning;
},
(exp) => AiConversationButtonState = AiConversationButtonState.Disabled);
}
AiChatButtonConversationViewModel.CheckContextSize();
AiChatButtonDocumentationViewModel.CheckContextSize();
}
public void ResetAiAction()
{
_AiActionHistory.Clear();
_AiActionHistory.Add(AktuellerDokutext);
_AiActionHistoryIndex = 0;
FirePropertyChanged(nameof(IsRedoButtonVisible));
FirePropertyChanged(nameof(IsUndoButtonVisible));
}
public void ResetEditAiAction()
{
_EditAiActionHistory.Clear();
_EditAiActionHistory.Add(AktuellerDokutext);
_EditAiActionHistoryIndex = 0;
FirePropertyChanged(nameof(IsEditRedoButtonVisible));
FirePropertyChanged(nameof(IsEditUndoButtonVisible));
}
public Dictionary<TableID, long[]> GetVisibleInformationReferences(IEnumerable<ServiceRecordVM> selected_records)
{
var current = SelectedCustomerNode;
@@ -973,42 +673,6 @@ namespace BeWo.ViewModel.ListViewModel
private DateTime? enddate;
public void UndoAiAction()
{
if (_AiActionHistoryIndex <= 0)
return;
_AiActionHistoryIndex--;
AktuellerDokutext = _AiActionHistory[_AiActionHistoryIndex];
}
public void RedoAiAction()
{
if (_AiActionHistoryIndex >= _AiActionHistory.Count - 1)
return;
_AiActionHistoryIndex++;
AktuellerDokutext = _AiActionHistory[_AiActionHistoryIndex];
}
public void UndoEditAiAction()
{
if (_EditAiActionHistoryIndex <= 0)
return;
_EditAiActionHistoryIndex--;
AktuellerEditDokutext = _EditAiActionHistory[_EditAiActionHistoryIndex];
}
public void RedoEditAiAction()
{
if (_EditAiActionHistoryIndex >= _EditAiActionHistory.Count - 1)
return;
_EditAiActionHistoryIndex++;
AktuellerEditDokutext = _EditAiActionHistory[_EditAiActionHistoryIndex];
}
public List<ServiceRecordVM> CreateFromPrototype()
{
var lResult = new List<ServiceRecordVM>();
@@ -2353,5 +2017,37 @@ namespace BeWo.ViewModel.ListViewModel
return json;
}
public string GetText(string key)
{
if (key == "docu")
{
return AktuellerDokutext;
}
else if(key == "edit_docu")
{
return AktuellerEditDokutext;
}
else
{
throw new BeWoNotImplementedException($"key '{key}' unbekannt");
}
}
public void SetText(string key, string value)
{
if (key == "docu")
{
AktuellerDokutext = value;
}
else if (key == "edit_docu")
{
AktuellerEditDokutext = value;
}
else
{
throw new BeWoNotImplementedException($"key '{key}' unbekannt");
}
}
}
}

View File

@@ -5,6 +5,7 @@ using System.Windows.Threading;
using BeWo.Core.Service;
using BeWo.SchulbegleitenderDienst.ViewModel;
using BeWo.ServiceProxy;
using BeWo.ViewModel.Controls.AI;
using BeWo.ViewModel.ListViewModel;
using BeWo.ViewModel.View.AI;
using BS.Shared;
@@ -912,32 +913,38 @@ namespace BeWo.ViewModel
einheit_vm_list.VMList.Sort(WohneinheitVM.Compare);
}
public static AiConversationChatViewModel CreateAiConversationChatViewModel(AiContextType uIContext, Dictionary<TableID, long[]> bewoObjects,
long? reference_oid = null, bool canSendNewMessage = true)
public static AiConversationChatViewModel CreateAiConversationChatViewModel(AiActionType actionType, AiViewContextDC view_context, List<AiMenuItemTemplate> assistentCommands = null, bool canSendNewMessage = true)
{
var vm = new AiConversationChatViewModel();
vm.AiContext = uIContext;
vm.ContextBeWoObjects = bewoObjects;
vm.ReferenceObjectOid = reference_oid;
vm.ActionType = actionType;
vm.ViewContext = view_context;
vm.CanSendNewMessage = canSendNewMessage;
if (assistentCommands is object)
{
foreach (var command in assistentCommands)
{
vm.ImportAssistentCommand(command);
}
}
return vm;
}
public static AiConversationListVM CreateAiConversationListVM(AiContextType uIContext, long? reference_oid)
public static AiConversationListVM CreateAiConversationListVM(AiActionType actionType, long? reference_oid)
{
var list = ServiceFacade.DoAiEnhancedServiceSnyc(s => s.GetAiConversations(uIContext, reference_oid));
var list = ServiceFacade.DoAiEnhancedServiceSnyc(s => s.GetAiConversations(actionType, reference_oid));
list.Reverse();
return new AiConversationListVM(list);
}
public static void CreateAiConversationListVMAsync(AiContextType uIContext, long? reference_oid, Action<AiConversationListVM> callback)
public static void CreateAiConversationListVMAsync(AiActionType actionType, long? reference_oid, Action<AiConversationListVM> callback)
{
ServiceFacade.DoAiEnhancedServiceAsnyc(
s => s.GetAiConversations(uIContext, reference_oid),
s => s.GetAiConversations(actionType, reference_oid),
cb =>
{
cb.Reverse();
@@ -994,6 +1001,12 @@ namespace BeWo.ViewModel
if (prompt.IsFavorite)
favoriten.SubPrompts.VMList.Add(prompt);
}
foreach (var routine in folder.SubRoutines.VMList)
{
if (routine.IsFavorite)
favoriten.SubRoutines.VMList.Add(routine);
}
}
}
}

View File

@@ -14,6 +14,11 @@ using DevExpress.Mvvm;
using BeWo.ServiceProxy;
using BS.Shared.Extensions;
using System.Diagnostics;
using DevExpress.XtraCharts.Native;
using static DevExpress.Utils.Drawing.Helpers.NativeMethods;
using System.Security.Cryptography;
using BeWo.ViewModel.Controls.AI;
using DevExpress.Charts.Native;
namespace BeWo.ViewModel.View.AI
{
@@ -24,7 +29,6 @@ namespace BeWo.ViewModel.View.AI
private bool _IsSending;
private string _MessageInput;
private string _ContextInput;
private AiModelDC _SelectedModel;
private AiConfigVM _Config;
@@ -36,7 +40,7 @@ namespace BeWo.ViewModel.View.AI
Models = new ObservableSortCollection<AiModelDC>();
SendNewMessageCommand = new DelegateCommand(SendNewMessage, () => ListVM.SelectedVM is object && !string.IsNullOrWhiteSpace(MessageInput) && !IsSending);
OpenNewConversationCommand = new DelegateCommand(OpenNewConversation, () => CanSendNewMessage && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordChat));
OpenNewConversationCommand = new DelegateCommand(OpenNewConversation, () => CanSendNewMessage && ListVM.SelectedVM is object);
StartConversationWithMessageCommand = new DelegateCommand(StartConversationWithMessage, () => CanSendNewMessage && !string.IsNullOrWhiteSpace(MessageInput) && !IsSending);
ReloadConfigCommand = new DelegateCommand(ReloadConfig);
@@ -44,11 +48,11 @@ namespace BeWo.ViewModel.View.AI
ReloadModelsCommand = new DelegateCommand(ReloadModels);
OpenSettingCommand = new DelegateCommand(OpenSetting, () => BeWoApp.AppSettings?.ModuleAiSettingsEnabled ?? false);
RenameCommand = new DelegateCommand(Rename, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordChat) && ListVM.SelectedVM is object);
RenameCommand = new DelegateCommand(Rename, () => ListVM.SelectedVM is object);
OpenCloneCommand = new DelegateCommand(OpenClone, () => ListVM.SelectedVM is object && BeWoAppInfo.IsInAiDeveloperMode);
CloneCommand = new DelegateCommand(Clone);
AskDeleteCommand = new DelegateCommand(AskDelete, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordChat) && ListVM.SelectedVM is object);
AskDeleteCommand = new DelegateCommand(AskDelete, () => ListVM.SelectedVM is object);
SavePromptCommand = new DelegateCommand<AiConversationMessageVM>(SavePrompt, vm => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit));
AcceptSavePromptCommand = new DelegateCommand(AcceptSavePrompt, () => !string.IsNullOrWhiteSpace(SavePromptVM?.Title));
@@ -56,6 +60,8 @@ namespace BeWo.ViewModel.View.AI
ListVM = new AiConversationListVM();
ListVM.SelectedVMChanged += (s, e) => FirePropertyChanged(nameof(IsNewConversationVisible));
AssistentCommands = new List<AiMenuItemTemplate>();
}
public event EventHandler SendNewMessageSuccess;
@@ -63,8 +69,6 @@ namespace BeWo.ViewModel.View.AI
public ICommand SendNewMessageCommand { get; set; }
public ICommand OpenNewConversationCommand { get; set; }
public ICommand StartConversationWithMessageCommand { get; set; }
public ICommand RequestNewConversationCommand { get; set; }
public ICommand TestCommand { get; set; }
public ICommand AskDeleteCommand { get; set; }
public ICommand ReloadConfigCommand { get; set; }
public ICommand ReloadConversationsCommand { get; set; }
@@ -79,8 +83,10 @@ namespace BeWo.ViewModel.View.AI
public ICommand AcceptSavePromptCommand { get; set; }
public ICommand CancelSavePromptCommand { get; set; }
public AiActionType ActionType { get; set; }
public AiViewContextDC ViewContext { get; set; }
public bool CanSendNewMessage { get; set; }
public bool SendAfterLoaded { get; set; }
public AiConversationListVM ListVM { get; set; }
public ObservableCollection<AiModelDC> Models { get; set; }
@@ -121,18 +127,9 @@ namespace BeWo.ViewModel.View.AI
FirePropertyChanged(nameof(MessageInput));
}
}
public string ContextInput
{
get { return _ContextInput; }
set
{
if (ContextInput == value)
return;
public AbstractBaseVM InputItem { get; set; }
_ContextInput = value;
FirePropertyChanged(nameof(ContextInput));
}
}
public List<AiMenuItemTemplate> AssistentCommands { get; protected set; }
public bool IsSettingsOpen
{
@@ -163,10 +160,6 @@ namespace BeWo.ViewModel.View.AI
}
public bool IsNewConversationVisible => ListVM.SelectedVM is null;
public AiContextType AiContext { get; set; }
public long? ReferenceObjectOid { get; set; }
public Dictionary<TableID, long[]> ContextBeWoObjects { get; set; }
public AiPromptbausteinPromptVM SavePromptVM
{
get => _SavePromptVM;
@@ -188,6 +181,10 @@ namespace BeWo.ViewModel.View.AI
}
}
private void OpenNewConversation()
{
ListVM.SelectedVM = null;
}
private void StartConversationWithMessage()
{
StartSending();
@@ -200,8 +197,7 @@ namespace BeWo.ViewModel.View.AI
conv.Created = DateTime.Now;
conv.Updated = DateTime.Now;
conv.UIContext = AiContext;
conv.ContextBeWoObjects = ContextBeWoObjects;
conv.ActionType = ActionType;
conv.Messages = new List<AiConversationMessageDC>()
{
new AiConversationMessageDC()
@@ -214,7 +210,7 @@ namespace BeWo.ViewModel.View.AI
var vm = InsertConverstion(conv);
ServiceFacade.DoAiEnhancedServiceAsnyc(
x => x.CreateAiConversationWithMessage(conv, Config.SelectedModel.Oid.Value, message),
x => x.CreateAiConversationWithMessage(conv, ViewContext, message),
dc => UpdateConverstion(vm, dc),
e =>
{
@@ -228,10 +224,7 @@ namespace BeWo.ViewModel.View.AI
EndSending();
}
}
private void OpenNewConversation()
{
ListVM.SelectedVM = null;
}
private void SendNewMessage()
{
StartSending();
@@ -261,11 +254,7 @@ namespace BeWo.ViewModel.View.AI
conv.Messages.VMList.Add(new AiConversationMessageVM(messages[1]));
MessageInput = string.Empty;
EndSending();
SendNewMessageSuccess?.Invoke(this, EventArgs.Empty);
FinishSending();
},
(exception) =>
{
@@ -286,6 +275,7 @@ namespace BeWo.ViewModel.View.AI
throw new InvalidOperationException("Sendet bereits");
IsSending = true;
IsWaiting = true;
}
private void EndSending()
{
@@ -293,6 +283,7 @@ namespace BeWo.ViewModel.View.AI
throw new InvalidOperationException("Sendet nicht");
IsSending = false;
IsWaiting = false;
}
private AiConversationVM InsertConverstion(AiConversationDC dc)
@@ -308,6 +299,10 @@ namespace BeWo.ViewModel.View.AI
{
vm.UpdateByDataContract(dc);
FinishSending();
}
private void FinishSending()
{
MessageInput = string.Empty;
EndSending();
@@ -355,8 +350,8 @@ namespace BeWo.ViewModel.View.AI
}
private void ReloadConversations()
{
var ui_context = AiContext;
var reference = ReferenceObjectOid;
var ui_context = ActionType;
var reference = ViewContext.Primary;
var list = VMFactory.CreateAiConversationListVM(ui_context, reference);
@@ -453,11 +448,199 @@ namespace BeWo.ViewModel.View.AI
}
public void AcceptSavePrompt()
{
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinPrompt(new List<AiPromptbausteinPromptDC>() { SavePromptVM.CommitToDataContract() }), cb => SavePromptVM = null, exc => SavePromptVM = null);
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinPrompt(SavePromptVM.CommitToDataContract()), cb => SavePromptVM = null, exc => SavePromptVM = null);
}
public void CancelSavePrompt()
{
SavePromptVM = null;
}
public void ImportAssistentCommand(AiMenuItemTemplate origin)
{
var origin_command = origin.Command;
var new_command = new DelegateCommand<AiConversationMessageVM>(x =>
{
origin_command.Execute(x);
Close();
});
var imported_menu_item = new AiMenuItemTemplate()
{
Command = new_command,
Icon = origin.Icon,
Name = origin.Name
};
AssistentCommands.Add(imported_menu_item);
}
internal void Start()
{
if (InputItem is null)
return;
if (InputItem is AiPromptbausteinPromptVM prompt)
{
StartPrompt(prompt);
}
else if (InputItem is AiPromptbausteinRoutineVM routine)
{
StartRoutine(routine);
}
else
{
throw new ArgumentOutOfRangeException(nameof(InputItem));
}
InputItem = null;
}
private void StartPrompt(AiPromptbausteinPromptVM prompt)
{
StartSending();
try
{
var conv = new AiConversationDC();
conv.Created = DateTime.Now;
conv.Updated = DateTime.Now;
conv.ActionType = ActionType;
var vm = InsertConverstion(conv);
Action<Exception> error = (e) =>
{
EndSending();
ListVM.VMList.Remove(vm);
ServiceFacade.EndManuelWaiting();
};
ServiceFacade.StartManuelWaiting();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CreateAiConversation(conv, ViewContext), cb =>
{
vm.UpdateByDataContract(cb);
var msg = prompt.Prompt;
var msg_dc = new AiConversationMessageDC();
msg_dc.Message = msg;
msg_dc.Role = BS.Shared.AiConversationMessageRole.User;
msg_dc.Created = DateTime.Now;
var msg_vm = new AiConversationMessageVM(msg_dc);
vm.Messages.VMList.Add(msg_vm);
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.ExecuteAiConversationWithPrompt(cb.Oid.Value, ViewContext, prompt.DataContract.Oid.Value),
cb2 =>
{
FinishSending();
ServiceFacade.EndManuelWaiting();
vm.Messages.VMList.Remove(msg_vm);
vm.AddMessages(cb2);
}, error);
},
error);
}
catch (Exception ex)
{
EndSending();
}
}
private void StartRoutine(AiPromptbausteinRoutineVM routine)
{
StartSending();
try
{
var conv = new AiConversationDC();
conv.Created = DateTime.Now;
conv.Updated = DateTime.Now;
conv.ActionType = ActionType;
var vm = InsertConverstion(conv);
Action<Exception> error = (e) =>
{
EndSending();
ListVM.VMList.Remove(vm);
ServiceFacade.EndManuelWaiting();
};
ServiceFacade.StartManuelWaiting();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CreateAiConversation(conv, ViewContext), cb =>
{
vm.UpdateByDataContract(cb);
ExecuteChain(routine, 0, error);
}, error);
}
catch (Exception ex)
{
EndSending();
}
}
private void ExecuteChain(AiPromptbausteinRoutineVM routine, int step, Action<Exception> error)
{
if (step >= routine.Steps.Count)
{
FinishSending();
ServiceFacade.EndManuelWaiting();
return;
}
var conv = ListVM.SelectedVM;
var custom_viewContext = new AiViewContextDC
{
References = ViewContext.References,
Primary = ViewContext.Primary
};
if (step > 0 && routine.RoutineType == AiRoutineType.Chain)
{
custom_viewContext.Secondary = conv.Messages.VMList.Last().Message;
}
else
{
custom_viewContext.Secondary = ViewContext.Secondary;
}
var msg = routine.Steps.VMList[step].PromptReference.Prompt;
var msg_dc = new AiConversationMessageDC
{
Message = msg,
Role = AiConversationMessageRole.User,
Created = DateTime.Now
};
var msg_vm = new AiConversationMessageVM(msg_dc);
conv.Messages.VMList.Add(msg_vm);
ServiceFacade.DoAiEnhancedServiceAsnyc(
x => x.ExecuteAiConversationWithRoutine(conv.Oid, custom_viewContext, routine.DataContract.Oid.Value, step),
cb =>
{
conv.Messages.VMList.Remove(msg_vm);
conv.AddMessages(cb);
ExecuteChain(routine, step + 1, error);
}, error);
}
}
}

View File

@@ -4,8 +4,6 @@ using BeWo.ViewModel.ListViewModel;
using BeWo.ViewModel.View.Administration;
using BS.Shared;
using BS.Shared.DataContracts.Compact;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Extensions.CustomInterfaces;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using System;
@@ -20,17 +18,20 @@ using MessageBox = System.Windows.MessageBox;
namespace BeWo.ViewModel.View.AI
{
public class AiPromptbausteinSelectionComplexViewModel : DialogViewModel
public class AiPromptbausteinSelectionComplexViewModel : DialogViewModel, IAiPromptbausteinComplexViewModel
{
public event EventHandler<AiPromptbausteinPromptVM> PromptAccepted;
public event EventHandler<AbstractBaseVM> ItemAccepted;
public event EventHandler VMListReloaded;
private AiPromptbausteinFolderVM _SelectedFolder;
private AiPromptbausteinPromptVM _SelectedPrompt;
private AiPromptbausteinRoutineVM _SelectedRoutine;
private AbstractBaseVM _SelectedItem;
private IBeWoWindowService WindowService { get; set; }
public bool IsFavorite { get; set; }
public DelegateCommand SendCommand { get; set; }
public AiActionType AiActionType { get; set; }
public AiPromptbausteinFolderVM Favoriten { get; set; }
public AiPromptbausteinFolderVM CopiedFolder { get; set; }
public AiPromptbausteinPromptVM CopiedPrompt { get; set; }
@@ -53,11 +54,18 @@ namespace BeWo.ViewModel.View.AI
public DelegateCommand DeleteRoutineCommand { get; private set; }
public DelegateCommand ChangeFavoritenStateRoutineCommand { get; private set; }
public DelegateCommand OpenEditItemDialogCommand { get; private set; }
public DelegateCommand DeleteItemCommand { get; private set; }
public DelegateCommand ChangeFavoritenStateItemCommand { get; private set; }
public bool CanEditPromptbausteine { get; set; }
public bool HasCopiedFolder => CopiedFolder is object;
public bool HasCopiedPrompt => CopiedPrompt is object;
public CompactEmployeeDC CurrentEmployee => BeWoApp.CompactLoggedOnEmployee;
public bool CanOpenContextMenu { get; set; }
public string AcceptButtonText => CanOpenContextMenu ? "Absenden" : "Hinzufügen";
public AiPromptbausteinSelectionComplexViewModel()
{
SendCommand = new DelegateCommand(Send, CanSend, true);
@@ -70,14 +78,15 @@ namespace BeWo.ViewModel.View.AI
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType) : this()
{
AiActionType = aiActionType;
WindowService = BeWoApp.MainControl.WindowService;
WindowService = BeWoApp.WindowService;
InitCommands();
}
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType, AiPromptbausteinFolderListVM viewModel, bool isFavorite = false) : this(aiActionType)
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType, AiPromptbausteinFolderListVM viewModel, bool isFavorite = false, bool canOpen = true) : this(aiActionType)
{
LoadedActionType = aiActionType;
Folders = viewModel;
IsFavorite = isFavorite;
CanOpenContextMenu = canOpen;
}
private void InitCommands()
@@ -88,51 +97,58 @@ namespace BeWo.ViewModel.View.AI
OpenAddPromptDialogCommand = new DelegateCommand(OpenAddPromptDialog, canOpenAddPromptDialog, false);
OpenEditPromptDialogCommand = new DelegateCommand(OpenEditPromptDialog, canOpenEditPromptDialog, false);
CopyPromptCommand = new DelegateCommand(CopyPrompt, canCopyPrompt, false);
PastePromptCommand = new DelegateCommand(PastePrompt, canPastePrompt, false);
DeletePromptCommand = new DelegateCommand(OpenDeletePromptDialog, canOpenDeletePromptDialog, false);
ChangeFavoritenStatePromptCommand = new DelegateCommand(ChangeFavoritenStatePrompt, canChangeFavoritenStatePrompt, false);
OpenAddRoutineDialogCommand = new DelegateCommand(OpenAddRoutineDialog, canOpenAddRoutineDialog, false);
OpenEditRoutineDialogCommand = new DelegateCommand(OpenEditRoutineDialog, canOpenEditRoutineDialog, false);
DeleteRoutineCommand = new DelegateCommand(OpenDeleteRoutineDialog, canOpenDeleteRoutineDialog, false);
ChangeFavoritenStateRoutineCommand = new DelegateCommand(ChangeFavoritenStateRoutine, canChangeFavoritenStateRoutine, false);
Action executeEditItem = () => ExecuteItem(OpenEditPromptDialog, OpenEditRoutineDialog);
Func<bool> canExecuteEditItem = () => canExecuteItem(canOpenEditPromptDialog, canOpenEditRoutineDialog);
OpenEditItemDialogCommand = new DelegateCommand(executeEditItem, canExecuteEditItem, true);
Action executeDeleteItem = () => ExecuteItem(OpenDeletePromptDialog, OpenDeleteRoutineDialog);
Func<bool> canExecuteDeleteItem = () => canExecuteItem(canOpenDeletePromptDialog, canOpenDeleteRoutineDialog);
DeleteItemCommand = new DelegateCommand(executeDeleteItem, canExecuteDeleteItem, true);
Action executeFavoriteItem = () => ExecuteItem(ChangeFavoritenStatePrompt, ChangeFavoritenStateRoutine);
Func<bool> canExecuteFavoriteItem = () => canExecuteItem(canChangeFavoritenStatePrompt, canChangeFavoritenStateRoutine);
ChangeFavoritenStateItemCommand = new DelegateCommand(executeFavoriteItem, canExecuteFavoriteItem, true);
CanEditPromptbausteine = BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit);
}
public bool IsFavorite { get; set; }
public DelegateCommand SendCommand { get; set; }
public AiActionType AiActionType { get; set; }
public AiPromptbausteinFolderVM SelectedFolder
{
get => _SelectedFolder;
set
{
SetProperty(ref _SelectedFolder, value, nameof(SelectedFolder));
if (SelectedPrompt is object)
var success = SetProperty(ref _SelectedFolder, value, nameof(SelectedFolder));
if (SelectedItem is AiPromptbausteinPromptVM vm)
{
SelectedPrompt.IsSelected = false;
SelectedPrompt = null;
SelectedItem = null;
}
if (!success)
return;
UpdateFolderCommands();
UpdatePromptCommands();
}
}
public AiPromptbausteinPromptVM SelectedPrompt
public AbstractBaseVM SelectedItem
{
get => _SelectedPrompt;
get => _SelectedItem;
set
{
SetProperty(ref _SelectedPrompt, value, nameof(SelectedPrompt));
SetProperty(ref _SelectedItem, value, nameof(SelectedItem));
SendCommand.RaiseCanExecuteChanged();
}
}
public AiPromptbausteinRoutineVM SelectedRoutine
{
get => _SelectedRoutine;
set
{
SetProperty(ref _SelectedRoutine, value, nameof(SelectedRoutine));
UpdateItemCommands();
}
}
public AiPromptbausteinFolderListVM Folders { get; private set; }
@@ -147,28 +163,40 @@ namespace BeWo.ViewModel.View.AI
return true;
#endif
return Folders.Count > 3 && Folders.VMList[0].Prompts.Count > 0;
return Folders.Count > 3 && (Folders.VMList[0].Prompts.Count > 0 || Folders.VMList[0].Routines.Count > 0);
}
}
public void ResetSelection()
{
// Bisherige Tree-Selektion zurücknehmen, damit nicht zwei Knoten als selektiert markiert sind.
if (SelectedFolder != null)
SelectedFolder.IsSelected = false;
SelectedFolder = null;
if (IsFavorite)
SelectedFolder = Folders.VMList[0];
// Favoriten-Popup: Favoriten (VMList[0]), sonst "Eigene" (VMList[1]) vorauswählen.
var target = IsFavorite
? (Folders.VMList.Count > 0 ? Folders.VMList[0] : null)
: (Folders.VMList.Count > 1 ? Folders.VMList[1] : null);
if (target != null)
{
target.IsSelected = true;
SelectedFolder = target;
}
}
public void Send()
{
var selected_prompt = SelectedPrompt;
var selected_prompt = SelectedItem;
CloseDialogCommand.Execute(null);
Close();
PromptAccepted?.Invoke(this, selected_prompt);
ItemAccepted?.Invoke(this, selected_prompt);
}
public bool CanSend()
{
return SelectedPrompt is object;
return SelectedItem is AiPromptbausteinPromptVM || (SelectedItem is AiPromptbausteinRoutineVM routine && routine.IsValid);
}
public void InitVMList()
{
@@ -200,6 +228,10 @@ namespace BeWo.ViewModel.View.AI
SelectedFolder = Favoriten;
}
// "Eigene" (VMList[1]) im normalen Modus vorauswählen.
if (!IsFavorite && Folders.VMList.Count > 1)
Folders.VMList[1].IsSelected = true;
FirePropertyChanged(nameof(HasFavoriten));
}
@@ -225,6 +257,12 @@ namespace BeWo.ViewModel.View.AI
DeleteRoutineCommand?.RaiseCanExecuteChanged();
ChangeFavoritenStateRoutineCommand?.RaiseCanExecuteChanged();
}
public void UpdateItemCommands()
{
OpenEditItemDialogCommand?.RaiseCanExecuteChanged();
DeleteItemCommand?.RaiseCanExecuteChanged();
ChangeFavoritenStateItemCommand?.RaiseCanExecuteChanged();
}
// --- Folder Commands ---
@@ -238,17 +276,15 @@ namespace BeWo.ViewModel.View.AI
new_vm.ParentFolderOid = sel_folder?.DataContract?.Oid;
new_vm.CanAddFolder = true;
new_vm.CanAddPrompt = true;
new_vm.CanAddRoutine = true;
new_vm.CanEdit = true;
new_vm.ActionType = AiActionType;
var vm = new AiPromptbausteinFolderViewModel(new_vm, true);
vm.Accept_Button_Clicked += (s, e) =>
vm.DataSaved += (s, new_dc) =>
{
var new_dc = new_vm.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinFolder(new List<AiPromptbausteinFolderDC> { new_dc }),
(new_dcs) => ReloadVMList());
ReloadVMList();
};
Close();
@@ -266,12 +302,9 @@ namespace BeWo.ViewModel.View.AI
var vm = new AiPromptbausteinFolderViewModel(edit_vm, false);
vm.Accept_Button_Clicked += (s, e) =>
vm.DataSaved += (s, new_dc) =>
{
var edit_dc = edit_vm.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinFolder(new List<AiPromptbausteinFolderDC> { edit_dc }),
(update_dc) => ReloadVMList());
ReloadVMList();
};
Close();
@@ -287,12 +320,9 @@ namespace BeWo.ViewModel.View.AI
if (result != MessageBoxResult.OK)
return;
var oid2version = new Dictionary<long, long>()
{
{sel_folder.DataContract.Oid.Value, sel_folder.DataContract.Version.Value}
};
var delete_dc = sel_folder.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.DeleteAiPromptbausteinFolder(oid2version),
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.DeleteAiPromptbausteinFolder(delete_dc),
() => ReloadVMList());
}
@@ -301,7 +331,6 @@ namespace BeWo.ViewModel.View.AI
bool canDeleteFolder() => CanEditPromptbausteine && (SelectedFolder?.CanEdit ?? false);
// --- Prompt Commands ---
void OpenAddPromptDialog()
{
var sel_folder = SelectedFolder;
@@ -314,14 +343,11 @@ namespace BeWo.ViewModel.View.AI
new_vm.CanEdit = true;
new_vm.ActionType = AiActionType;
var vm = new AiPromptbausteinPromptViewModel(new_vm, true);
var vm = new AiPromptbausteinPromptViewModel(new_vm);
vm.Accept_Button_Clicked += (s, e) =>
vm.DataSaved += (s, e) =>
{
var new_dc = new_vm.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinPrompt(new List<AiPromptbausteinPromptDC> { new_dc }),
(new_dcs) => ReloadVMList());
ReloadVMList();
};
Close();
@@ -330,81 +356,232 @@ namespace BeWo.ViewModel.View.AI
}
void OpenEditPromptDialog()
{
var sel_prompt = SelectedPrompt;
var sel_prompt = SelectedItem as AiPromptbausteinPromptVM;
if (SelectedItem is null)
throw new Exception("invalid operation");
var sel_dc = sel_prompt.CopyToEmptyDataContract();
sel_dc.CanEdit = SelectedPrompt.CanEdit;
sel_dc.CanEdit = sel_prompt.CanEdit;
sel_dc.Oid = sel_prompt.DataContract.Oid;
sel_dc.Version = sel_prompt.DataContract.Version;
var edit_vm = new AiPromptbausteinPromptVM(sel_dc);
var vm = new AiPromptbausteinPromptViewModel(edit_vm, false);
var vm = new AiPromptbausteinPromptViewModel(edit_vm);
vm.Accept_Button_Clicked += (s, e) =>
vm.DataSaved += (s, e) =>
{
var edit_dc = edit_vm.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinPrompt(new List<AiPromptbausteinPromptDC> { edit_dc }),
(update_dc) => ReloadVMList());
ReloadVMList();
};
Close();
WindowService.Show(vm);
}
void CopyPrompt()
{
CopiedPrompt = SelectedItem as AiPromptbausteinPromptVM;
}
void PastePrompt()
{
var copied_dc = CopiedPrompt.CommitToDataContract();
copied_dc.Creator = CurrentEmployee;
copied_dc.CanEdit = true;
copied_dc.IsPublic = false;
copied_dc.IsFavorite = false;
copied_dc.Oid = null;
copied_dc.Version = null;
copied_dc.ParentFolderOid = SelectedFolder.DataContract.Oid;
copied_dc.ActionType = AiActionType;
copied_dc.PromptId = null;
copied_dc.ShowPrompt = true;
copied_dc.ShowPromptByTenant = true;
copied_dc.IsOwnsoftPrompt = false;
var copied_vm = new AiPromptbausteinPromptVM(copied_dc);
SelectedFolder.SubPrompts.VMList.Add(copied_vm);
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinPrompt(copied_dc),
new_dc =>
{
copied_vm.UpdateByDataContract(new_dc);
SelectedFolder.SubPrompts.VMList.Add(copied_vm);
SelectedItem = copied_vm;
});
}
void OpenDeletePromptDialog()
{
var sel_prompt = SelectedPrompt;
var sel_prompt = SelectedItem as AiPromptbausteinPromptVM;
var folder = SelectedFolder;
var result = MessageBox.Show("Möchten Sie den ausgewählten Prompt wirklich löschen?", "Hinweis", MessageBoxButton.OKCancel);
var txt = "Möchten Sie den ausgewählten Prompt wirklich löschen?";
var result = MessageBox.Show(txt, "Hinweis", MessageBoxButton.OKCancel);
if (result != MessageBoxResult.OK)
return;
var oid2version = new Dictionary<long, long>()
if (sel_prompt.IsFavorite)
{
{sel_prompt.DataContract.Oid.Value, sel_prompt.DataContract.Version.Value}
};
sel_prompt.IsFavorite = false;
}
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.DeleteAiPromptbausteinPrompt(oid2version),
() => ReloadVMList());
var delete_dc = sel_prompt.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.DeleteAiPromptbausteinPrompt(delete_dc),
() =>
{
ReloadVMList();
});
}
void ChangeFavoritenStatePrompt()
{
var sel_prompt = SelectedPrompt;
var sel_prompt = SelectedItem as AiPromptbausteinPromptVM;
sel_prompt.IsFavorite = !sel_prompt.IsFavorite;
var edit_dc = sel_prompt.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinPrompt(new List<AiPromptbausteinPromptDC> { edit_dc }),
(update_dc) => ReloadVMList());
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinPrompt(edit_dc),
new_dc =>
{
ReloadVMList();
});
}
bool canOpenAddPromptDialog() => CanEditPromptbausteine && (SelectedFolder?.CanAddPrompt ?? false);
bool canOpenEditPromptDialog() => SelectedPrompt is object;
bool canOpenDeletePromptDialog() => CanEditPromptbausteine && (SelectedPrompt?.CanEdit ?? false);
bool canChangeFavoritenStatePrompt() => SelectedPrompt is object;
bool canOpenAddPromptDialog()
{
return CanEditPromptbausteine && (SelectedFolder?.CanAddPrompt ?? false);
}
bool canOpenEditPromptDialog()
{
return SelectedItem as AiPromptbausteinPromptVM is object;
}
bool canCopyPrompt()
{
return CanEditPromptbausteine && SelectedItem is AiPromptbausteinPromptVM prompt && prompt.ShowPrompt;
}
bool canPastePrompt()
{
return canOpenAddPromptDialog() && HasCopiedPrompt;
}
bool canOpenDeletePromptDialog()
{
return CanEditPromptbausteine && ((SelectedItem as AiPromptbausteinPromptVM)?.CanEdit ?? false);
}
bool canChangeFavoritenStatePrompt()
{
return SelectedItem as AiPromptbausteinPromptVM is object;
}
// --- Routine Commands
void OpenAddRoutineDialog()
{
var sel_folder = SelectedFolder;
var new_vm = sel_folder.SubRoutines.CreateNewVM();
new_vm.Creator = CurrentEmployee;
new_vm.ParentFolderOid = sel_folder.DataContract.Oid;
new_vm.CanEdit = true;
new_vm.ActionType = AiActionType;
var vm = new AiPromptbausteinRoutineViewModel(new_vm, Folders);
vm.DataSaved += (s, e) =>
{
ReloadVMList();
};
Close();
WindowService.Show(vm);
}
void OpenEditRoutineDialog()
{
var sel_prompt = SelectedItem as AiPromptbausteinRoutineVM;
if (SelectedItem is null)
throw new Exception("invalid operation");
var sel_dc = sel_prompt.CopyToEmptyDataContract();
sel_dc.CanEdit = sel_prompt.CanEdit;
sel_dc.Oid = sel_prompt.DataContract.Oid;
sel_dc.Version = sel_prompt.DataContract.Version;
var edit_vm = new AiPromptbausteinRoutineVM(sel_dc);
var vm = new AiPromptbausteinRoutineViewModel(edit_vm, Folders);
vm.DataSaved += (s, e) =>
{
ReloadVMList();
};
Close();
WindowService.Show(vm);
}
void OpenDeleteRoutineDialog()
{
var sel_prompt = SelectedItem as AiPromptbausteinRoutineVM;
var folder = SelectedFolder;
var txt = "Möchten Sie die ausgewählte Routine wirklich löschen?";
var result = MessageBox.Show(txt, "Hinweis", MessageBoxButton.OKCancel);
if (result != MessageBoxResult.OK)
return;
if (sel_prompt.IsFavorite)
{
sel_prompt.IsFavorite = false;
}
var delete_dc = sel_prompt.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.DeleteAiPromptbausteinRoutine(delete_dc),
() =>
{
ReloadVMList();
});
}
void ChangeFavoritenStateRoutine()
{
var sel_routine = SelectedItem as AiPromptbausteinRoutineVM;
sel_routine.IsFavorite = !sel_routine.IsFavorite;
var edit_dc = sel_routine.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinRoutine(edit_dc),
new_dc =>
{
ReloadVMList();
});
}
bool canOpenAddRoutineDialog() => CanEditPromptbausteine && (SelectedFolder?.CanAddPrompt ?? false);
bool canOpenEditRoutineDialog() => SelectedRoutine is object;
bool canOpenDeleteRoutineDialog() => CanEditPromptbausteine && (SelectedRoutine?.CanEdit ?? false);
bool canChangeFavoritenStateRoutine() => SelectedRoutine is object;
bool canOpenEditRoutineDialog() => SelectedItem is AiPromptbausteinRoutineVM;
bool canOpenDeleteRoutineDialog() => CanEditPromptbausteine && ((SelectedItem as AiPromptbausteinRoutineVM)?.CanEdit ?? false);
bool canChangeFavoritenStateRoutine() => SelectedItem is AiPromptbausteinRoutineVM;
void ExecuteItem(Action prompt_action, Action routine_action)
{
if (SelectedItem is AiPromptbausteinPromptVM)
prompt_action();
else if (SelectedItem is AiPromptbausteinRoutineVM)
routine_action();
else
throw new NotImplementedException("item is not AiPromptbausteinPromptVM or AiPromptbausteinRoutineVM");
}
bool canExecuteItem(Func<bool> prompt_func, Func<bool> routine_func)
{
if (SelectedItem is AiPromptbausteinPromptVM)
return prompt_func();
else if (SelectedItem is AiPromptbausteinRoutineVM)
return routine_func();
return false;
}
}
}

View File

@@ -5,44 +5,69 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace BeWo.ViewModel.View
{
public class AcceptCancelDialogViewModel : DialogViewModel
public abstract class AcceptCancelDialogViewModel : DialogViewModel
{
public event EventHandler Accept_Button_Clicked;
public event EventHandler Cancel_Button_Clicked;
public DelegateCommand SaveCommand { get; set; }
public AcceptCancelDialogViewModel() : base()
protected AcceptCancelDialogViewModel() : base()
{
AcceptCommand = new DelegateCommand(Accept, canAccept, false);
CancelCommand = new DelegateCommand(Cancel, canCancel, false);
SaveCommand = new DelegateCommand(Save, canSave, false);
}
public DelegateCommand AcceptCommand { get; set; }
public DelegateCommand CancelCommand { get; set; }
public void Accept()
protected virtual void Save()
{
Accept_Button_Clicked?.Invoke(this, EventArgs.Empty);
throw new NotImplementedException();
}
protected virtual bool canSave()
{
return false;
}
}
public class AcceptCancelDialogViewModel<DCType, VMType> : AcceptCancelDialogViewModel where VMType : AbstractDCMapperVM<DCType> where DCType : new()
{
public event EventHandler<DCType> DataSaved;
public VMType ViewModel { get; set; }
public string AcceptButtonText => ViewModel.IsNew ? "Hinzufügen" : "Speichern";
public AcceptCancelDialogViewModel(VMType viewModel) : base()
{
ViewModel = viewModel;
ViewModel.PropertyChanged += (s, e) =>
{
SaveCommand.RaiseCanExecuteChanged();
};
}
protected void DataSave(DCType dCType)
{
DataSaved?.Invoke(this, dCType);
Close();
}
public void Cancel()
protected override void Close()
{
Cancel_Button_Clicked?.Invoke(this, EventArgs.Empty);
Close();
base.Close();
}
protected virtual bool canAccept()
protected override bool canSave()
{
return true;
return ViewModel.IsNew || ViewModel.IsDirty;
}
protected virtual bool canCancel()
protected virtual bool isDirty()
{
return true;
return false;
}
}
}

View File

@@ -4,8 +4,9 @@ using BeWo.ViewModel.ListViewModel;
using BS.Shared;
using BS.Shared.DataContracts.Compact;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Extensions.CustomInterfaces;
using DevExpress.DataProcessing;
using DevExpress.Mvvm;
using DevExpress.Utils.Extensions;
using DevExpress.Xpf.Layout.Core;
using System;
using System.Collections.Generic;
@@ -15,12 +16,14 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using static DevExpress.Utils.Drawing.Helpers.NativeMethods;
namespace BeWo.ViewModel.View.Administration
{
public class AiPromptbausteinComplexTreeViewModel : WindowViewModel
public class AiPromptbausteinComplexTreeViewModel : WindowViewModel, IAiPromptbausteinComplexViewModel
{
private AiPromptbausteinFolderVM _SelectedFolder;
private AbstractBaseVM _SelectedItem;
private IBeWoWindowService WindowService { get; set; }
private AiActionType AiActionType { get; set; }
@@ -28,7 +31,6 @@ namespace BeWo.ViewModel.View.Administration
public AiPromptbausteinFolderListVM Folders { get; set; }
public AiPromptbausteinFolderVM Favoriten { get; set; }
public AiPromptbausteinPromptVM SelectedPrompt { get; set; }
public AiPromptbausteinFolderVM CopiedFolder { get; set; }
public AiPromptbausteinPromptVM CopiedPrompt { get; set; }
@@ -45,20 +47,56 @@ namespace BeWo.ViewModel.View.Administration
public DelegateCommand DeletePromptCommand { get; private set; }
public DelegateCommand ChangeFavoritenStatePromptCommand { get; private set; }
public DelegateCommand OpenAddRoutineDialogCommand { get; private set; }
public DelegateCommand OpenEditRoutineDialogCommand { get; private set; }
public DelegateCommand DeleteRoutineCommand { get; private set; }
public DelegateCommand ChangeFavoritenStateRoutineCommand { get; private set; }
public DelegateCommand OpenEditItemDialogCommand { get; private set; }
public DelegateCommand DeleteItemCommand { get; private set; }
public DelegateCommand ChangeFavoritenStateItemCommand { get; private set; }
public bool CanEditPromptbausteine { get; set; }
public AiPromptbausteinFolderVM SelectedFolder
{
get => _SelectedFolder;
set => SetProperty(ref _SelectedFolder, value, nameof(SelectedFolder));
set
{
var success = SetProperty(ref _SelectedFolder, value, nameof(SelectedFolder));
if (SelectedItem is AiPromptbausteinPromptVM vm)
{
SelectedItem = null;
}
if (!success)
return;
UpdateFolderCommands();
UpdatePromptCommands();
}
}
public AbstractBaseVM SelectedItem
{
get => _SelectedItem;
set {
var success = SetProperty(ref _SelectedItem, value, nameof(SelectedItem));
if (!success)
return;
UpdateItemCommands();
}
}
public AiPromptbausteinComplexTreeViewModel() : this(null, AiActionType.ServiceRecordConversation)
{
if (BeWoApp.IsInDesignMode)
{
ReloadVMList();
//ReloadVMList();
InitDesigner();
SelectedFolder = Folders.VMList.FirstOrDefault();
return;
}
@@ -81,6 +119,23 @@ namespace BeWo.ViewModel.View.Administration
DeletePromptCommand = new DelegateCommand(OpenDeletePromptDialog, canOpenDeletePromptDialog, false);
ChangeFavoritenStatePromptCommand = new DelegateCommand(ChangeFavoritenStatePrompt, canChangeFavoritenStatePrompt, false);
OpenAddRoutineDialogCommand = new DelegateCommand(OpenAddRoutineDialog, canOpenAddRoutineDialog, false);
OpenEditRoutineDialogCommand = new DelegateCommand(OpenEditRoutineDialog, canOpenEditRoutineDialog, false);
DeleteRoutineCommand = new DelegateCommand(OpenDeleteRoutineDialog, canOpenDeleteRoutineDialog, false);
ChangeFavoritenStateRoutineCommand = new DelegateCommand(ChangeFavoritenStateRoutine, canChangeFavoritenStateRoutine, false);
Action executeEditItem = () => ExecuteItem(OpenEditPromptDialog, OpenEditRoutineDialog);
Func<bool> canExecuteEditItem = () => canExecuteItem(canOpenEditPromptDialog, canOpenEditRoutineDialog);
OpenEditItemDialogCommand = new DelegateCommand(executeEditItem, canExecuteEditItem, true);
Action executeDeleteItem = () => ExecuteItem(OpenDeletePromptDialog, OpenDeleteRoutineDialog);
Func<bool> canExecuteDeleteItem = () => canExecuteItem(canOpenDeletePromptDialog, canOpenDeleteRoutineDialog);
DeleteItemCommand = new DelegateCommand(executeDeleteItem, canExecuteDeleteItem, true);
Action executeFavoriteItem = () => ExecuteItem(ChangeFavoritenStatePrompt, ChangeFavoritenStateRoutine);
Func<bool> canExecuteFavoriteItem = () => canExecuteItem(canChangeFavoritenStatePrompt, canChangeFavoritenStateRoutine);
ChangeFavoritenStateItemCommand = new DelegateCommand(executeFavoriteItem, canExecuteFavoriteItem, true);
CanEditPromptbausteine = BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit);
}
@@ -88,11 +143,11 @@ namespace BeWo.ViewModel.View.Administration
{
get
{
return Folders?.ContainsDirtyObject() ?? false;
return false;
}
}
public bool HasCopiedFolder => CopiedFolder is object;
public bool HasCopiedPrompt => CopiedPrompt is object;
public bool HasCopiedPrompt => CopiedPrompt is object;
public CompactEmployeeDC CurrentEmployee => BeWoApp.CompactLoggedOnEmployee;
public void UpdateFolderCommands()
@@ -102,7 +157,7 @@ namespace BeWo.ViewModel.View.Administration
CopyFolderCommand.RaiseCanExecuteChanged();
PasteFolderCommand.RaiseCanExecuteChanged();
DeleteFolderCommand.RaiseCanExecuteChanged();
}
}
public void UpdatePromptCommands()
{
OpenAddPromptDialogCommand.RaiseCanExecuteChanged();
@@ -111,63 +166,18 @@ namespace BeWo.ViewModel.View.Administration
PastePromptCommand.RaiseCanExecuteChanged();
DeletePromptCommand.RaiseCanExecuteChanged();
ChangeFavoritenStatePromptCommand.RaiseCanExecuteChanged();
OpenAddRoutineDialogCommand.RaiseCanExecuteChanged();
OpenEditRoutineDialogCommand.RaiseCanExecuteChanged();
DeleteRoutineCommand.RaiseCanExecuteChanged();
ChangeFavoritenStateRoutineCommand.RaiseCanExecuteChanged();
}
public void SaveVMList()
public void UpdateItemCommands()
{
if (!IsDirty)
return;
// DFS -> 1. Sobald Knoten gefunden wird mit IsNew=true: Teilbaum als neu markieren
// 2. Sobald Knoten gefunden wird mit IsNew=false && IsDirty=true: Knoten als update markieren
// 3. Checken, welche Knoten gelöscht wurden
var toadd_folder = new List<AiPromptbausteinFolderVM>();
var toadd_prompts = new List<AiPromptbausteinPromptDC>();
var toupdate_folder = new List<AiPromptbausteinFolderVM>();
var toupdate_prompt = new List<AiPromptbausteinPromptDC>();
DFS_Search_AddUpdate(Folders, ref toadd_folder, ref toadd_prompts, ref toupdate_folder, ref toupdate_prompt);
var todelete_folder = new List<AiPromptbausteinFolderDC>();
var todelete_prompt = new List<AiPromptbausteinPromptDC>();
DFS_Search_Delete(Folders, ref todelete_folder, ref todelete_prompt);
var toadd_folder_dcs = toadd_folder.Select(x => x.CommitToDataContract());
var toupdate_folder_dcs = toupdate_folder.Select(x => x.CommitToDataContract());
var actions = new List<Action<IAiEnhancedService>>();
if (toadd_folder.Any())
actions.Add(x => x.InsertAiPromptbausteinFolder(toadd_folder_dcs.ToList()));
if (toadd_prompts.Any())
actions.Add(x => x.InsertAiPromptbausteinPrompt(toadd_prompts.ToList()));
if (toupdate_folder_dcs.Any())
{
foreach (var folder_dc in toupdate_folder_dcs)
{
folder_dc.SubPrompts = null;
folder_dc.SubFolders = null;
}
actions.Add(x => x.UpdateAiPromptbausteinFolder(toupdate_folder_dcs.ToList()));
}
if (toupdate_prompt.Any())
actions.Add(x => x.UpdateAiPromptbausteinPrompt(toupdate_prompt.ToList()));
if (todelete_folder.Any())
actions.Add(x => x.DeleteAiPromptbausteinFolder(todelete_folder.ToDictionary(x1 => x1.Oid.Value, x2 => x2.Version.Value)));
if (todelete_prompt.Any())
actions.Add(x => x.DeleteAiPromptbausteinPrompt(todelete_prompt.ToDictionary(x1 => x1.Oid.Value, x2 => x2.Version.Value)));
ServiceFacade.DoMultipleAiEnhancedServicesAsync(actions, () =>
{
ReloadVMList();
});
OpenEditItemDialogCommand.RaiseCanExecuteChanged();
DeleteItemCommand.RaiseCanExecuteChanged();
ChangeFavoritenStateItemCommand.RaiseCanExecuteChanged();
}
internal void ReloadVMList()
{
VMFactory.CreateAiPromptbausteinFolderListVMAsync(
@@ -179,80 +189,14 @@ namespace BeWo.ViewModel.View.Administration
{
Favoriten = Folders.VMList[0];
}
if (Folders.VMList.Count > 1)
Folders.VMList[1].IsSelected = true;
FirePropertyChanged(nameof(Folders));
});
}
void DFS_Search_AddUpdate(AiPromptbausteinFolderListVM folders, ref List<AiPromptbausteinFolderVM> toadd_Folder, ref List<AiPromptbausteinPromptDC> toadd_Prompts, ref List<AiPromptbausteinFolderVM> toupdate_Folder, ref List<AiPromptbausteinPromptDC> toupdate_Prompt)
{
foreach (var node in folders.VMList)
{
// Favoriten ignorieren
if (node.DataContract.Oid is long oid && oid < -4)
continue;
// Öffentlich
if (node.DataContract.Oid is long oid2 && oid2 < -1){
DFS_Search_UpdatePromptFavorite(node.SubFolders, ref toadd_Folder, ref toadd_Prompts, ref toupdate_Folder, ref toupdate_Prompt);
if (node.SubPrompts.ChangedCount > 0)
toupdate_Prompt.AddRange(node.SubPrompts.CommitChanged());
continue;
}
// Eigene
if (node.IsNew)
{
toadd_Folder.Add(node);
}
else
{
if (node.IsDirty)
toupdate_Folder.Add(node);
if (node.HasSubFolders)
DFS_Search_AddUpdate(node.SubFolders, ref toadd_Folder, ref toadd_Prompts, ref toupdate_Folder, ref toupdate_Prompt);
if (node.SubPrompts.AddedCount > 0)
toadd_Prompts.AddRange(node.SubPrompts.CommitAdded());
if (node.SubPrompts.ChangedCount > 0)
toupdate_Prompt.AddRange(node.SubPrompts.CommitChanged());
}
}
}
void DFS_Search_UpdatePromptFavorite(AiPromptbausteinFolderListVM folders, ref List<AiPromptbausteinFolderVM> toadd_Folder, ref List<AiPromptbausteinPromptDC> toadd_Prompts, ref List<AiPromptbausteinFolderVM> toupdate_Folder, ref List<AiPromptbausteinPromptDC> toupdate_Prompt)
{
foreach (var node in folders.VMList)
{
if (node.HasSubFolders)
DFS_Search_UpdatePromptFavorite(node.SubFolders, ref toadd_Folder, ref toadd_Prompts, ref toupdate_Folder, ref toupdate_Prompt);
if (node.SubPrompts.ChangedCount > 0)
toupdate_Prompt.AddRange(node.SubPrompts.CommitChanged());
}
}
void DFS_Search_Delete(AiPromptbausteinFolderListVM folders, ref List<AiPromptbausteinFolderDC> todelete_Folder, ref List<AiPromptbausteinPromptDC> todelete_Prompt)
{
foreach (var node_dc in folders.DCBackup)
{
if (node_dc.Oid is long oid && oid < -1)
continue;
if (folders.VMList.FirstOrDefault(vm => vm.DataContract == node_dc) is AiPromptbausteinFolderVM node_vm)
{
if (node_vm.SubFolders.DCBackup is object && node_vm.SubFolders.DCBackup.Count > 0)
DFS_Search_Delete(node_vm.SubFolders, ref todelete_Folder, ref todelete_Prompt);
if (node_vm.SubPrompts.RemovedCount > 0)
todelete_Prompt.AddRange(node_vm.SubPrompts.GetRemoved());
}
else
{
todelete_Folder.Add(node_dc);
}
}
}
void OpenAddFolderDialog()
{
var sel_folder = SelectedFolder;
@@ -263,13 +207,15 @@ namespace BeWo.ViewModel.View.Administration
new_vm.ParentFolderOid = sel_folder?.DataContract?.Oid;
new_vm.CanAddFolder = true;
new_vm.CanAddPrompt = true;
new_vm.CanAddRoutine = true;
new_vm.CanEdit = true;
new_vm.ActionType = AiActionType;
var vm = new AiPromptbausteinFolderViewModel(new_vm, true);
vm.Accept_Button_Clicked += (s, e) =>
vm.DataSaved += (s, new_dc) =>
{
new_vm.UpdateByDataContract(new_dc);
sel_folder.SubFolders.VMList.Add(new_vm);
sel_folder.IsExpanded = true;
};
@@ -281,14 +227,15 @@ namespace BeWo.ViewModel.View.Administration
var sel_folder = SelectedFolder;
var sel_dc = sel_folder.CopyToEmptyDataContract();
sel_dc.CanEdit = SelectedFolder.CanEdit;
sel_dc.Oid = sel_folder.DataContract.Oid;
sel_dc.Version = sel_folder.DataContract.Version;
var edit_vm = new AiPromptbausteinFolderVM(sel_dc);
var vm = new AiPromptbausteinFolderViewModel(edit_vm, false);
vm.Accept_Button_Clicked += (s, e) =>
vm.DataSaved += (s, new_dc) =>
{
var edit_dc = edit_vm.CommitToDataContract();
sel_folder.UpdateByDataContract(edit_dc);
sel_folder.UpdateByDataContract(new_dc);
};
WindowService.Show(vm);
@@ -312,12 +259,14 @@ namespace BeWo.ViewModel.View.Administration
if (result != MessageBoxResult.OK)
return;
parent.SubFolders.VMList.Remove(sel_folder);
var delete_dc = sel_folder.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.DeleteAiPromptbausteinFolder(delete_dc),
() => parent.SubFolders.VMList.Remove(sel_folder));
}
bool canOpenAddFolderDialog()
{
return CanEditPromptbausteine && (SelectedFolder?.CanAddFolder ?? true);
return CanEditPromptbausteine && (SelectedFolder?.CanAddFolder ?? false);
}
bool canOpenEditFolderDialog()
{
@@ -350,31 +299,36 @@ namespace BeWo.ViewModel.View.Administration
new_vm.CanEdit = true;
new_vm.ActionType = AiActionType;
var vm = new AiPromptbausteinPromptViewModel(new_vm, true);
var vm = new AiPromptbausteinPromptViewModel(new_vm);
vm.Accept_Button_Clicked += (s, e) =>
vm.DataSaved += (s, new_dc) =>
{
new_vm.UpdateByDataContract(new_dc);
sel_folder.SubPrompts.VMList.Add(new_vm);
SelectedPrompt = new_vm;
SelectedItem = new_vm;
};
WindowService.Show(vm);
}
void OpenEditPromptDialog()
{
var sel_prompt = SelectedPrompt;
var sel_prompt = SelectedItem as AiPromptbausteinPromptVM;
if (SelectedItem is null)
throw new Exception("invalid operation");
var sel_dc = sel_prompt.CopyToEmptyDataContract();
sel_dc.CanEdit = SelectedPrompt.CanEdit;
sel_dc.CanEdit = sel_prompt.CanEdit;
sel_dc.Oid = sel_prompt.DataContract.Oid;
sel_dc.Version = sel_prompt.DataContract.Version;
var edit_vm = new AiPromptbausteinPromptVM(sel_dc);
var vm = new AiPromptbausteinPromptViewModel(edit_vm, false);
var vm = new AiPromptbausteinPromptViewModel(edit_vm);
vm.Accept_Button_Clicked += (s, e) =>
vm.DataSaved += (s, new_dc) =>
{
var edit_dc = edit_vm.CommitToDataContract();
sel_prompt.UpdateByDataContract(edit_dc);
UpdateSelectedPromptFavorite(sel_prompt);
sel_prompt.UpdateByDataContract(new_dc);
UpdateSelectedPromptFavorite(sel_prompt);
};
WindowService.Show(vm);
@@ -383,7 +337,7 @@ namespace BeWo.ViewModel.View.Administration
private void UpdateSelectedPromptFavorite(AiPromptbausteinPromptVM sel_prompt = null)
{
if (sel_prompt is null)
sel_prompt = SelectedPrompt;
sel_prompt = SelectedItem as AiPromptbausteinPromptVM;
if (sel_prompt.IsFavorite && !Favoriten.SubPrompts.VMList.Contains(sel_prompt))
Favoriten.SubPrompts.VMList.Add(sel_prompt);
@@ -391,7 +345,27 @@ namespace BeWo.ViewModel.View.Administration
{
Favoriten.SubPrompts.VMList.Remove(sel_prompt);
if (Favoriten.SubPrompts.Count == 0)
if (Favoriten.SubRoutines.Count == 0 && Favoriten.SubPrompts.Count == 0)
{
var selected_folder = SelectedFolder;
SelectedFolder = null;
SelectedFolder = selected_folder;
}
}
}
private void UpdateSelectedRoutineFavorite(AiPromptbausteinRoutineVM sel_routine = null)
{
if (sel_routine is null)
sel_routine = SelectedItem as AiPromptbausteinRoutineVM;
if (sel_routine.IsFavorite && !Favoriten.SubRoutines.VMList.Contains(sel_routine))
Favoriten.SubRoutines.VMList.Add(sel_routine);
else if (!sel_routine.IsFavorite && Favoriten.SubRoutines.VMList.Contains(sel_routine))
{
Favoriten.SubRoutines.VMList.Remove(sel_routine);
if (Favoriten.SubRoutines.Count == 0 && Favoriten.SubPrompts.Count == 0)
{
var selected_folder = SelectedFolder;
SelectedFolder = null;
@@ -402,7 +376,7 @@ namespace BeWo.ViewModel.View.Administration
void CopyPrompt()
{
CopiedPrompt = SelectedPrompt;
CopiedPrompt = SelectedItem as AiPromptbausteinPromptVM;
}
void PastePrompt()
{
@@ -410,18 +384,29 @@ namespace BeWo.ViewModel.View.Administration
copied_dc.Creator = CurrentEmployee;
copied_dc.CanEdit = true;
copied_dc.IsPublic = false;
copied_dc.IsFavorite = false;
copied_dc.Oid = null;
copied_dc.Version = 0;
copied_dc.Version = null;
copied_dc.ParentFolderOid = SelectedFolder.DataContract.Oid;
copied_dc.ActionType = AiActionType;
copied_dc.PromptId = null;
copied_dc.ShowPrompt = true;
copied_dc.ShowPromptByTenant = true;
copied_dc.IsOwnsoftPrompt = false;
var copied_vm = new AiPromptbausteinPromptVM(copied_dc);
SelectedFolder.SubPrompts.VMList.Add(copied_vm);
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinPrompt(copied_dc),
new_dc =>
{
copied_vm.UpdateByDataContract(new_dc);
SelectedFolder.SubPrompts.VMList.Add(copied_vm);
SelectedItem = copied_vm;
});
}
void OpenDeletePromptDialog()
{
var sel_prompt = SelectedPrompt;
var sel_prompt = SelectedItem as AiPromptbausteinPromptVM;
var folder = SelectedFolder;
var txt = "Möchten Sie den ausgewählten Prompt wirklich löschen?";
@@ -430,16 +415,41 @@ namespace BeWo.ViewModel.View.Administration
if (result != MessageBoxResult.OK)
return;
folder.SubPrompts.VMList.Remove(SelectedPrompt);
if (sel_prompt.IsFavorite)
{
sel_prompt.IsFavorite = false;
UpdateSelectedPromptFavorite();
}
var delete_dc = sel_prompt.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.DeleteAiPromptbausteinPrompt(delete_dc),
() =>
{
if (folder.SubPrompts.VMList.Contains(sel_prompt))
{
folder.SubPrompts.VMList.Remove(sel_prompt);
}
else
{
ReloadVMList();
}
});
}
void ChangeFavoritenStatePrompt()
{
var sel_prompt = SelectedPrompt;
var sel_prompt = SelectedItem as AiPromptbausteinPromptVM;
sel_prompt.IsFavorite = !sel_prompt.IsFavorite;
UpdateSelectedPromptFavorite(sel_prompt);
var edit_dc = sel_prompt.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinPrompt(edit_dc),
new_dc =>
{
sel_prompt.UpdateByDataContract(new_dc);
UpdateSelectedPromptFavorite(sel_prompt);
});
}
bool canOpenAddPromptDialog()
@@ -448,11 +458,11 @@ namespace BeWo.ViewModel.View.Administration
}
bool canOpenEditPromptDialog()
{
return SelectedPrompt is object;
return SelectedItem as AiPromptbausteinPromptVM is object;
}
bool canCopyPrompt()
{
return CanEditPromptbausteine && SelectedPrompt is object;
return CanEditPromptbausteine && SelectedItem as AiPromptbausteinPromptVM is object;
}
bool canPastePrompt()
{
@@ -460,36 +470,138 @@ namespace BeWo.ViewModel.View.Administration
}
bool canOpenDeletePromptDialog()
{
return CanEditPromptbausteine && (SelectedPrompt?.CanEdit ?? false);
return CanEditPromptbausteine && ((SelectedItem as AiPromptbausteinPromptVM)?.CanEdit ?? false);
}
bool canChangeFavoritenStatePrompt()
{
return SelectedPrompt is object;
return SelectedItem as AiPromptbausteinPromptVM is object;
}
// --- Routine Commands
void OpenAddRoutineDialog()
{
var sel_folder = SelectedFolder;
var new_vm = sel_folder.SubRoutines.CreateNewVM();
new_vm.Creator = CurrentEmployee;
new_vm.ParentFolderOid = sel_folder.DataContract.Oid;
new_vm.CanEdit = true;
new_vm.ActionType = AiActionType;
var vm = new AiPromptbausteinRoutineViewModel(new_vm, Folders);
vm.DataSaved += (s, new_dc) =>
{
new_vm.UpdateByDataContract(new_dc);
sel_folder.SubRoutines.VMList.Add(new_vm);
SelectedItem = new_vm;
};
WindowService.Show(vm);
}
void OpenEditRoutineDialog()
{
var sel_prompt = SelectedItem as AiPromptbausteinRoutineVM;
if (SelectedItem is null)
throw new Exception("invalid operation");
var sel_dc = sel_prompt.CopyToEmptyDataContract();
sel_dc.CanEdit = sel_prompt.CanEdit;
sel_dc.Oid = sel_prompt.DataContract.Oid;
sel_dc.Version = sel_prompt.DataContract.Version;
var edit_vm = new AiPromptbausteinRoutineVM(sel_dc);
var vm = new AiPromptbausteinRoutineViewModel(edit_vm, Folders);
vm.DataSaved += (s, new_dc) =>
{
sel_prompt.UpdateByDataContract(new_dc);
UpdateSelectedRoutineFavorite(sel_prompt);
};
WindowService.Show(vm);
}
void OpenDeleteRoutineDialog()
{
var sel_prompt = SelectedItem as AiPromptbausteinRoutineVM;
var folder = SelectedFolder;
var txt = "Möchten Sie die ausgewählte Routine wirklich löschen?";
var result = MessageBox.Show(txt, "Hinweis", MessageBoxButton.OKCancel);
if (result != MessageBoxResult.OK)
return;
if (sel_prompt.IsFavorite)
{
sel_prompt.IsFavorite = false;
UpdateSelectedRoutineFavorite();
}
var delete_dc = sel_prompt.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.DeleteAiPromptbausteinRoutine(delete_dc),
() =>
{
if (folder.SubRoutines.VMList.Contains(sel_prompt))
{
folder.SubRoutines.VMList.Remove(sel_prompt);
}
else
{
ReloadVMList();
}
});
}
void ChangeFavoritenStateRoutine()
{
var sel_routine = SelectedItem as AiPromptbausteinRoutineVM;
sel_routine.IsFavorite = !sel_routine.IsFavorite;
var edit_dc = sel_routine.CommitToDataContract();
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinRoutine(edit_dc),
new_dc =>
{
sel_routine.UpdateByDataContract(new_dc);
UpdateSelectedRoutineFavorite(sel_routine);
});
}
//bool canOpenAddRoutineDialog() => CanEditPromptbausteine && (SelectedFolder?.CanAddPrompt ?? false);
//bool canOpenEditRoutineDialog() => SelectedRoutine is object;
//bool canOpenDeleteRoutineDialog() => CanEditPromptbausteine && (SelectedRoutine?.CanEdit ?? false);
//bool canChangeFavoritenStateRoutine() => SelectedRoutine is object;
bool canOpenAddRoutineDialog() => CanEditPromptbausteine && (SelectedFolder?.CanAddPrompt ?? false);
bool canOpenEditRoutineDialog() => SelectedItem is AiPromptbausteinRoutineVM;
bool canOpenDeleteRoutineDialog() => CanEditPromptbausteine && ((SelectedItem as AiPromptbausteinRoutineVM)?.CanEdit ?? false);
bool canChangeFavoritenStateRoutine() => SelectedItem is AiPromptbausteinRoutineVM;
void ExecuteItem(Action prompt_action, Action routine_action)
{
if (SelectedItem is AiPromptbausteinPromptVM)
prompt_action();
else if (SelectedItem is AiPromptbausteinRoutineVM)
routine_action();
else
throw new NotImplementedException("item is not AiPromptbausteinPromptVM or AiPromptbausteinRoutineVM");
}
bool canExecuteItem(Func<bool> prompt_func, Func<bool> routine_func)
{
if (SelectedItem is AiPromptbausteinPromptVM)
return prompt_func();
else if (SelectedItem is AiPromptbausteinRoutineVM)
return routine_func();
return false;
}
void InitDesigner()
{
var root = PredefinedAiPromptbausteinFolders.CreateSubTree(AiActionType.ServiceRecordConversation);
var root_vm = new AiPromptbausteinFolderListVM(root);
Folders = root_vm;
}
}
}

View File

@@ -1,4 +1,6 @@
using DevExpress.DataProcessing.InMemoryDataProcessor;
using BeWo.ServiceProxy;
using BS.Shared.DataContracts.Feature.AI;
using DevExpress.DataProcessing.InMemoryDataProcessor;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using DevExpress.XtraBars.Docking2010.Views.WindowsUI;
@@ -11,28 +13,30 @@ using System.Windows.Input;
namespace BeWo.ViewModel.View.Administration
{
public class AiPromptbausteinFolderViewModel : AcceptCancelDialogViewModel
public class AiPromptbausteinFolderViewModel : AcceptCancelDialogViewModel<AiPromptbausteinFolderDC, AiPromptbausteinFolderVM>
{
private readonly bool _IsNew;
public AiPromptbausteinFolderViewModel(AiPromptbausteinFolderVM viewModel, bool isNew) : base()
public AiPromptbausteinFolderViewModel(AiPromptbausteinFolderVM viewModel, bool isNew) : base(viewModel)
{
ViewModel = viewModel;
_IsNew = isNew;
ViewModel.PropertyChanged += (s, e) =>
{
AcceptCommand.RaiseCanExecuteChanged();
};
}
public AiPromptbausteinFolderVM ViewModel { get; set; }
public string AcceptButtonText => _IsNew ? "Hinzufügen" : "Speichern";
protected override bool canAccept()
protected override void Save()
{
return (_IsNew || ViewModel.IsDirty) && !string.IsNullOrWhiteSpace(ViewModel.Title);
var dc = ViewModel.CommitToDataContract();
if (ViewModel.IsNew)
{
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinFolder(dc), DataSave);
}
else
{
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinFolder(dc), DataSave);
}
}
protected override bool canSave()
{
return base.canSave() && !string.IsNullOrWhiteSpace(ViewModel.Title);
}
}
}

View File

@@ -1,4 +1,6 @@
using System;
using BeWo.ServiceProxy;
using BS.Shared.DataContracts.Feature.AI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -6,28 +8,32 @@ using System.Threading.Tasks;
namespace BeWo.ViewModel.View.Administration
{
public class AiPromptbausteinPromptViewModel : AcceptCancelDialogViewModel
public class AiPromptbausteinPromptViewModel : AcceptCancelDialogViewModel<AiPromptbausteinPromptDC, AiPromptbausteinPromptVM>
{
private readonly bool _IsNew;
public AiPromptbausteinPromptViewModel(AiPromptbausteinPromptVM viewModel, bool isNew) : base()
public AiPromptbausteinPromptViewModel(AiPromptbausteinPromptVM viewModel) : base(viewModel)
{
ViewModel = viewModel;
_IsNew = isNew;
ViewModel.PropertyChanged += (s, e) =>
{
AcceptCommand.RaiseCanExecuteChanged();
};
}
public AiPromptbausteinPromptVM ViewModel { get; private set; }
public string AcceptButtonText => _IsNew ? "Hinzufügen" : "Speichern";
protected override bool canAccept()
protected override bool canSave()
{
return (_IsNew || ViewModel.IsDirty) && !string.IsNullOrWhiteSpace(ViewModel.Title);
return base.canSave() && !string.IsNullOrWhiteSpace(ViewModel.Title) && !string.IsNullOrWhiteSpace(ViewModel.Prompt);
}
protected override void Save()
{
var dc = ViewModel.CommitToDataContract();
if (ViewModel.IsNew)
{
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinPrompt(dc),
DataSave);
}
else
{
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinPrompt(dc),
DataSave);
}
}
}
}

View File

@@ -0,0 +1,122 @@
using BeWo.ServiceProxy;
using BeWo.ViewModel.ListViewModel;
using BS.Shared.DataContracts.Feature.AI;
using DevExpress.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace BeWo.ViewModel.View.Administration
{
public class AiPromptbausteinRoutineViewModel : AcceptCancelDialogViewModel<AiPromptbausteinRoutineDC, AiPromptbausteinRoutineVM>
{
private readonly bool _IsNew;
public AiPromptbausteinRoutineStepVM _SelectedStep;
public AiPromptbausteinFolderListVM FolderListVM { get; set; }
public ICommand DeleteStepCommand { get; private set; }
public ICommand MoveStepUpCommand { get; private set; }
public ICommand MoveStepDownCommand { get; private set; }
public AiPromptbausteinRoutineStepVM SelectedStep
{
get => _SelectedStep;
set => SetProperty(ref _SelectedStep, value, nameof(SelectedStep));
}
public AiPromptbausteinRoutineViewModel(AiPromptbausteinRoutineVM viewModel, AiPromptbausteinFolderListVM folders) : base(viewModel)
{
FolderListVM = folders;
ViewModel.Steps.VMList.ListChanged += (s, e) =>
{
SaveCommand.RaiseCanExecuteChanged();
};
DeleteStepCommand = new DelegateCommand<AiPromptbausteinRoutineStepVM>(DeleteStep, canDeleteStep);
MoveStepUpCommand = new DelegateCommand<AiPromptbausteinRoutineStepVM>(MoveStepUp, canMoveStepUp);
MoveStepDownCommand = new DelegateCommand<AiPromptbausteinRoutineStepVM>(MoveStepDown, canMoveStepDown);
}
void DeleteStep(AiPromptbausteinRoutineStepVM step)
{
ViewModel.Steps.VMList.Remove(step);
}
void MoveStepUp(AiPromptbausteinRoutineStepVM step)
{
swap(step, -1);
}
void MoveStepDown(AiPromptbausteinRoutineStepVM step)
{
swap(step, 1);
}
bool canDeleteStep(AiPromptbausteinRoutineStepVM step)
{
return step is object;
}
bool canMoveStepUp(AiPromptbausteinRoutineStepVM step)
{
return step is object && ViewModel.Steps.Count > 1 && ViewModel.Steps.VMList.First() != step;
}
bool canMoveStepDown(AiPromptbausteinRoutineStepVM step)
{
return step is object && ViewModel.Steps.Count > 1 && ViewModel.Steps.VMList.Last() != step;
}
protected override bool canSave()
{
return base.canSave() && !string.IsNullOrWhiteSpace(ViewModel.Title) && (ViewModel.Steps?.VMList.Any() ?? false);
}
protected override void Save()
{
var dc = ViewModel.CommitToDataContract();
if (ViewModel.IsNew)
{
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinRoutine(dc),
DataSave);
}
else
{
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinRoutine(dc),
DataSave);
}
}
private void swap(AiPromptbausteinRoutineStepVM step_x, int offset_y)
{
var id_x = ViewModel.Steps.VMList.IndexOf(step_x);
var id_y = id_x + offset_y;
var step_y = ViewModel.Steps.VMList[id_y];
var prompt_x = step_x.PromptReference;
var version_x = step_x.ReferenceVersion;
var valid_x = step_x.IsValid;
var prompt_y = step_y.PromptReference;
var version_y = step_y.ReferenceVersion;
var valid_y = step_y.IsValid;
step_x.PromptReference = prompt_y;
step_x.ReferenceVersion = version_y;
step_x.SetIsValid(valid_y);
step_y.PromptReference = prompt_x;
step_y.ReferenceVersion = version_x;
step_y.SetIsValid(valid_x);
SelectedStep = step_y;
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.ViewModel.View.Developer
{
public class DesignDeveloperViewModel : DeveloperViewModel
{
public DesignDeveloperViewModel()
{
KeyboardFocus = "Button";
LogicalFocus = "Button";
}
}
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows.Threading;
using System.Windows;
namespace BeWo.ViewModel.View.Developer
{
public class DeveloperViewModel : WindowViewModel
{
private string _keyboardFocus;
private string _logicalFocus;
public string KeyboardFocus
{
get => _keyboardFocus;
set => SetProperty(ref _keyboardFocus, value, nameof(KeyboardFocus));
}
public string LogicalFocus
{
get => _logicalFocus;
set => SetProperty(ref _logicalFocus, value, nameof(LogicalFocus));
}
public DeveloperViewModel()
{
var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(200) };
timer.Tick += (s, e) => Refresh();
timer.Start();
}
private void Refresh()
{
// Keyboard Focus globaler Input-Fokus, nur ein Element systemweit
var keyboard = Keyboard.FocusedElement;
KeyboardFocus = FormatElement(keyboard);
// Logical Focus pro FocusScope, kann vom Keyboard Focus abweichen
// z.B. wenn ein Menü oder Toolbar aktiv ist
var mainWindow = Application.Current.MainWindow;
var logical = mainWindow != null
? FocusManager.GetFocusedElement(mainWindow)
: null;
LogicalFocus = FormatElement(logical);
}
private static string FormatElement(object element)
{
if (element is null)
return "(kein Fokus)";
if (element is FrameworkElement fe)
{
var name = string.IsNullOrEmpty(fe.Name) ? "(kein Name)" : fe.Name;
var dc = fe.DataContext?.GetType().Name ?? "";
return $"{fe.GetType().Name} | Name: {name} | DC: {dc}";
}
return element.GetType().Name;
}
}
}

View File

@@ -10,18 +10,16 @@ namespace BeWo.ViewModel.View
{
public class DialogViewModel : WindowViewModel
{
public event EventHandler RequestClose;
public event EventHandler RequestCloseFinal;
public DialogViewModel() : base()
{
CloseDialogCommand = new DelegateCommand(Close);
}
public ICommand CloseDialogCommand { get; set; }
protected void Close()
protected virtual void Close()
{
RequestClose?.Invoke(this, EventArgs.Empty);
RequestCloseFinal?.Invoke(this, EventArgs.Empty);
}
}
}

View File

@@ -13,17 +13,17 @@
<basicHttpBinding>
<binding name="BeWoBasicEndpoint" closeTimeout="00:05:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None" />
<security mode="Transport" />
<!-- mode="Transport" für https und "None" sonst-->
</binding>
<binding name="BeWoStreamingEndpoint" receiveTimeout="10:10:00" sendTimeout="10:01:00" maxBufferSize="65536" maxReceivedMessageSize="67108864" transferMode="StreamedRequest" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="128" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None" />
<security mode="Transport" />
<!-- mode="Transport" für https und "None" sonst-->
</binding>
<binding name="QueryServiceEndpoint" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>

View File

@@ -90,6 +90,8 @@ namespace Dakota.Logic
else
{
throw new NotImplementedException();
}
}

Some files were not shown because too many files have changed in this diff Show More