DeveloperWindow

+ cleane Shortcuts
This commit is contained in:
2026-06-10 15:41:31 +02:00
parent f3db19c4e9
commit 94c3b00c32
29 changed files with 843 additions and 380 deletions

View File

@@ -173,6 +173,8 @@
<Compile Include="ViewModel\View\AI\AiConversationChatViewModel.cs" /> <Compile Include="ViewModel\View\AI\AiConversationChatViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinActionResultViewModel.cs" /> <Compile Include="ViewModel\View\AI\AiPromptbausteinActionResultViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinComplexSelectionViewModel.cs" /> <Compile Include="ViewModel\View\AI\AiPromptbausteinComplexSelectionViewModel.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\DialogViewModel.cs" />
<Compile Include="ViewModel\View\Gkv\GkvAbrechnungDialogViewModel.cs" /> <Compile Include="ViewModel\View\Gkv\GkvAbrechnungDialogViewModel.cs" />
<Compile Include="ViewModel\View\WindowViewModel.cs" /> <Compile Include="ViewModel\View\WindowViewModel.cs" />
@@ -219,6 +221,9 @@
<Compile Include="View\Detail\Report\DatenbereinigungView.xaml.cs"> <Compile Include="View\Detail\Report\DatenbereinigungView.xaml.cs">
<DependentUpon>DatenbereinigungView.xaml</DependentUpon> <DependentUpon>DatenbereinigungView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="View\Developer\DeveloperView.xaml.cs">
<DependentUpon>DeveloperView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Document\TeamFolderRightView.xaml.cs"> <Compile Include="View\Document\TeamFolderRightView.xaml.cs">
<DependentUpon>TeamFolderRightView.xaml</DependentUpon> <DependentUpon>TeamFolderRightView.xaml</DependentUpon>
</Compile> </Compile>
@@ -371,6 +376,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="View\Developer\DeveloperView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Document\TeamFolderRightView.xaml"> <Page Include="View\Document\TeamFolderRightView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>

View File

@@ -37,6 +37,7 @@ using DevExpress.XtraScheduler;
using System.ServiceModel; using System.ServiceModel;
using BeWo.View.Windows; using BeWo.View.Windows;
using System.Diagnostics; using System.Diagnostics;
using BeWo.Services;
namespace BeWo namespace BeWo
{ {
@@ -81,6 +82,8 @@ namespace BeWo
public static bool IsInDesignMode = DesignerProperties.GetIsInDesignMode(new DependencyObject()); public static bool IsInDesignMode = DesignerProperties.GetIsInDesignMode(new DependencyObject());
internal static IBeWoWindowService WindowService { get; set; }
public static EmployeeDC LoggedOnEmployee public static EmployeeDC LoggedOnEmployee
{ {
get => _LoggedOnEmployee; get => _LoggedOnEmployee;
@@ -1083,16 +1086,11 @@ namespace BeWo
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); 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) BeWoAppInfo.BeWoAppVersion.TryActiveDeveloperMode(e.Args);
//{
// var valuePart = str.Substring(str.IndexOf(':') + 1);
// if(int.TryParse(valuePart, out int parsedTimeout))
// {
// AiTimeout = parsedTimeout;
// }
//}
} }
public static void ShowInfoMessage(string message) public static void ShowInfoMessage(string message)

View File

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

View File

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

View File

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

View File

@@ -23,6 +23,10 @@ using System.Windows.Controls.Primitives;
using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames; using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames;
using DevExpress.Mvvm.Native; using DevExpress.Mvvm.Native;
using BeWo.ViewModel.View.Gkv; 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 namespace BeWo.Services
{ {
@@ -78,7 +82,7 @@ namespace BeWo.Services
} }
} }
public void ShowAiConversationWindow(AiConversationChatViewModel viewModel) private void ShowAiConversationWindow(AiConversationChatViewModel viewModel)
{ {
var control = _controlFactory.GetAiConversationControl(viewModel); var control = _controlFactory.GetAiConversationControl(viewModel);
var title = _windowFactory.GetAiTitle(viewModel.ActionType); var title = _windowFactory.GetAiTitle(viewModel.ActionType);
@@ -89,7 +93,7 @@ namespace BeWo.Services
}; };
Show(title, control, viewModel, options); Show(title, control, viewModel, options);
} }
public void ShowAiPromptbausteinFolderWindow(AiPromptbausteinFolderViewModel viewModel) private void ShowAiPromptbausteinFolderWindow(AiPromptbausteinFolderViewModel viewModel)
{ {
var control = new AiPromptbausteinFolderView(viewModel); var control = new AiPromptbausteinFolderView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -99,7 +103,7 @@ namespace BeWo.Services
}; };
Show("KI Promptbaustein Ordner", control, viewModel, options); Show("KI Promptbaustein Ordner", control, viewModel, options);
} }
public void ShowAiPromptbausteinPromptWindow(AiPromptbausteinPromptViewModel viewModel) private void ShowAiPromptbausteinPromptWindow(AiPromptbausteinPromptViewModel viewModel)
{ {
var control = new AiPromptbausteinPromptView(viewModel); var control = new AiPromptbausteinPromptView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -109,7 +113,7 @@ namespace BeWo.Services
}; };
Show("KI Promptbaustein Prompt", control, viewModel, options); Show("KI Promptbaustein Prompt", control, viewModel, options);
} }
public void ShowAiPromptbausteinRoutineWindow(AiPromptbausteinRoutineViewModel viewModel) private void ShowAiPromptbausteinRoutineWindow(AiPromptbausteinRoutineViewModel viewModel)
{ {
var control = new AiPromptbausteinRoutineView(viewModel); var control = new AiPromptbausteinRoutineView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -119,7 +123,7 @@ namespace BeWo.Services
}; };
Show("KI Promptbaustein Routine", control, viewModel, options); Show("KI Promptbaustein Routine", control, viewModel, options);
} }
public void ShowAiPromptbausteinActionResultWindow(AiPromptbausteinActionResultViewModel viewModel) private void ShowAiPromptbausteinActionResultWindow(AiPromptbausteinActionResultViewModel viewModel)
{ {
var control = new AiPromptbausteinActionResultView(viewModel); var control = new AiPromptbausteinActionResultView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -130,7 +134,7 @@ namespace BeWo.Services
Show("KI Promptbaustein Ergebnis", control, viewModel, options); Show("KI Promptbaustein Ergebnis", control, viewModel, options);
} }
public void ShowAiPromptbausteinSelectionComplexWindow(AiPromptbausteinSelectionComplexViewModel viewModel) private void ShowAiPromptbausteinSelectionComplexWindow(AiPromptbausteinSelectionComplexViewModel viewModel)
{ {
var control = new AiPromptbausteinComplexSelectionView(viewModel); var control = new AiPromptbausteinComplexSelectionView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -141,6 +145,44 @@ namespace BeWo.Services
Show("KI Promptbaustein Auswahl", control, viewModel, options); 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.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) public void ShowGkvAbrechnungDetailWindow(GkvAbrechnungDialogViewModel vm)
{ {
@@ -179,7 +221,7 @@ namespace BeWo.Services
Show(title, control, null, pOptions); 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) if (options.ShowAsModal)
{ {

View File

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

View File

@@ -2,6 +2,7 @@
<!-- Base --> <!-- Base -->
<Style x:Key="BaseButton" TargetType="{x:Type Button}"> <Style x:Key="BaseButton" TargetType="{x:Type Button}">
<Setter Property="Margin" Value="3" /> <Setter Property="Margin" Value="3" />
<Setter Property="MinWidth" Value="25" />
<Setter Property="Height" Value="25" /> <Setter Property="Height" Value="25" />
<Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />

View File

@@ -13,6 +13,8 @@
xmlns:view="clr-namespace:BeWo.View" xmlns:view="clr-namespace:BeWo.View"
xmlns:vm="clr-namespace:BeWo.ViewModel" xmlns:vm="clr-namespace:BeWo.ViewModel"
x:Name="root" x:Name="root"
Focusable="True"
Background="Transparent"
d:DataContext="{d:DesignInstance Type=administration:AiPromptbausteinComplexTreeViewModel, d:DataContext="{d:DesignInstance Type=administration:AiPromptbausteinComplexTreeViewModel,
IsDesignTimeCreatable=True}" IsDesignTimeCreatable=True}"
d:DesignHeight="450" d:DesignHeight="450"
@@ -29,6 +31,7 @@
TargetType="ListBoxItem" /> TargetType="ListBoxItem" />
<DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}"> <DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}">
<Border <Border
x:Name="border"
Background="#09000000" Background="#09000000"
BorderThickness="1" BorderThickness="1"
CornerRadius="5" CornerRadius="5"
@@ -180,6 +183,11 @@
BorderThickness="1" BorderThickness="1"
CornerRadius="5" CornerRadius="5"
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}"> Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}">
<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> <Border.ContextMenu>
<ContextMenu> <ContextMenu>
<ContextMenu.Resources> <ContextMenu.Resources>
@@ -399,6 +407,7 @@
AllowDrop="True" AllowDrop="True"
BorderThickness="1,0,0,1" BorderThickness="1,0,0,1"
ContextMenuOpening="treeView_ContextMenuOpening" ContextMenuOpening="treeView_ContextMenuOpening"
Focusable="True"
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}" ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}" ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}"
ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}"
@@ -416,14 +425,14 @@
<KeyBinding Key="Delete" Command="{Binding DeleteFolderCommand}" /> <KeyBinding Key="Delete" Command="{Binding DeleteFolderCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenEditFolderDialogCommand}" /> <KeyBinding Key="Enter" Command="{Binding OpenEditFolderDialogCommand}" />
<KeyBinding Key="N" Command="{Binding OpenAddFolderDialogCommand}" /> <KeyBinding Key="N" Command="{Binding OpenAddFolderDialogCommand}" />
<KeyBinding <!--<KeyBinding
Key="C" Key="C"
Command="{Binding CopyFolderCommand}" Command="{Binding CopyFolderCommand}"
Modifiers="Ctrl" /> Modifiers="Ctrl" />
<KeyBinding <KeyBinding
Key="V" Key="V"
Command="{Binding PasteFolderCommand}" Command="{Binding PasteFolderCommand}"
Modifiers="Ctrl" /> Modifiers="Ctrl" />-->
</TreeView.InputBindings> </TreeView.InputBindings>
<TreeView.ContextMenu> <TreeView.ContextMenu>
<ContextMenu> <ContextMenu>
@@ -436,7 +445,7 @@
</ContextMenu.Resources> </ContextMenu.Resources>
<MenuItem <MenuItem
Command="{Binding OpenAddFolderDialogCommand}" Command="{Binding OpenAddFolderDialogCommand}"
Header="Neu" Header="Neuer Ordner"
ToolTip="Shortcut: N"> ToolTip="Shortcut: N">
<MenuItem.Icon> <MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" /> <Image Source="..\..\..\Ressources\Icons\Add24.png" />
@@ -486,22 +495,26 @@
Width="1" Width="1"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Background="#878890" /> Background="#878890" />
<TabControl <Grid
Grid.Row="1" Grid.Row="1"
Grid.Column="2" Grid.Column="2"
Grid.ColumnSpan="2" Grid.ColumnSpan="2">
Padding="0" <Grid.Resources>
BorderBrush="Gray" <Style TargetType="Grid">
BorderThickness="0,1,1,1"
SelectionChanged="TabControl_SelectionChanged">
<TabControl.Resources>
<Style TargetType="TabControl">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=treeView, Path=SelectedItem}" Value="{x:Null}"> <DataTrigger Binding="{Binding ElementName=treeView, Path=SelectedItem}" Value="{x:Null}">
<Setter Property="Visibility" Value="Hidden" /> <Setter Property="Visibility" Value="Hidden" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </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}"> <Style TargetType="{x:Type TabItem}">
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
@@ -534,23 +547,43 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </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="ItemTemplate" Value="{StaticResource AiPromptbausteinPromptItemTemplate}" />
<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> </TabControl.Resources>
<TabItem Header="Alle"> <TabItem Header="Alle">
<Grid> <TabItem.InputBindings>
<dxe:ListBoxEdit <KeyBinding Key="Delete" Command="{Binding DeleteItemCommand}" />
x:Name="listBoxEdit3" <KeyBinding Key="Enter" Command="{Binding OpenEditItemDialogCommand}" />
Padding="8,16,8,16" <KeyBinding
HorizontalContentAlignment="Stretch" Key="C"
VerticalContentAlignment="Stretch" Command="{Binding CopyPromptCommand}"
AllowDrop="False" Modifiers="Ctrl" />
ContextMenuOpening="ListBox_ContextMenuOpening" <KeyBinding
ItemContainerStyle="{StaticResource PromptListBoxItem}" Key="V"
ItemTemplateSelector="{StaticResource AiPromptbausteinFolderItemTemplateSelector}" Command="{Binding PastePromptCommand}"
ItemsSource="{Binding SelectedFolder.AlleFolderItems, UpdateSourceTrigger=PropertyChanged}" Modifiers="Ctrl" />
SelectedItem="{Binding SelectedItem, Mode=TwoWay}" <KeyBinding Key="F" Command="{Binding ChangeFavoritenStateItemCommand}" />
SelectionMode="Single" <KeyBinding Key="N" Command="{Binding OpenAddPromptDialogCommand}" />
ShowBorder="False"> </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> <dxe:ListBoxEdit.ContextMenu>
<ContextMenu> <ContextMenu>
<ContextMenu.Resources> <ContextMenu.Resources>
@@ -579,10 +612,7 @@
</ContextMenu> </ContextMenu>
</dxe:ListBoxEdit.ContextMenu> </dxe:ListBoxEdit.ContextMenu>
</dxe:ListBoxEdit> </dxe:ListBoxEdit>
<StackPanel <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsHitTestVisible="False">
<StackPanel.Visibility> <StackPanel.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}"> <MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding <Binding
@@ -597,28 +627,43 @@
Margin="6" Margin="6"
Data="{StaticResource GeometryFileAdd2}" Data="{StaticResource GeometryFileAdd2}"
Fill="Black" Fill="Black"
IsHitTestVisible="False"
Stretch="Uniform" /> Stretch="Uniform" />
<TextBlock> <TextBlock IsHitTestVisible="False">
Hier sind noch keine Prompts/Routinen angelegt. Hier sind noch keine Prompts/Routinen angelegt.
</TextBlock> </TextBlock>
<Button
Width="150"
Margin="3,12,3,3"
Command="{Binding OpenAddPromptDialogCommand}">
Ersten Prompt anlegen
</Button>
<Button
Width="150"
Margin="3,3,3,3"
Command="{Binding OpenAddRoutineDialogCommand}">
Erste Routine anlegen
</Button>
</StackPanel> </StackPanel>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Header="Prompts"> <TabItem Header="Prompts">
<Grid> <TabItem.InputBindings>
<dxe:ListBoxEdit <KeyBinding Key="Delete" Command="{Binding DeletePromptCommand}" />
x:Name="listBoxEdit1" <KeyBinding Key="Enter" Command="{Binding OpenEditPromptDialogCommand}" />
Padding="8,16,8,16" <KeyBinding
HorizontalContentAlignment="Stretch" Key="C"
VerticalContentAlignment="Stretch" Command="{Binding CopyPromptCommand}"
AllowDrop="False" Modifiers="Ctrl" />
ContextMenuOpening="ListBox_ContextMenuOpening" <KeyBinding
ItemContainerStyle="{StaticResource PromptListBoxItem}" Key="V"
ItemTemplate="{StaticResource AiPromptbausteinPromptItemTemplate}" Command="{Binding PastePromptCommand}"
ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}" Modifiers="Ctrl" />
SelectedItem="{Binding SelectedItem, Mode=TwoWay}" <KeyBinding Key="F" Command="{Binding ChangeFavoritenStatePromptCommand}" />
SelectionMode="Single" <KeyBinding Key="N" Command="{Binding OpenAddPromptDialogCommand}" />
ShowBorder="False"> </TabItem.InputBindings>
<Grid Background="Transparent">
<dxe:ListBoxEdit x:Name="listBoxEdit1" ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}">
<dxe:ListBoxEdit.ContextMenu> <dxe:ListBoxEdit.ContextMenu>
<ContextMenu> <ContextMenu>
<ContextMenu.Resources> <ContextMenu.Resources>
@@ -642,10 +687,7 @@
</ContextMenu> </ContextMenu>
</dxe:ListBoxEdit.ContextMenu> </dxe:ListBoxEdit.ContextMenu>
</dxe:ListBoxEdit> </dxe:ListBoxEdit>
<StackPanel <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsHitTestVisible="False">
<StackPanel.Visibility> <StackPanel.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}"> <MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding <Binding
@@ -660,28 +702,29 @@
Margin="6" Margin="6"
Data="{StaticResource GeometryFileAdd2}" Data="{StaticResource GeometryFileAdd2}"
Fill="Black" Fill="Black"
IsHitTestVisible="False"
Stretch="Uniform" /> Stretch="Uniform" />
<TextBlock> <TextBlock IsHitTestVisible="False">
Hier sind noch keine Prompts angelegt. Hier sind noch keine Prompts angelegt.
</TextBlock> </TextBlock>
<Button
Width="150"
Margin="3,12,3,3"
Command="{Binding OpenAddPromptDialogCommand}">
Ersten Prompt anlegen
</Button>
</StackPanel> </StackPanel>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Header="Routinen"> <TabItem Header="Routinen">
<Grid> <TabItem.InputBindings>
<dxe:ListBoxEdit <KeyBinding Key="Delete" Command="{Binding DeleteRoutineCommand}" />
x:Name="listBoxEdit2" <KeyBinding Key="Enter" Command="{Binding OpenEditRoutineDialogCommand}" />
Padding="8,16,8,16" <KeyBinding Key="F" Command="{Binding ChangeFavoritenStateRoutineCommand}" />
HorizontalContentAlignment="Stretch" <KeyBinding Key="N" Command="{Binding OpenAddRoutineDialogCommand}" />
VerticalContentAlignment="Stretch" </TabItem.InputBindings>
AllowDrop="False" <Grid Background="Transparent">
ContextMenuOpening="ListBox_ContextMenuOpening" <dxe:ListBoxEdit x:Name="listBoxEdit2" ItemsSource="{Binding SelectedFolder.Routines, UpdateSourceTrigger=PropertyChanged}">
ItemContainerStyle="{StaticResource PromptListBoxItem}"
ItemTemplate="{StaticResource AiPromptbausteinRoutineItemTemplate}"
ItemsSource="{Binding SelectedFolder.Routines, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
SelectionMode="Single"
ShowBorder="False">
<dxe:ListBoxEdit.ContextMenu> <dxe:ListBoxEdit.ContextMenu>
<ContextMenu> <ContextMenu>
<ContextMenu.Resources> <ContextMenu.Resources>
@@ -699,10 +742,7 @@
</ContextMenu> </ContextMenu>
</dxe:ListBoxEdit.ContextMenu> </dxe:ListBoxEdit.ContextMenu>
</dxe:ListBoxEdit> </dxe:ListBoxEdit>
<StackPanel <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsHitTestVisible="False">
<StackPanel.Visibility> <StackPanel.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}"> <MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding <Binding
@@ -717,14 +757,67 @@
Margin="6" Margin="6"
Data="{StaticResource GeometryFileAdd2}" Data="{StaticResource GeometryFileAdd2}"
Fill="Black" Fill="Black"
IsHitTestVisible="False"
Stretch="Uniform" /> Stretch="Uniform" />
<TextBlock> <TextBlock IsHitTestVisible="False">
Hier sind noch keine Routinen angelegt. Hier sind noch keine Routinen angelegt.
</TextBlock> </TextBlock>
<Button
Width="150"
Margin="3,12,3,3"
Command="{Binding OpenAddRoutineDialogCommand}">
Erste Routine anlegen
</Button>
</StackPanel> </StackPanel>
</Grid> </Grid>
</TabItem> </TabItem>
</TabControl> </TabControl>
<StackPanel
HorizontalAlignment="Right"
VerticalAlignment="Top"
Orientation="Horizontal"
Visibility="{Binding SelectedFolder.CanAddPrompt, Converter={StaticResource BoolVisibilityConverter}}">
<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> </Grid>
</GroupBox> </GroupBox>
</view:BeWoView> </view:BeWoView>

View File

@@ -38,7 +38,7 @@ namespace BeWo.View.Detail.AI
InitializeComponent(); InitializeComponent();
if (viewModel == null ) if (viewModel == null )
viewModel = new AiPromptbausteinComplexTreeViewModel(BeWoApp.MainControl.WindowService, BS.Shared.AiActionType.ServiceRecordConversation); viewModel = new AiPromptbausteinComplexTreeViewModel(BeWoApp.WindowService, BS.Shared.AiActionType.ServiceRecordConversation);
DataContext = ViewModel = viewModel; DataContext = ViewModel = viewModel;
@@ -51,7 +51,7 @@ namespace BeWo.View.Detail.AI
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{ {
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(e.OriginalSource as DependencyObject);
if (treeViewItem != null) if (treeViewItem != null)
{ {
@@ -72,12 +72,12 @@ namespace BeWo.View.Detail.AI
} }
} }
static TreeViewItem VisualUpwardSearch(DependencyObject source) static T VisualUpwardSearch<T>(DependencyObject source) where T : DependencyObject
{ {
while (source != null && !(source is TreeViewItem)) while (source != null && !(source is T))
source = VisualTreeHelper.GetParent(source); source = VisualTreeHelper.GetParent(source);
return source as TreeViewItem; return source as T;
} }
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
@@ -90,14 +90,17 @@ namespace BeWo.View.Detail.AI
private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e) private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{ {
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(e.OriginalSource as DependencyObject);
if (treeViewItem is null) if (treeViewItem is null)
{
treeView.Focus();
e.Handled = true;
return; return;
}
if (e.ClickCount == 2) if (e.ClickCount == 2)
{ {
ViewModel.OpenEditFolderDialogCommand.Execute(null); ViewModel.OpenEditFolderDialogCommand.Execute(null);
e.Handled = true; e.Handled = true;
} }
@@ -111,7 +114,7 @@ namespace BeWo.View.Detail.AI
private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e) private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{ {
ViewModel.UpdateFolderCommands();
} }
private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e) private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
@@ -158,5 +161,40 @@ namespace BeWo.View.Detail.AI
e.Handled = true; e.Handled = true;
} }
} }
private void listBoxEdit3_PreviewKeyDown(object sender, KeyEventArgs e)
{
//TreeViewItem treeViewItem = VisualUpwardSearch<ListViewItem>(e.OriginalSource as DependencyObject);
//if (treeViewItem is null)
//{
// treeView.Focus();
// e.Handled = true;
// return;
//}
//if (e.ClickCount == 2)
//{
// ViewModel.OpenEditFolderDialogCommand.Execute(null);
// e.Handled = true;
//}
}
private void listBoxEdit3_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
ListBoxItem listBoxItem = VisualUpwardSearch<ListBoxItem>(e.OriginalSource as DependencyObject);
if(listBoxItem is null)
{
((ListBoxEdit)sender).Focus();
e.Handled = true;
return;
}
}
private void listBoxEdit3_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
}
} }
} }

View File

@@ -308,21 +308,21 @@ namespace BeWo.View.Detail
return dict; return dict;
} }
private AiConversationChatViewModel getAiConversationChatViewModel() // private AiConversationChatViewModel getAiConversationChatViewModel()
{ // {
throw new NotImplementedException(); // throw new NotImplementedException();
//var customer_oid = ViewModel.DataContract.CustomerOid; // //var customer_oid = ViewModel.DataContract.CustomerOid;
//var context = GetVisibleInformationReferences(); // //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() //private void OpenAiWindow()
{ //{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel()); // MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
} //}
void Image_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e) void Image_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
{ {

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

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

View File

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

View File

@@ -73,20 +73,20 @@ namespace BeWo.View.Navigation
return dict; return dict;
} }
private AiConversationChatViewModel getAiConversationChatViewModel() //private AiConversationChatViewModel getAiConversationChatViewModel()
{ //{
throw new NotImplementedException(); // throw new NotImplementedException();
//var context = GetVisibleInformationReferences(); // //var context = GetVisibleInformationReferences();
//var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context); // //var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context);
//return vm; // //return vm;
} //}
private void OpenAiWindow() //private void OpenAiWindow()
{ //{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel()); // MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
} //}
private void mainNavigationView_CreateNewObject() private void mainNavigationView_CreateNewObject()
{ {

View File

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

View File

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

View File

@@ -143,7 +143,7 @@ namespace BeWo.ViewModel.Controls.AI
vm.SendAfterLoaded = true; vm.SendAfterLoaded = true;
vm.PromptInput = prompt; vm.PromptInput = prompt;
vm.MessageInput = prompt.Prompt; vm.MessageInput = prompt.Prompt;
BeWoApp.MainControl.WindowService.Show(vm); BeWoApp.WindowService.Show(vm);
return; return;
} }
else if (e is AiPromptbausteinRoutineVM routine) else if (e is AiPromptbausteinRoutineVM routine)
@@ -152,7 +152,7 @@ namespace BeWo.ViewModel.Controls.AI
vm.SendAfterLoaded = true; vm.SendAfterLoaded = true;
vm.RoutineInput = routine; vm.RoutineInput = routine;
vm.MessageInput = routine.Steps.VMList[0].PromptReference.Prompt; vm.MessageInput = routine.Steps.VMList[0].PromptReference.Prompt;
BeWoApp.MainControl.WindowService.Show(vm); BeWoApp.WindowService.Show(vm);
return; return;
} }
@@ -170,12 +170,12 @@ namespace BeWo.ViewModel.Controls.AI
private protected void OpenConversationPopup() private protected void OpenConversationPopup()
{ {
BeWoApp.MainControl.WindowService.Show(GetConversationViewModel()); BeWoApp.WindowService.Show(GetConversationViewModel());
} }
private protected void OpenAllPromptsPopup() private protected void OpenAllPromptsPopup()
{ {
BeWoApp.MainControl.WindowService.Show(AllPromptsViewModel); BeWoApp.WindowService.Show(AllPromptsViewModel);
} }
private protected void OpenFavoritePromptsPopup() private protected void OpenFavoritePromptsPopup()

View File

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

View File

@@ -74,7 +74,7 @@ namespace BeWo.ViewModel.View.AI
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType) : this() public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType) : this()
{ {
AiActionType = aiActionType; AiActionType = aiActionType;
WindowService = BeWoApp.MainControl.WindowService; WindowService = BeWoApp.WindowService;
InitCommands(); InitCommands();
} }
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType, AiPromptbausteinFolderListVM viewModel, bool isFavorite = false, bool canOpen = true) : this(aiActionType) public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType, AiPromptbausteinFolderListVM viewModel, bool isFavorite = false, bool canOpen = true) : this(aiActionType)

View File

@@ -4,6 +4,7 @@ using BeWo.ViewModel.ListViewModel;
using BS.Shared; using BS.Shared;
using BS.Shared.DataContracts.Compact; using BS.Shared.DataContracts.Compact;
using BS.Shared.DataContracts.Feature.AI; using BS.Shared.DataContracts.Feature.AI;
using DevExpress.DataProcessing;
using DevExpress.Mvvm; using DevExpress.Mvvm;
using DevExpress.Utils.Extensions; using DevExpress.Utils.Extensions;
using DevExpress.Xpf.Layout.Core; using DevExpress.Xpf.Layout.Core;
@@ -51,6 +52,9 @@ namespace BeWo.ViewModel.View.Administration
public DelegateCommand DeleteRoutineCommand { get; private set; } public DelegateCommand DeleteRoutineCommand { get; private set; }
public DelegateCommand ChangeFavoritenStateRoutineCommand { 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 CanEditPromptbausteine { get; set; }
@@ -59,19 +63,32 @@ namespace BeWo.ViewModel.View.Administration
get => _SelectedFolder; get => _SelectedFolder;
set set
{ {
SetProperty(ref _SelectedFolder, value, nameof(SelectedFolder)); var success = SetProperty(ref _SelectedFolder, value, nameof(SelectedFolder));
if (SelectedItem is AiPromptbausteinPromptVM vm) if (SelectedItem is AiPromptbausteinPromptVM vm)
{ {
SelectedItem = null; SelectedItem = null;
} }
if (!success)
return;
UpdateFolderCommands();
UpdatePromptCommands();
} }
} }
public AbstractBaseVM SelectedItem public AbstractBaseVM SelectedItem
{ {
get => _SelectedItem; get => _SelectedItem;
set => SetProperty(ref _SelectedItem, value, nameof(SelectedItem)); set {
var success = SetProperty(ref _SelectedItem, value, nameof(SelectedItem));
if (!success)
return;
UpdateItemCommands();
}
} }
public AiPromptbausteinComplexTreeViewModel() : this(null, AiActionType.ServiceRecordConversation) public AiPromptbausteinComplexTreeViewModel() : this(null, AiActionType.ServiceRecordConversation)
@@ -107,6 +124,18 @@ namespace BeWo.ViewModel.View.Administration
DeleteRoutineCommand = new DelegateCommand(OpenDeleteRoutineDialog, canOpenDeleteRoutineDialog, false); DeleteRoutineCommand = new DelegateCommand(OpenDeleteRoutineDialog, canOpenDeleteRoutineDialog, false);
ChangeFavoritenStateRoutineCommand = new DelegateCommand(ChangeFavoritenStateRoutine, canChangeFavoritenStateRoutine, 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); CanEditPromptbausteine = BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit);
} }
@@ -142,6 +171,12 @@ namespace BeWo.ViewModel.View.Administration
DeleteRoutineCommand.RaiseCanExecuteChanged(); DeleteRoutineCommand.RaiseCanExecuteChanged();
ChangeFavoritenStateRoutineCommand.RaiseCanExecuteChanged(); ChangeFavoritenStateRoutineCommand.RaiseCanExecuteChanged();
} }
public void UpdateItemCommands()
{
OpenEditItemDialogCommand.RaiseCanExecuteChanged();
DeleteItemCommand.RaiseCanExecuteChanged();
ChangeFavoritenStateItemCommand.RaiseCanExecuteChanged();
}
internal void ReloadVMList() internal void ReloadVMList()
{ {
@@ -226,7 +261,7 @@ namespace BeWo.ViewModel.View.Administration
bool canOpenAddFolderDialog() bool canOpenAddFolderDialog()
{ {
return CanEditPromptbausteine && (SelectedFolder?.CanAddFolder ?? true); return CanEditPromptbausteine && (SelectedFolder?.CanAddFolder ?? false);
} }
bool canOpenEditFolderDialog() bool canOpenEditFolderDialog()
{ {
@@ -533,6 +568,25 @@ namespace BeWo.ViewModel.View.Administration
bool canOpenDeleteRoutineDialog() => CanEditPromptbausteine && ((SelectedItem as AiPromptbausteinRoutineVM)?.CanEdit ?? false); bool canOpenDeleteRoutineDialog() => CanEditPromptbausteine && ((SelectedItem as AiPromptbausteinRoutineVM)?.CanEdit ?? false);
bool canChangeFavoritenStateRoutine() => SelectedItem is AiPromptbausteinRoutineVM; 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() void InitDesigner()
{ {
var root = PredefinedAiPromptbausteinFolders.CreateSubTree(AiActionType.ServiceRecordConversation); var root = PredefinedAiPromptbausteinFolders.CreateSubTree(AiActionType.ServiceRecordConversation);

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

@@ -147,22 +147,22 @@ namespace BeWo.Service.Plugins
return conv_dc; return conv_dc;
} }
public AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long oid) //public AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long oid)
{ //{
var config = GetAiConfig(); // var config = GetAiConfig();
var conv = createAiConversation(conversation.ActionType, view_context, config); // var conv = createAiConversation(conversation.ActionType, view_context, config);
var promptbaustein = DAOFactory.GenericDAO.LoadByID<AiPromptbausteinPrompt>(oid); // var promptbaustein = DAOFactory.GenericDAO.LoadByID<AiPromptbausteinPrompt>(oid);
var new_messages = sendNewMessage(conv, promptbaustein.Prompt, config); // var new_messages = sendNewMessage(conv, promptbaustein.Prompt, config);
DAOFactory.GenericDAO.Insert(conv); // DAOFactory.GenericDAO.Insert(conv);
var conv_dc = MapperFactory.AiConversation.MapToNewDC(conv); // var conv_dc = MapperFactory.AiConversation.MapToNewDC(conv);
return conv_dc; // return conv_dc;
} //}
public virtual AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid) public virtual AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid)
{ {
var parent_conv = DAOFactory.GenericDAO.GetByID<AiConversation>(conversation_oid); var parent_conv = DAOFactory.GenericDAO.GetByID<AiConversation>(conversation_oid);
@@ -236,6 +236,40 @@ namespace BeWo.Service.Plugins
return sendNewMessage(conv, message); return sendNewMessage(conv, message);
} }
public virtual AiConversationMessageDC[] ExecuteAiConversationWithMessage(long conversation, AiViewContextDC view_context, long routine, int step)
{
var conv = DAOFactory.GenericDAO.LoadByID<AiConversation>(conversation);
var routine_ent = DAOFactory.GenericDAO.LoadByID<AiPromptbausteinRoutine>(routine);
var step_ent = routine_ent.Steps[step];
var message = step_ent.PromptReference.Prompt;
var actionType = conv.ActionType;
var conv_messages = conv.Messages;
var conv_messages_filtered = conv_messages.Where(x => x.Role != AiConversationMessageRole.System);
var new_conv = createAiConversation(actionType, view_context);
if (routine_ent.RoutineType == AiRoutineType.Stack)
{
// Stack
return sendNewMessage(new_conv, message);
}
else if (routine_ent.RoutineType == AiRoutineType.Chain)
{
}
else
{
throw BeWoNotImplementedException.CreateFromEnum(routine_ent.RoutineType);
}
return sendNewMessage(conv, message);
}
public virtual bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context) public virtual bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context)
{ {
var modell_oid_value = GetAiConfig().SelectedModel.Oid.Value; var modell_oid_value = GetAiConfig().SelectedModel.Oid.Value;

View File

@@ -20,22 +20,22 @@ namespace BeWo.Service.ServiceContracts.Enhanced
{ {
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
AiConfigDC GetAiConfig(); AiConfigDC GetAiConfig();
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
AiConfigDC UpdateAiConfig(AiConfigDC toUpdate); AiConfigDC UpdateAiConfig(AiConfigDC toUpdate);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
IEnumerable<AiModelDC> GetAiModels(); IEnumerable<AiModelDC> GetAiModels();
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
IEnumerable<AiConversationDC> GetAiConversations(AiActionType actionType, long? oid); IEnumerable<AiConversationDC> GetAiConversations(AiActionType actionType, long? oid);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
@@ -48,31 +48,29 @@ namespace BeWo.Service.ServiceContracts.Enhanced
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long prompt_oid); //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
[FaultContract(typeof(BeWoFault))]
[OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
AiConversationDC CloneAiConversation(long conversation_oid, long? message_oid); AiConversationDC CloneAiConversation(long conversation_oid, long? message_oid);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
long UpdateAiConversationDisplayname(long oid, long version, string displayname); long UpdateAiConversationDisplayname(long oid, long version, string displayname);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
void DeleteAiConversation(long conversation_oid); void DeleteAiConversation(long conversation_oid);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
AiConversationMessageDC[] SendNewMessage(long conversation, string message); AiConversationMessageDC[] SendNewMessage(long conversation, string message);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] AiConversationMessageDC[] ExecuteAiConversationWithMessage(long conversation, AiViewContextDC view_context, long routine, int step);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
//[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context); bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]

View File

@@ -35,8 +35,6 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
=> GetAiService().CreateAiConversation(conversation, view_context); => GetAiService().CreateAiConversation(conversation, view_context);
public AiConversationDC CreateAiConversationWithMessage(AiConversationDC conversation, AiViewContextDC view_context, string message) public AiConversationDC CreateAiConversationWithMessage(AiConversationDC conversation, AiViewContextDC view_context, string message)
=> GetAiService().CreateAiConversationWithMessage(conversation, view_context, message); => GetAiService().CreateAiConversationWithMessage(conversation, view_context, message);
public AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long prompt_oid)
=> GetAiService().CreateAiConversationWithPromptbaustein(conversation, view_context, prompt_oid);
public AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid) public AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid)
=> GetAiService().CloneAiConversation(conversation_oid, last_message_oid); => GetAiService().CloneAiConversation(conversation_oid, last_message_oid);
@@ -50,6 +48,9 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
public AiConversationMessageDC[] SendNewMessage(long conversation, string message) public AiConversationMessageDC[] SendNewMessage(long conversation, string message)
=> GetAiService().SendNewMessage(conversation, message); => GetAiService().SendNewMessage(conversation, message);
public AiConversationMessageDC[] ExecuteAiConversationWithMessage(long conversation, AiViewContextDC view_context, long routine, int step)
=> GetAiService().ExecuteAiConversationWithMessage(conversation, view_context, routine, step);
public bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context) public bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context)
=> GetAiService().CheckContextSize(actionType, view_context); => GetAiService().CheckContextSize(actionType, view_context);