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\AiPromptbausteinActionResultViewModel.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\Gkv\GkvAbrechnungDialogViewModel.cs" />
<Compile Include="ViewModel\View\WindowViewModel.cs" />
@@ -219,6 +221,9 @@
<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>
@@ -371,6 +376,10 @@
<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;
@@ -1083,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

@@ -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

@@ -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

@@ -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
{
@@ -78,7 +82,7 @@ namespace BeWo.Services
}
}
public void ShowAiConversationWindow(AiConversationChatViewModel viewModel)
private void ShowAiConversationWindow(AiConversationChatViewModel viewModel)
{
var control = _controlFactory.GetAiConversationControl(viewModel);
var title = _windowFactory.GetAiTitle(viewModel.ActionType);
@@ -89,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()
@@ -99,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()
@@ -109,7 +113,7 @@ namespace BeWo.Services
};
Show("KI Promptbaustein Prompt", control, viewModel, options);
}
public void ShowAiPromptbausteinRoutineWindow(AiPromptbausteinRoutineViewModel viewModel)
private void ShowAiPromptbausteinRoutineWindow(AiPromptbausteinRoutineViewModel viewModel)
{
var control = new AiPromptbausteinRoutineView(viewModel);
var options = new BeWoWindowOptions()
@@ -119,7 +123,7 @@ namespace BeWo.Services
};
Show("KI Promptbaustein Routine", control, viewModel, options);
}
public void ShowAiPromptbausteinActionResultWindow(AiPromptbausteinActionResultViewModel viewModel)
private void ShowAiPromptbausteinActionResultWindow(AiPromptbausteinActionResultViewModel viewModel)
{
var control = new AiPromptbausteinActionResultView(viewModel);
var options = new BeWoWindowOptions()
@@ -130,7 +134,7 @@ 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()
@@ -140,7 +144,45 @@ namespace BeWo.Services
};
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)
{
@@ -179,7 +221,7 @@ 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)
{

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" />

View File

@@ -48,9 +48,9 @@
</Style>
<Style
x:Key="PopupBlackLabel2"
BasedOn="{StaticResource BaseLabel}"
TargetType="Label">
x:Key="PopupBlackLabel2"
BasedOn="{StaticResource BaseLabel}"
TargetType="Label">
<Setter Property="Foreground" Value="{DynamicResource TextForegroundDarkPrimary}" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" />

View File

@@ -6,11 +6,11 @@
</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"/>
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

@@ -13,8 +13,10 @@
xmlns:view="clr-namespace:BeWo.View"
xmlns:vm="clr-namespace:BeWo.ViewModel"
x:Name="root"
Focusable="True"
Background="Transparent"
d:DataContext="{d:DesignInstance Type=administration:AiPromptbausteinComplexTreeViewModel,
IsDesignTimeCreatable=True}"
IsDesignTimeCreatable=True}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
@@ -29,6 +31,7 @@
TargetType="ListBoxItem" />
<DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}">
<Border
x:Name="border"
Background="#09000000"
BorderThickness="1"
CornerRadius="5"
@@ -180,6 +183,11 @@
BorderThickness="1"
CornerRadius="5"
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>
<ContextMenu>
<ContextMenu.Resources>
@@ -399,6 +407,7 @@
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}"
@@ -416,14 +425,14 @@
<KeyBinding Key="Delete" Command="{Binding DeleteFolderCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenEditFolderDialogCommand}" />
<KeyBinding Key="N" Command="{Binding OpenAddFolderDialogCommand}" />
<KeyBinding
<!--<KeyBinding
Key="C"
Command="{Binding CopyFolderCommand}"
Modifiers="Ctrl" />
<KeyBinding
Key="V"
Command="{Binding PasteFolderCommand}"
Modifiers="Ctrl" />
Modifiers="Ctrl" />-->
</TreeView.InputBindings>
<TreeView.ContextMenu>
<ContextMenu>
@@ -436,7 +445,7 @@
</ContextMenu.Resources>
<MenuItem
Command="{Binding OpenAddFolderDialogCommand}"
Header="Neu"
Header="Neuer Ordner"
ToolTip="Shortcut: N">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
@@ -486,245 +495,329 @@
Width="1"
HorizontalAlignment="Center"
Background="#878890" />
<TabControl
<Grid
Grid.Row="1"
Grid.Column="2"
Grid.ColumnSpan="2"
Padding="0"
BorderBrush="Gray"
BorderThickness="0,1,1,1"
SelectionChanged="TabControl_SelectionChanged">
<TabControl.Resources>
<Style TargetType="TabControl">
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>
<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 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>
</TabControl.Resources>
<TabItem Header="Alle">
<Grid>
<dxe:ListBoxEdit
x:Name="listBoxEdit3"
Padding="8,16,8,16"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowDrop="False"
ContextMenuOpening="ListBox_ContextMenuOpening"
ItemContainerStyle="{StaticResource PromptListBoxItem}"
ItemTemplateSelector="{StaticResource AiPromptbausteinFolderItemTemplateSelector}"
ItemsSource="{Binding SelectedFolder.AlleFolderItems, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
SelectionMode="Single"
ShowBorder="False">
<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"
IsHitTestVisible="False">
<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"
Stretch="Uniform" />
<TextBlock>
Hier sind noch keine Prompts/Routinen angelegt.
</TextBlock>
</StackPanel>
</Grid>
</TabItem>
<TabItem Header="Prompts">
<Grid>
<dxe:ListBoxEdit
x:Name="listBoxEdit1"
Padding="8,16,8,16"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowDrop="False"
ContextMenuOpening="ListBox_ContextMenuOpening"
ItemContainerStyle="{StaticResource PromptListBoxItem}"
ItemTemplate="{StaticResource AiPromptbausteinPromptItemTemplate}"
ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
SelectionMode="Single"
ShowBorder="False">
<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"
IsHitTestVisible="False">
<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"
Stretch="Uniform" />
<TextBlock>
Hier sind noch keine Prompts angelegt.
</TextBlock>
</StackPanel>
</Grid>
</TabItem>
<TabItem Header="Routinen">
<Grid>
<dxe:ListBoxEdit
x:Name="listBoxEdit2"
Padding="8,16,8,16"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowDrop="False"
ContextMenuOpening="ListBox_ContextMenuOpening"
ItemContainerStyle="{StaticResource PromptListBoxItem}"
ItemTemplate="{StaticResource AiPromptbausteinRoutineItemTemplate}"
ItemsSource="{Binding SelectedFolder.Routines, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
SelectionMode="Single"
ShowBorder="False">
<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"
IsHitTestVisible="False">
<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"
Stretch="Uniform" />
<TextBlock>
Hier sind noch keine Routinen angelegt.
</TextBlock>
</StackPanel>
</Grid>
</TabItem>
</TabControl>
</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 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="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>
<TabItem 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}">
Ersten Prompt anlegen
</Button>
<Button
Width="150"
Margin="3,3,3,3"
Command="{Binding OpenAddRoutineDialogCommand}">
Erste Routine anlegen
</Button>
</StackPanel>
</Grid>
</TabItem>
<TabItem 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}">
Ersten Prompt anlegen
</Button>
</StackPanel>
</Grid>
</TabItem>
<TabItem 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}">
Erste Routine anlegen
</Button>
</StackPanel>
</Grid>
</TabItem>
</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>
</GroupBox>
</view:BeWoView>

View File

@@ -38,7 +38,7 @@ namespace BeWo.View.Detail.AI
InitializeComponent();
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;
@@ -51,7 +51,7 @@ namespace BeWo.View.Detail.AI
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)
{
@@ -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);
return source as TreeViewItem;
return source as T;
}
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)
{
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(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;
}
@@ -111,7 +114,7 @@ namespace BeWo.View.Detail.AI
private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
ViewModel.UpdateFolderCommands();
}
private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
@@ -158,5 +161,40 @@ namespace BeWo.View.Detail.AI
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;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
throw new NotImplementedException();
//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

@@ -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;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
throw new NotImplementedException();
// 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,20 +108,20 @@ namespace BeWo.View.Navigation
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
throw new NotImplementedException();
//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

@@ -73,20 +73,20 @@ namespace BeWo.View.Navigation
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
throw new NotImplementedException();
//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

@@ -148,20 +148,20 @@ namespace BeWo.View.Navigation
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
throw new NotImplementedException();
//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

@@ -223,21 +223,21 @@ namespace BeWo.View.Navigation
return dict;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
throw new NotImplementedException();
//private AiConversationChatViewModel getAiConversationChatViewModel()
//{
// 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()
{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
}
//private void OpenAiWindow()
//{
// MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
//}
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
{

View File

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

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

@@ -74,7 +74,7 @@ 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, bool canOpen = true) : this(aiActionType)

View File

@@ -4,6 +4,7 @@ using BeWo.ViewModel.ListViewModel;
using BS.Shared;
using BS.Shared.DataContracts.Compact;
using BS.Shared.DataContracts.Feature.AI;
using DevExpress.DataProcessing;
using DevExpress.Mvvm;
using DevExpress.Utils.Extensions;
using DevExpress.Xpf.Layout.Core;
@@ -51,6 +52,9 @@ namespace BeWo.ViewModel.View.Administration
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; }
@@ -59,19 +63,32 @@ namespace BeWo.ViewModel.View.Administration
get => _SelectedFolder;
set
{
SetProperty(ref _SelectedFolder, value, nameof(SelectedFolder));
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 => 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)
@@ -107,6 +124,18 @@ namespace BeWo.ViewModel.View.Administration
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);
}
@@ -140,7 +169,13 @@ namespace BeWo.ViewModel.View.Administration
OpenAddRoutineDialogCommand.RaiseCanExecuteChanged();
OpenEditRoutineDialogCommand.RaiseCanExecuteChanged();
DeleteRoutineCommand.RaiseCanExecuteChanged();
ChangeFavoritenStateRoutineCommand.RaiseCanExecuteChanged();
ChangeFavoritenStateRoutineCommand.RaiseCanExecuteChanged();
}
public void UpdateItemCommands()
{
OpenEditItemDialogCommand.RaiseCanExecuteChanged();
DeleteItemCommand.RaiseCanExecuteChanged();
ChangeFavoritenStateItemCommand.RaiseCanExecuteChanged();
}
internal void ReloadVMList()
@@ -226,7 +261,7 @@ namespace BeWo.ViewModel.View.Administration
bool canOpenAddFolderDialog()
{
return CanEditPromptbausteine && (SelectedFolder?.CanAddFolder ?? true);
return CanEditPromptbausteine && (SelectedFolder?.CanAddFolder ?? false);
}
bool canOpenEditFolderDialog()
{
@@ -533,6 +568,25 @@ namespace BeWo.ViewModel.View.Administration
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);

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;
}
public AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long oid)
{
var config = GetAiConfig();
//public AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long oid)
//{
// 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)
{
var parent_conv = DAOFactory.GenericDAO.GetByID<AiConversation>(conversation_oid);
@@ -236,6 +236,40 @@ namespace BeWo.Service.Plugins
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)
{
var modell_oid_value = GetAiConfig().SelectedModel.Oid.Value;

View File

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

View File

@@ -35,8 +35,6 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
=> GetAiService().CreateAiConversation(conversation, view_context);
public AiConversationDC CreateAiConversationWithMessage(AiConversationDC conversation, AiViewContextDC view_context, string 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)
=> GetAiService().CloneAiConversation(conversation_oid, last_message_oid);
@@ -50,6 +48,9 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
public AiConversationMessageDC[] SendNewMessage(long conversation, string 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)
=> GetAiService().CheckContextSize(actionType, view_context);