auswahl
This commit is contained in:
@@ -173,6 +173,7 @@
|
||||
<Compile Include="ViewModel\View\AI\AiConversationChatViewModel.cs" />
|
||||
<Compile Include="ViewModel\View\AI\AiPromptbausteinActionResultViewModel.cs" />
|
||||
<Compile Include="ViewModel\View\AI\AiPromptbausteinComplexSelectionViewModel.cs" />
|
||||
<Compile Include="ViewModel\IAiPromptbausteinComplexViewModel.cs" />
|
||||
<Compile Include="ViewModel\View\Developer\DesignDeveloperViewModel.cs" />
|
||||
<Compile Include="ViewModel\View\Developer\DeveloperViewModel.cs" />
|
||||
<Compile Include="ViewModel\View\DialogViewModel.cs" />
|
||||
@@ -187,6 +188,9 @@
|
||||
<Compile Include="View\Controls\AI\AiPromptbausteinButton.xaml.cs">
|
||||
<DependentUpon>AiPromptbausteinButton.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\Controls\AI\AiPromptbausteinLibraryControl.xaml.cs">
|
||||
<DependentUpon>AiPromptbausteinLibraryControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\Detail\AI\AiPromptbausteinActionResultView.xaml.cs">
|
||||
<DependentUpon>AiPromptbausteinActionResultView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -320,6 +324,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\Controls\AI\AiPromptbausteinLibraryControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\Detail\AI\AiPromptbausteinActionResultView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -139,8 +139,8 @@ namespace BeWo.Services
|
||||
var control = new AiPromptbausteinComplexSelectionView(viewModel);
|
||||
var options = new BeWoWindowOptions()
|
||||
{
|
||||
Height = 400,
|
||||
Width = 600
|
||||
Height = 600,
|
||||
Width = 900
|
||||
};
|
||||
Show("KI Promptbaustein Auswahl", control, viewModel, options);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
x:Key="ai_promptbaustein_folder_itemtemplate"
|
||||
DataType="{x:Type vm:AiPromptbausteinFolderVM}"
|
||||
ItemsSource="{Binding Path=SubFolders.VMList}">
|
||||
<Grid Background="Transparent">
|
||||
<Grid Background="Transparent" Margin="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -33,10 +33,12 @@
|
||||
Grid.Column="1"
|
||||
Height="21"
|
||||
Margin="0,0,0,0"
|
||||
Padding="0,3,0,0"
|
||||
Padding="0,0,0,0"
|
||||
BorderThickness="0"
|
||||
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontSize="12"
|
||||
|
||||
811
BeWo/View/Controls/AI/AiPromptbausteinLibraryControl.xaml
Normal file
811
BeWo/View/Controls/AI/AiPromptbausteinLibraryControl.xaml
Normal file
@@ -0,0 +1,811 @@
|
||||
<UserControl
|
||||
x:Class="BeWo.View.Controls.AI.AiPromptbausteinLibraryControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:administration="clr-namespace:BeWo.ViewModel.View.Administration"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templateselectors="clr-namespace:BeWo.View.TemplateSelectors"
|
||||
xmlns:vm="clr-namespace:BeWo.ViewModel"
|
||||
x:Name="root"
|
||||
d:DataContext="{d:DesignInstance Type=administration:AiPromptbausteinComplexTreeViewModel,
|
||||
IsDesignTimeCreatable=True}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style
|
||||
x:Key="PromptListBoxItem"
|
||||
BasedOn="{StaticResource PhotoListBoxItem}"
|
||||
TargetType="ListBoxItem" />
|
||||
<DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}">
|
||||
<Border
|
||||
x:Name="border"
|
||||
Background="#09000000"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5"
|
||||
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}">
|
||||
<Border.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenAddPromptDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Neuer Prompt">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenEditPromptDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Bearbeiten">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.ChangeFavoritenStatePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="{Binding FavoritenHeader}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.CopyPromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Kopieren">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.PastePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Einfügen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.DeletePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Löschen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
|
||||
<Grid
|
||||
Margin="6"
|
||||
Background="Transparent"
|
||||
ContextMenuOpening="ListBox_ContextMenuOpening"
|
||||
PreviewMouseDown="Grid_PreviewMouseDown_1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="6" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
Grid.RowSpan="2"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Fill="White" />
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<TextBox
|
||||
Height="21"
|
||||
Margin="2,0,0,0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
<TextBox.ToolTip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
|
||||
<TextBox
|
||||
MaxWidth="500"
|
||||
Padding="3,1,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
<TextBlock
|
||||
x:Name="infobox"
|
||||
Margin="0"
|
||||
Padding="0">
|
||||
<TextBlock.Visibility>
|
||||
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
|
||||
<Binding Path="IsSelected" RelativeSource="{RelativeSource AncestorType={x:Type ListBoxItem}}" />
|
||||
<Binding Path="IsInfoVisible" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Visibility>
|
||||
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
|
||||
(i)
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Width="46"
|
||||
Margin="0,0,3,0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="#EEEDFE"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="1,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="Prompt"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
<!--<TextBlock
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10">
|
||||
Bearbeitet vor x Minuten
|
||||
</TextBlock>-->
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="AiPromptbausteinRoutineItemTemplate" DataType="vm:AiPromptbausteinRoutineVM">
|
||||
<Border
|
||||
Background="#09000000"
|
||||
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>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenAddRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Neue Routine">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenEditRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Bearbeiten">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="favorite2"
|
||||
Command="{Binding PlacementTarget.Tag.ChangeFavoritenStateRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
Header="{Binding FavoritenHeader}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.DeleteRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Löschen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
<Grid
|
||||
Margin="6"
|
||||
Background="Transparent"
|
||||
ContextMenuOpening="ListBox_ContextMenuOpening"
|
||||
PreviewMouseDown="Grid_PreviewMouseDown_2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="9" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
Grid.RowSpan="2"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Fill="White" />
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<TextBox
|
||||
Height="21"
|
||||
Margin="0,0,0,0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
<TextBox.ToolTip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
|
||||
<TextBox
|
||||
MaxWidth="500"
|
||||
Padding="3,1,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Margin="0,-1,0,0"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Width="46"
|
||||
Margin="0,0,3,0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="#E1F5EE"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="1,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="Routine"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
<TextBlock
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{0} Schritte">
|
||||
<Binding Path="Steps.Count" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<ListBox
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Margin="3,9,3,3"
|
||||
AllowDrop="False"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Focusable="False"
|
||||
IsHitTestVisible="False"
|
||||
ItemsSource="{Binding Steps.VMList}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
x:Name="arrow"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Text="➔" />
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Height="19"
|
||||
Margin="0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="DarkGray"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="3,0,3,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="{Binding PromptReference.Title, StringFormat={}✦ {0}}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
|
||||
<Setter TargetName="arrow" Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter TargetName="border1" Property="Background" Value="LightCoral" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
||||
<templateselectors:AiPromptbausteinFolderItemTemplateSelector
|
||||
x:Key="AiPromptbausteinFolderItemTemplateSelector"
|
||||
AiPromptbausteinPromptTemplate="{StaticResource AiPromptbausteinPromptItemTemplate}"
|
||||
AiPromptbausteinRoutineTemplate="{StaticResource AiPromptbausteinRoutineItemTemplate}" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="200" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="2*" MinWidth="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<GroupBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0,7,0,0"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Header="Bibliothek"
|
||||
Style="{StaticResource ObjectEditGroupBox}">
|
||||
<TreeView
|
||||
x:Name="treeView"
|
||||
MinHeight="100"
|
||||
Padding="4,16,4,16"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
AllowDrop="True"
|
||||
BorderThickness="1,0,0,1"
|
||||
ContextMenuOpening="treeView_ContextMenuOpening"
|
||||
Focusable="True"
|
||||
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
|
||||
ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}"
|
||||
ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}"
|
||||
PreviewMouseDown="Grid_PreviewMouseDown"
|
||||
PreviewMouseRightButtonDown="OnPreviewMouseRightButtonDown"
|
||||
SelectedItemChanged="treeView_SelectedItemChanged"
|
||||
TreeViewItem.Selected="treeView_Selected">
|
||||
<TreeView.Resources>
|
||||
<Style x:Key="igoal_treeitemstyle" TargetType="TreeViewItem">
|
||||
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
|
||||
</Style>
|
||||
</TreeView.Resources>
|
||||
<TreeView.InputBindings>
|
||||
<KeyBinding Key="Delete" Command="{Binding DeleteFolderCommand}" />
|
||||
<KeyBinding Key="Enter" Command="{Binding OpenEditFolderDialogCommand}" />
|
||||
<KeyBinding Key="N" Command="{Binding OpenAddFolderDialogCommand}" />
|
||||
<!--<KeyBinding
|
||||
Key="C"
|
||||
Command="{Binding CopyFolderCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="V"
|
||||
Command="{Binding PasteFolderCommand}"
|
||||
Modifiers="Ctrl" />-->
|
||||
</TreeView.InputBindings>
|
||||
<TreeView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem
|
||||
Command="{Binding OpenAddFolderDialogCommand}"
|
||||
Header="Neuer Ordner"
|
||||
ToolTip="Shortcut: N">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
Command="{Binding OpenEditFolderDialogCommand}"
|
||||
Header="Bearbeiten"
|
||||
ToolTip="Shortcut: Enter">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<!--<Separator />
|
||||
<MenuItem
|
||||
Command="{Binding CopyFolderCommand}"
|
||||
Header="Kopieren"
|
||||
ToolTip="Shortcut: Strg+C">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
Command="{Binding PasteFolderCommand}"
|
||||
Header="Einfügen"
|
||||
ToolTip="Shortcut: Strg+V">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>-->
|
||||
<Separator />
|
||||
<MenuItem
|
||||
Command="{Binding DeleteFolderCommand}"
|
||||
Header="Löschen"
|
||||
ToolTip="Shortcut: Entf">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
</TreeView>
|
||||
</GroupBox>
|
||||
<GridSplitter
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="1"
|
||||
HorizontalAlignment="Center"
|
||||
Background="#878890" />
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Grid.ColumnSpan="2">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Grid">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=treeView, Path=SelectedItem}" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Hidden" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<TabControl
|
||||
x:Name="tabcontrol_1"
|
||||
Padding="0"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="0,1,1,1"
|
||||
SelectionChanged="TabControl_SelectionChanged">
|
||||
<TabControl.Resources>
|
||||
<Style TargetType="{x:Type TabItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
MinHeight="20"
|
||||
Padding="12,3,12,3"
|
||||
Background="Transparent"
|
||||
TextElement.FontFamily="Microsoft Sans Serif"
|
||||
TextElement.FontSize="16"
|
||||
TextElement.Foreground="{StaticResource TabItemHotTextBrush}">
|
||||
<ContentPresenter Height="18" ContentSource="Header" RecognizesAccessKey="True" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Panel.ZIndex" Value="100" />
|
||||
<Setter TargetName="Border" Property="Background" Value="#22000000" />
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Border" Property="Background" Value="DarkRed" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="Black" />
|
||||
<Setter Property="Foreground" Value="DarkGray" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource {x:Type dxe:ListBoxEdit}}" TargetType="dxe:ListBoxEdit">
|
||||
<Setter Property="Padding" Value="8,16" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="AllowDrop" Value="False" />
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource PromptListBoxItem}" />
|
||||
<Setter Property="ItemTemplateSelector" Value="{StaticResource AiPromptbausteinFolderItemTemplateSelector}" />
|
||||
<Setter Property="SelectedItem" Value="{Binding SelectedItem, Mode=TwoWay}" />
|
||||
<Setter Property="SelectionMode" Value="Single" />
|
||||
<Setter Property="ShowBorder" Value="False" />
|
||||
<Setter Property="Focusable" Value="True" />
|
||||
<Setter Property="IsTabStop" Value="True" />
|
||||
<EventSetter Event="ContextMenuOpening" Handler="ListBox_ContextMenuOpening" />
|
||||
<EventSetter Event="PreviewMouseDown" Handler="listBoxEdit3_PreviewMouseDown" />
|
||||
</Style>
|
||||
</TabControl.Resources>
|
||||
<TabItem 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>
|
||||
</UserControl>
|
||||
202
BeWo/View/Controls/AI/AiPromptbausteinLibraryControl.xaml.cs
Normal file
202
BeWo/View/Controls/AI/AiPromptbausteinLibraryControl.xaml.cs
Normal file
@@ -0,0 +1,202 @@
|
||||
using BeWo.ViewModel;
|
||||
using DevExpress.Xpf.Editors;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BeWo.View.Controls.AI
|
||||
{
|
||||
/// <summary>
|
||||
/// Gemeinsame Promptbaustein-Bibliothek (TreeView + GridSplitter + TabControl),
|
||||
/// genutzt von AiPromptbausteinComplexTreeView und AiPromptbausteinComplexSelectionView.
|
||||
/// Der DataContext wird vom Host geerbt und muss IAiPromptbausteinComplexViewModel implementieren.
|
||||
/// </summary>
|
||||
public partial class AiPromptbausteinLibraryControl : UserControl
|
||||
{
|
||||
public AiPromptbausteinLibraryControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private IAiPromptbausteinComplexViewModel ViewModel => DataContext as IAiPromptbausteinComplexViewModel;
|
||||
|
||||
public static readonly DependencyProperty PromptActivatedCommandProperty =
|
||||
DependencyProperty.Register("PromptActivatedCommand", typeof(ICommand),
|
||||
typeof(AiPromptbausteinLibraryControl), new PropertyMetadata(null));
|
||||
|
||||
public static readonly DependencyProperty RoutineActivatedCommandProperty =
|
||||
DependencyProperty.Register("RoutineActivatedCommand", typeof(ICommand),
|
||||
typeof(AiPromptbausteinLibraryControl), new PropertyMetadata(null));
|
||||
|
||||
/// <summary>
|
||||
/// Wird bei Doppelklick auf einen Prompt ausgeführt (Verwaltung: Bearbeiten, Auswahl: Senden).
|
||||
/// </summary>
|
||||
public ICommand PromptActivatedCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(PromptActivatedCommandProperty); }
|
||||
set { SetValue(PromptActivatedCommandProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wird bei Doppelklick auf eine Routine ausgeführt (Verwaltung: Bearbeiten, Auswahl: Senden).
|
||||
/// </summary>
|
||||
public ICommand RoutineActivatedCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(RoutineActivatedCommandProperty); }
|
||||
set { SetValue(RoutineActivatedCommandProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setzt die initiale Selektion zurück (erstes TreeViewItem an- und wieder abwählen),
|
||||
/// damit beim Öffnen kein Ordner vorselektiert ist.
|
||||
/// </summary>
|
||||
public void ResetInitialSelection()
|
||||
{
|
||||
if (treeView.ItemContainerGenerator.ContainerFromIndex(0) is TreeViewItem item)
|
||||
{
|
||||
item.IsSelected = true;
|
||||
item.IsSelected = false;
|
||||
}
|
||||
|
||||
listBoxEdit1.UnSelectAll();
|
||||
}
|
||||
|
||||
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(e.OriginalSource as DependencyObject);
|
||||
|
||||
if (treeViewItem != null)
|
||||
{
|
||||
treeViewItem.Focus();
|
||||
e.Handled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
if (ViewModel?.SelectedFolder == null)
|
||||
return;
|
||||
|
||||
_LastTreeViewItem.IsSelected = false;
|
||||
|
||||
treeView.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
static T VisualUpwardSearch<T>(DependencyObject source) where T : DependencyObject
|
||||
{
|
||||
while (source != null && !(source is T))
|
||||
source = VisualTreeHelper.GetParent(source);
|
||||
|
||||
return source as T;
|
||||
}
|
||||
|
||||
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||
{
|
||||
if (ViewModel is null)
|
||||
return;
|
||||
|
||||
ViewModel.SelectedFolder = treeView.SelectedValue as AiPromptbausteinFolderVM;
|
||||
}
|
||||
|
||||
private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(e.OriginalSource as DependencyObject);
|
||||
|
||||
if (treeViewItem is null)
|
||||
{
|
||||
treeView.Focus();
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.ClickCount == 2)
|
||||
{
|
||||
if (!ViewModel.OpenEditFolderDialogCommand.CanExecute(null))
|
||||
return;
|
||||
|
||||
ViewModel.OpenEditFolderDialogCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private TreeViewItem _LastTreeViewItem;
|
||||
private void treeView_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_LastTreeViewItem = e.OriginalSource as TreeViewItem;
|
||||
}
|
||||
|
||||
private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
{
|
||||
ViewModel?.UpdateFolderCommands();
|
||||
}
|
||||
|
||||
private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
{
|
||||
ViewModel?.UpdatePromptCommands();
|
||||
}
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Grid_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var cmd = PromptActivatedCommand;
|
||||
|
||||
if (cmd == null || !cmd.CanExecute(null))
|
||||
return;
|
||||
|
||||
if (e.ClickCount == 2)
|
||||
{
|
||||
cmd.Execute(null);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Grid_PreviewMouseDown_2(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var cmd = RoutineActivatedCommand;
|
||||
|
||||
if (cmd == null || !cmd.CanExecute(null))
|
||||
return;
|
||||
|
||||
if (e.ClickCount == 2)
|
||||
{
|
||||
cmd.Execute(null);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is TabControl)
|
||||
{
|
||||
listBoxEdit1.UnSelectAll();
|
||||
listBoxEdit2.UnSelectAll();
|
||||
listBoxEdit3.UnSelectAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void listBoxEdit3_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!(e.OriginalSource is UIElement))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ListBoxItem listBoxItem = VisualUpwardSearch<ListBoxItem>(e.OriginalSource as DependencyObject);
|
||||
|
||||
if (listBoxItem is null)
|
||||
{
|
||||
((ListBoxEdit)sender).Focus();
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
<UserControl
|
||||
<UserControl
|
||||
x:Class="BeWo.View.Detail.AI.AiPromptbausteinComplexSelectionFavoritenView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ai="clr-namespace:BeWo.ViewModel.View.AI"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
|
||||
xmlns:local="clr-namespace:BeWo.View.Detail.AI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templateselectors="clr-namespace:BeWo.View.TemplateSelectors"
|
||||
xmlns:vm="clr-namespace:BeWo.ViewModel"
|
||||
d:DataContext="{d:DesignInstance Type=ai:AiPromptbausteinSelectionComplexViewModel,
|
||||
IsDesignTimeCreatable=True}"
|
||||
@@ -22,9 +22,248 @@
|
||||
<Style
|
||||
x:Key="PromptListBoxItem"
|
||||
BasedOn="{StaticResource PhotoListBoxItem}"
|
||||
TargetType="dxe:ListBoxEditItem">
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
|
||||
</Style>
|
||||
TargetType="ListBoxItem" />
|
||||
<DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}">
|
||||
<Border
|
||||
Background="#09000000"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Grid
|
||||
Margin="6"
|
||||
Background="Transparent"
|
||||
PreviewMouseUp="Item_MouseUp">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="6" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
Grid.RowSpan="2"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Fill="White" />
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<TextBox
|
||||
Height="21"
|
||||
Margin="2,0,0,0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
<TextBox.ToolTip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
|
||||
<TextBox
|
||||
MaxWidth="500"
|
||||
Padding="3,1,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
<TextBlock
|
||||
x:Name="infobox"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
Visibility="{Binding IsInfoVisible, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
|
||||
(i)
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Width="46"
|
||||
Margin="0,0,3,0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="#EEEDFE"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="1,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="Prompt"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="AiPromptbausteinRoutineItemTemplate" DataType="vm:AiPromptbausteinRoutineVM">
|
||||
<Border
|
||||
Background="#09000000"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Grid
|
||||
Margin="6"
|
||||
Background="Transparent"
|
||||
PreviewMouseUp="Item_MouseUp">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="9" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
Grid.RowSpan="2"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Fill="White" />
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<TextBox
|
||||
Height="21"
|
||||
Margin="0,0,0,0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
<TextBox.ToolTip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
|
||||
<TextBox
|
||||
MaxWidth="500"
|
||||
Padding="3,1,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Margin="0,-1,0,0"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Width="46"
|
||||
Margin="0,0,3,0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="#E1F5EE"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="1,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="Routine"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
<TextBlock
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{0} Schritte">
|
||||
<Binding Path="Steps.Count" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<ListBox
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Margin="3,9,3,3"
|
||||
AllowDrop="False"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Focusable="False"
|
||||
IsHitTestVisible="False"
|
||||
ItemsSource="{Binding Steps.VMList}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
x:Name="arrow"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Text="➔" />
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Height="19"
|
||||
Margin="0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="DarkGray"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="3,0,3,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="{Binding PromptReference.Title, StringFormat={}✦ {0}}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
|
||||
<Setter TargetName="arrow" Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter TargetName="border1" Property="Background" Value="LightCoral" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
||||
<templateselectors:AiPromptbausteinFolderItemTemplateSelector
|
||||
x:Key="AiPromptbausteinFolderItemTemplateSelector"
|
||||
AiPromptbausteinPromptTemplate="{StaticResource AiPromptbausteinPromptItemTemplate}"
|
||||
AiPromptbausteinRoutineTemplate="{StaticResource AiPromptbausteinRoutineItemTemplate}" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
@@ -33,7 +272,6 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<GroupBox
|
||||
x:Name="groupbox2"
|
||||
@@ -41,74 +279,116 @@
|
||||
Header="Favoriten"
|
||||
Style="{StaticResource ObjectEditGroupBox}">
|
||||
<Grid>
|
||||
<dxe:ListBoxEdit
|
||||
x:Name="listBoxEdit1"
|
||||
Padding="4,16,4,16"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
EditValue="{Binding SelectedPrompt, Mode=TwoWay}"
|
||||
ItemContainerStyle="{StaticResource PromptListBoxItem}"
|
||||
ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectionMode="Single"
|
||||
<TabControl
|
||||
x:Name="tabcontrol_1"
|
||||
Padding="0"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="0,1,1,1"
|
||||
SelectionChanged="TabControl_SelectionChanged"
|
||||
Visibility="{Binding HasFavoriten, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<dxe:ListBoxEdit.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid
|
||||
Margin="0,3,0,0"
|
||||
Background="Transparent"
|
||||
MouseEnter="Grid_MouseEnter"
|
||||
MouseUp="Grid_MouseUp">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox
|
||||
Height="21"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
<TextBox.ToolTip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
|
||||
<TextBox
|
||||
MaxWidth="500"
|
||||
Padding="3,1,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
Visibility="{Binding IsInfoVisible, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
|
||||
(i)
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</dxe:ListBoxEdit.ItemTemplate>
|
||||
</dxe:ListBoxEdit>
|
||||
<TabControl.Resources>
|
||||
<Style TargetType="{x:Type TabItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
MinHeight="20"
|
||||
Padding="12,3,12,3"
|
||||
Background="Transparent"
|
||||
TextElement.FontFamily="Microsoft Sans Serif"
|
||||
TextElement.FontSize="16"
|
||||
TextElement.Foreground="{StaticResource TabItemHotTextBrush}">
|
||||
<ContentPresenter Height="18" ContentSource="Header" RecognizesAccessKey="True" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Panel.ZIndex" Value="100" />
|
||||
<Setter TargetName="Border" Property="Background" Value="#22000000" />
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Border" Property="Background" Value="DarkRed" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="Black" />
|
||||
<Setter Property="Foreground" Value="DarkGray" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource {x:Type dxe:ListBoxEdit}}" TargetType="dxe:ListBoxEdit">
|
||||
<Setter Property="Padding" Value="8,16" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="AllowDrop" Value="False" />
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource PromptListBoxItem}" />
|
||||
<Setter Property="ItemTemplateSelector" Value="{StaticResource AiPromptbausteinFolderItemTemplateSelector}" />
|
||||
<Setter Property="SelectedItem" Value="{Binding SelectedItem, Mode=TwoWay}" />
|
||||
<Setter Property="SelectionMode" Value="Single" />
|
||||
<Setter Property="ShowBorder" Value="False" />
|
||||
</Style>
|
||||
</TabControl.Resources>
|
||||
<TabItem Header="Alle">
|
||||
<Grid Background="Transparent">
|
||||
<dxe:ListBoxEdit x:Name="listBoxEdit3" ItemsSource="{Binding SelectedFolder.AlleFolderItems, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
IsHitTestVisible="False">
|
||||
<TextBlock.Visibility>
|
||||
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
|
||||
<Binding
|
||||
Converter="{StaticResource CollectionCountToBoolConverter}"
|
||||
ConverterParameter="reverse"
|
||||
Path="SelectedFolder.AlleFolderItems.Count" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Visibility>
|
||||
Keine Favoriten vorhanden.
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Prompts">
|
||||
<Grid Background="Transparent">
|
||||
<dxe:ListBoxEdit x:Name="listBoxEdit1" ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
IsHitTestVisible="False">
|
||||
<TextBlock.Visibility>
|
||||
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
|
||||
<Binding
|
||||
Converter="{StaticResource CollectionCountToBoolConverter}"
|
||||
ConverterParameter="reverse"
|
||||
Path="SelectedFolder.Prompts.Count" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Visibility>
|
||||
Keine Prompt-Favoriten vorhanden.
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Routinen">
|
||||
<Grid Background="Transparent">
|
||||
<dxe:ListBoxEdit x:Name="listBoxEdit2" ItemsSource="{Binding SelectedFolder.Routines, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
IsHitTestVisible="False">
|
||||
<TextBlock.Visibility>
|
||||
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
|
||||
<Binding
|
||||
Converter="{StaticResource CollectionCountToBoolConverter}"
|
||||
ConverterParameter="reverse"
|
||||
Path="SelectedFolder.Routines.Count" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Visibility>
|
||||
Keine Routinen-Favoriten vorhanden.
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<TextBlock
|
||||
Margin="3"
|
||||
HorizontalAlignment="Center"
|
||||
@@ -119,92 +399,5 @@
|
||||
Bitte legen Sie in der Verwaltung Ihre gewünschten Prompt-Favoriten fest.</TextBlock>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<!--<GroupBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Header="Details"
|
||||
Style="{StaticResource ObjectEditGroupBox}">
|
||||
<Grid
|
||||
MaxWidth="700"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="#fdfdfd">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" MinWidth="80" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="3*" MinWidth="100" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0">Name</Label>
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
IsEnabled="{Binding IsEditingMode}"
|
||||
Text="{Binding ViewModel.Title, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Content="Beschreibung" />
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
IsEnabled="{Binding IsEditingMode}"
|
||||
MaxLength="1024"
|
||||
Style="{StaticResource TextBoxNotice}"
|
||||
Text="{Binding ViewModel.Description, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Content="Prompt" />
|
||||
<TextBox
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
IsEnabled="{Binding IsEditingMode}"
|
||||
MaxLength="1024"
|
||||
Style="{StaticResource TextBoxNoticeLarge}"
|
||||
Text="{Binding ViewModel.Prompt, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<Label
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Content="Ersteller:" />
|
||||
<comboboxes:ComboBoxEmployeeSearch
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
Margin="3"
|
||||
IsEnabled="False"
|
||||
SelectedCompactEmployeeDC="{Binding ViewModel.Creator}" />
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
|
||||
<dxe:CheckEdit
|
||||
Grid.Row="4"
|
||||
Grid.Column="2"
|
||||
Margin="3"
|
||||
IsChecked="{Binding ViewModel.IsPublic}"
|
||||
IsEnabled="{Binding IsEditingMode, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
</GroupBox>-->
|
||||
<!--<Button
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Command="{Binding SendCommand}"
|
||||
Style="{StaticResource PrimaryButton}"
|
||||
Visibility="{Binding HasFavoriten, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
Absenden
|
||||
</Button>-->
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
using BeWo.ViewModel.View.AI;
|
||||
using BeWo.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BeWo.ViewModel.View.AI;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace BeWo.View.Detail.AI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AiPromptbausteinComplexSelectionView.xaml
|
||||
/// Interaktionslogik für AiPromptbausteinComplexSelectionFavoritenView.xaml
|
||||
/// Reine Auswahl-Ansicht der Favoriten (keine Bearbeitung) — ein Klick auf einen Eintrag sendet sofort.
|
||||
/// </summary>
|
||||
public partial class AiPromptbausteinComplexSelectionFavoritenView : UserControl
|
||||
{
|
||||
@@ -36,17 +26,27 @@ namespace BeWo.View.Detail.AI
|
||||
ViewModel.InitVMList();
|
||||
|
||||
listBoxEdit1.UnSelectAll();
|
||||
listBoxEdit2.UnSelectAll();
|
||||
listBoxEdit3.UnSelectAll();
|
||||
};
|
||||
}
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||
private void Item_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
e.Handled = true;
|
||||
}
|
||||
if (e.ChangedButton != MouseButton.Left)
|
||||
return;
|
||||
|
||||
// Klick auf den (i)-Hyperlink soll nur den Link öffnen, nicht senden
|
||||
if ((e.OriginalSource as FrameworkElement)?.Name == "infobox")
|
||||
return;
|
||||
|
||||
var vm = (sender as FrameworkElement)?.DataContext as AbstractBaseVM;
|
||||
|
||||
if (vm is null)
|
||||
return;
|
||||
|
||||
ViewModel.SelectedItem = vm;
|
||||
|
||||
private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!ViewModel.SendCommand.CanExecute(null))
|
||||
return;
|
||||
|
||||
@@ -54,19 +54,20 @@ namespace BeWo.View.Detail.AI
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Grid_MouseEnter(object sender, MouseEventArgs e)
|
||||
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var grid = sender as Grid;
|
||||
if (e.OriginalSource is TabControl)
|
||||
{
|
||||
listBoxEdit1.UnSelectAll();
|
||||
listBoxEdit2.UnSelectAll();
|
||||
listBoxEdit3.UnSelectAll();
|
||||
}
|
||||
}
|
||||
|
||||
if (grid is null)
|
||||
return;
|
||||
|
||||
var vm = grid.DataContext as AiPromptbausteinPromptVM;
|
||||
|
||||
if (vm is null)
|
||||
return;
|
||||
|
||||
ViewModel.SelectedItem = vm;
|
||||
}
|
||||
}
|
||||
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,714 +1,48 @@
|
||||
<UserControl
|
||||
x:Class="BeWo.View.Detail.AI.AiPromptbausteinComplexSelectionView"
|
||||
<view:BeWoView
|
||||
xmlns:view="clr-namespace:BeWo.View" x:Class="BeWo.View.Detail.AI.AiPromptbausteinComplexSelectionView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ai="clr-namespace:BeWo.ViewModel.View.AI"
|
||||
xmlns:controls="clr-namespace:BeWo.View.Controls.AI"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
|
||||
xmlns:local="clr-namespace:BeWo.View.Detail.AI"
|
||||
xmlns:local1="clr-namespace:BeWo.View.Detail.AI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templateselectors="clr-namespace:BeWo.View.TemplateSelectors"
|
||||
xmlns:vm="clr-namespace:BeWo.ViewModel"
|
||||
d:DataContext="{d:DesignInstance Type=ai:AiPromptbausteinSelectionComplexViewModel,
|
||||
IsDesignTimeCreatable=True}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="{StaticResource ObjectEditBackgroundBrush}"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<view:BeWoView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style
|
||||
x:Key="PromptListBoxItem"
|
||||
BasedOn="{StaticResource PhotoListBoxItem}"
|
||||
TargetType="ListBoxItem" />
|
||||
<DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}">
|
||||
<Border
|
||||
Background="#09000000"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5"
|
||||
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}">
|
||||
<Border.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenAddPromptDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Neuer Prompt">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenEditPromptDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Bearbeiten">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.ChangeFavoritenStatePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="{Binding FavoritenHeader}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.CopyPromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Kopieren">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.PastePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Einfügen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.DeletePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Löschen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
|
||||
<Grid
|
||||
Margin="6"
|
||||
Background="Transparent"
|
||||
ContextMenuOpening="ListBox_ContextMenuOpening"
|
||||
PreviewMouseDown="Grid_PreviewMouseDown_1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="6" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
Grid.RowSpan="2"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Fill="White" />
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<TextBox
|
||||
Height="21"
|
||||
Margin="2,0,0,0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
<TextBox.ToolTip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
|
||||
<TextBox
|
||||
MaxWidth="500"
|
||||
Padding="3,1,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
<TextBlock
|
||||
x:Name="infobox"
|
||||
Margin="0"
|
||||
Padding="0">
|
||||
<TextBlock.Visibility>
|
||||
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
|
||||
<Binding Path="IsSelected" RelativeSource="{RelativeSource AncestorType={x:Type ListBoxItem}}" />
|
||||
<Binding Path="IsInfoVisible" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Visibility>
|
||||
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
|
||||
(i)
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Width="46"
|
||||
Margin="0,0,3,0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="#EEEDFE"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="1,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="Prompt"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
<TextBlock
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10">
|
||||
Bearbeitet vor x Minuten
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="AiPromptbausteinRoutineItemTemplate" DataType="vm:AiPromptbausteinRoutineVM">
|
||||
<Border
|
||||
Background="#09000000"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5"
|
||||
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}">
|
||||
<Border.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenAddRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Neue Routine">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenEditRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Bearbeiten">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="favorite2"
|
||||
Command="{Binding PlacementTarget.Tag.ChangeFavoritenStateRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
Header="{Binding FavoritenHeader}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.DeleteRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Löschen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
<Grid
|
||||
Margin="6"
|
||||
Background="Transparent"
|
||||
ContextMenuOpening="ListBox_ContextMenuOpening"
|
||||
PreviewMouseDown="Grid_PreviewMouseDown_2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="9" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
Grid.RowSpan="2"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Fill="White" />
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<TextBox
|
||||
Height="21"
|
||||
Margin="0,0,0,0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
<TextBox.ToolTip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
|
||||
<TextBox
|
||||
MaxWidth="500"
|
||||
Padding="3,1,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Margin="0,-1,0,0"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Width="46"
|
||||
Margin="0,0,3,0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="#E1F5EE"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="1,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="Routine"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
<TextBlock
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{0} Schritte">
|
||||
<Binding Path="Steps.Count" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<ListBox
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Margin="3,9,3,3"
|
||||
AllowDrop="False"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Focusable="False"
|
||||
IsHitTestVisible="False"
|
||||
ItemsSource="{Binding Steps.VMList}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
x:Name="arrow"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Text="➔" />
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Height="19"
|
||||
Margin="0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="DarkGray"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="3,0,3,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="{Binding PromptReference.Title, StringFormat={}✦ {0}}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
|
||||
<Setter TargetName="arrow" Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter TargetName="border1" Property="Background" Value="LightCoral" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
||||
<templateselectors:AiPromptbausteinFolderItemTemplateSelector
|
||||
x:Key="AiPromptbausteinFolderItemTemplateSelector"
|
||||
AiPromptbausteinPromptTemplate="{StaticResource AiPromptbausteinPromptItemTemplate}"
|
||||
AiPromptbausteinRoutineTemplate="{StaticResource AiPromptbausteinRoutineItemTemplate}" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
</view:BeWoView.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
Grid.ColumnSpan="3"
|
||||
Height="6"
|
||||
Fill="{DynamicResource ServiceRecordContentBrush}" />
|
||||
<Grid Grid.Row="1" Margin="6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="200" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="2*" MinWidth="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0,9,0,0"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Header="Bibliothek"
|
||||
Style="{StaticResource ObjectEditGroupBox}">
|
||||
<TreeView
|
||||
x:Name="treeView"
|
||||
MinHeight="100"
|
||||
Padding="4,16,4,16"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
AllowDrop="True"
|
||||
BorderThickness="1,0,0,1"
|
||||
ContextMenuOpening="treeView_ContextMenuOpening"
|
||||
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
|
||||
ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}"
|
||||
ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}"
|
||||
PreviewMouseRightButtonDown="OnPreviewMouseRightButtonDown"
|
||||
SelectedItemChanged="treeView_SelectedItemChanged"
|
||||
TreeViewItem.Selected="treeView_Selected">
|
||||
<TreeView.Resources>
|
||||
<Style x:Key="igoal_treeitemstyle" TargetType="TreeViewItem">
|
||||
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
|
||||
</Style>
|
||||
</TreeView.Resources>
|
||||
<TreeView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem Command="{Binding OpenAddFolderDialogCommand}" Header="Neu">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding OpenEditFolderDialogCommand}" Header="Bearbeiten">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding CopyFolderCommand}" Header="Kopieren">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PasteFolderCommand}" Header="Einfügen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding DeleteFolderCommand}" Header="Löschen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
</TreeView>
|
||||
</GroupBox>
|
||||
<GridSplitter
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="1"
|
||||
HorizontalAlignment="Center"
|
||||
Background="#878890" />
|
||||
<TabControl
|
||||
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">
|
||||
<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>
|
||||
|
||||
<controls:AiPromptbausteinLibraryControl
|
||||
x:Name="libraryControl"
|
||||
PromptActivatedCommand="{Binding SendCommand}"
|
||||
RoutineActivatedCommand="{Binding SendCommand}" />
|
||||
<Button
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="1"
|
||||
MinWidth="50"
|
||||
Margin="6"
|
||||
Command="{Binding SendCommand}"
|
||||
Content="{Binding AcceptButtonText}"
|
||||
Style="{StaticResource PrimaryButton}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
</view:BeWoView>
|
||||
|
||||
@@ -1,27 +1,12 @@
|
||||
using BeWo.ViewModel.View.AI;
|
||||
using BeWo.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using BeWo.ViewModel.View.AI;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace BeWo.View.Detail.AI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AiPromptbausteinComplexSelectionView.xaml
|
||||
/// </summary>
|
||||
public partial class AiPromptbausteinComplexSelectionView : UserControl
|
||||
public partial class AiPromptbausteinComplexSelectionView : BeWoView
|
||||
{
|
||||
public AiPromptbausteinSelectionComplexViewModel ViewModel { get; set; }
|
||||
|
||||
@@ -35,195 +20,8 @@ namespace BeWo.View.Detail.AI
|
||||
{
|
||||
ViewModel.InitVMList();
|
||||
|
||||
TreeViewItem item = treeView.ItemContainerGenerator.ContainerFromIndex(0) as TreeViewItem;
|
||||
if (item != null)
|
||||
{
|
||||
item.IsSelected = true;
|
||||
item.IsSelected = false;
|
||||
}
|
||||
listBoxEdit1.UnSelectAll();
|
||||
libraryControl.ResetInitialSelection();
|
||||
};
|
||||
}
|
||||
|
||||
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
|
||||
|
||||
if (treeViewItem != null)
|
||||
{
|
||||
treeViewItem.Focus();
|
||||
e.Handled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
if (ViewModel.SelectedFolder == null)
|
||||
return;
|
||||
|
||||
|
||||
_LastTreeViewItem.IsSelected = false;
|
||||
|
||||
treeView.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
static TreeViewItem VisualUpwardSearch(DependencyObject source)
|
||||
{
|
||||
while (source != null && !(source is TreeViewItem))
|
||||
source = VisualTreeHelper.GetParent(source);
|
||||
|
||||
return source as TreeViewItem;
|
||||
}
|
||||
|
||||
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||
{
|
||||
if (ViewModel is null)
|
||||
return;
|
||||
|
||||
ViewModel.SelectedFolder = treeView.SelectedValue as AiPromptbausteinFolderVM;
|
||||
}
|
||||
|
||||
private TreeViewItem _LastTreeViewItem;
|
||||
private void treeView_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_LastTreeViewItem = e.OriginalSource as TreeViewItem;
|
||||
}
|
||||
|
||||
private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
{
|
||||
ViewModel.UpdateFolderCommands();
|
||||
}
|
||||
|
||||
private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
{
|
||||
ViewModel.UpdatePromptCommands();
|
||||
}
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Grid_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!ViewModel.SendCommand.CanExecute(null))
|
||||
return;
|
||||
|
||||
if (e.ClickCount == 2)
|
||||
{
|
||||
ViewModel.SendCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is TabControl)
|
||||
{
|
||||
listBoxEdit1.UnSelectAll();
|
||||
listBoxEdit2.UnSelectAll();
|
||||
listBoxEdit3.UnSelectAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void Grid_PreviewMouseDown_2(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!ViewModel.SendCommand.CanExecute(null))
|
||||
return;
|
||||
|
||||
if (e.ClickCount == 2)
|
||||
{
|
||||
ViewModel.SendCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
//private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||
//{
|
||||
// if (ViewModel is null)
|
||||
// return;
|
||||
|
||||
// ViewModel.SelectedFolder = treeView.SelectedValue as AiPromptbausteinFolderVM;
|
||||
//}
|
||||
|
||||
//private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
//{
|
||||
// TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
|
||||
|
||||
// if (treeViewItem != null)
|
||||
// {
|
||||
// treeViewItem.Focus();
|
||||
// e.Handled = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// e.Handled = true;
|
||||
|
||||
// if (ViewModel.SelectedFolder == null)
|
||||
// return;
|
||||
|
||||
// _LastTreeViewItem.IsSelected = false;
|
||||
// treeView.Focus();
|
||||
// }
|
||||
//}
|
||||
|
||||
//static TreeViewItem VisualUpwardSearch(DependencyObject source)
|
||||
//{
|
||||
// while (source != null && !(source is TreeViewItem))
|
||||
// source = VisualTreeHelper.GetParent(source);
|
||||
|
||||
// return source as TreeViewItem;
|
||||
//}
|
||||
|
||||
//private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
//{
|
||||
// TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
|
||||
|
||||
// if (treeViewItem is null)
|
||||
// return;
|
||||
|
||||
// if (e.ClickCount == 2)
|
||||
// {
|
||||
// ViewModel.OpenEditFolderDialogCommand.Execute(null);
|
||||
// e.Handled = true;
|
||||
// }
|
||||
//}
|
||||
|
||||
//private TreeViewItem _LastTreeViewItem;
|
||||
//private void treeView_Selected(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// _LastTreeViewItem = e.OriginalSource as TreeViewItem;
|
||||
//}
|
||||
|
||||
//private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
//{
|
||||
// ViewModel.UpdateFolderCommands();
|
||||
//}
|
||||
|
||||
//private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
//{
|
||||
// ViewModel.UpdatePromptCommands();
|
||||
// favorite.Header = (ViewModel.SelectedPrompt?.IsFavorite ?? false) ? "Favorit entfernen" : "Favorit hinzufügen";
|
||||
//}
|
||||
|
||||
//private void Grid_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
|
||||
//{
|
||||
// if (!ViewModel.SendCommand.CanExecute(null))
|
||||
// return;
|
||||
|
||||
// if (e.ClickCount == 2)
|
||||
// {
|
||||
// ViewModel.SendCommand.Execute(null);
|
||||
// e.Handled = true;
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||
//{
|
||||
// Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
// e.Handled = true;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
<view:BeWoView
|
||||
<view:BeWoView
|
||||
x:Class="BeWo.View.Detail.AI.AiPromptbausteinComplexTreeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:administration="clr-namespace:BeWo.ViewModel.View.Administration"
|
||||
xmlns:comboboxes="clr-namespace:BeWo.View.Controls.ComboBoxes"
|
||||
xmlns:controls="clr-namespace:BeWo.View.Controls.AI"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
|
||||
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
|
||||
xmlns:local1="clr-namespace:BeWo.View.Detail.AI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templateselectors="clr-namespace:BeWo.View.TemplateSelectors"
|
||||
xmlns:view="clr-namespace:BeWo.View"
|
||||
xmlns:vm="clr-namespace:BeWo.ViewModel"
|
||||
x:Name="root"
|
||||
d:DataContext="{d:DesignInstance Type=administration:AiPromptbausteinComplexTreeViewModel,
|
||||
IsDesignTimeCreatable=True}"
|
||||
@@ -23,799 +18,14 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style
|
||||
x:Key="PromptListBoxItem"
|
||||
BasedOn="{StaticResource PhotoListBoxItem}"
|
||||
TargetType="ListBoxItem" />
|
||||
<DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}">
|
||||
<Border
|
||||
x:Name="border"
|
||||
Background="#09000000"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5"
|
||||
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}">
|
||||
<Border.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenAddPromptDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Neuer Prompt">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenEditPromptDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Bearbeiten">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.ChangeFavoritenStatePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="{Binding FavoritenHeader}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.CopyPromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Kopieren">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.PastePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Einfügen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.DeletePromptCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Löschen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
|
||||
<Grid
|
||||
Margin="6"
|
||||
Background="Transparent"
|
||||
ContextMenuOpening="ListBox_ContextMenuOpening"
|
||||
PreviewMouseDown="Grid_PreviewMouseDown_1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="6" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
Grid.RowSpan="2"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Fill="White" />
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<TextBox
|
||||
Height="21"
|
||||
Margin="2,0,0,0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
<TextBox.ToolTip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
|
||||
<TextBox
|
||||
MaxWidth="500"
|
||||
Padding="3,1,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
<TextBlock
|
||||
x:Name="infobox"
|
||||
Margin="0"
|
||||
Padding="0">
|
||||
<TextBlock.Visibility>
|
||||
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
|
||||
<Binding Path="IsSelected" RelativeSource="{RelativeSource AncestorType={x:Type ListBoxItem}}" />
|
||||
<Binding Path="IsInfoVisible" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Visibility>
|
||||
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
|
||||
(i)
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Width="46"
|
||||
Margin="0,0,3,0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="#EEEDFE"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="1,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="Prompt"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
<!--<TextBlock
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10">
|
||||
Bearbeitet vor x Minuten
|
||||
</TextBlock>-->
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="AiPromptbausteinRoutineItemTemplate" DataType="vm:AiPromptbausteinRoutineVM">
|
||||
<Border
|
||||
Background="#09000000"
|
||||
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>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenAddRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Neue Routine">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.OpenEditRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Bearbeiten">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="favorite2"
|
||||
Command="{Binding PlacementTarget.Tag.ChangeFavoritenStateRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
Header="{Binding FavoritenHeader}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Favorites32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Command="{Binding PlacementTarget.Tag.DeleteRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Header="Löschen">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
<Grid
|
||||
Margin="6"
|
||||
Background="Transparent"
|
||||
ContextMenuOpening="ListBox_ContextMenuOpening"
|
||||
PreviewMouseDown="Grid_PreviewMouseDown_2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="9" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
Grid.RowSpan="2"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Fill="White" />
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<TextBox
|
||||
Height="21"
|
||||
Margin="0,0,0,0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
<TextBox.ToolTip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
|
||||
<TextBox
|
||||
MaxWidth="500"
|
||||
Padding="3,1,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Margin="0,-1,0,0"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Width="46"
|
||||
Margin="0,0,3,0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="#E1F5EE"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="1,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="Routine"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
<TextBlock
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{0} Schritte">
|
||||
<Binding Path="Steps.Count" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<ListBox
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Margin="3,9,3,3"
|
||||
AllowDrop="False"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Focusable="False"
|
||||
IsHitTestVisible="False"
|
||||
ItemsSource="{Binding Steps.VMList}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
x:Name="arrow"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Text="➔" />
|
||||
<Border
|
||||
x:Name="border1"
|
||||
Height="19"
|
||||
Margin="0"
|
||||
Padding="3"
|
||||
HorizontalAlignment="Left"
|
||||
Background="DarkGray"
|
||||
CornerRadius="7">
|
||||
<TextBlock
|
||||
Margin="3,0,3,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="10"
|
||||
Text="{Binding PromptReference.Title, StringFormat={}✦ {0}}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
|
||||
<Setter TargetName="arrow" Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter TargetName="border1" Property="Background" Value="LightCoral" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
||||
<templateselectors:AiPromptbausteinFolderItemTemplateSelector
|
||||
x:Key="AiPromptbausteinFolderItemTemplateSelector"
|
||||
AiPromptbausteinPromptTemplate="{StaticResource AiPromptbausteinPromptItemTemplate}"
|
||||
AiPromptbausteinRoutineTemplate="{StaticResource AiPromptbausteinRoutineItemTemplate}" />
|
||||
</ResourceDictionary>
|
||||
</view:BeWoView.Resources>
|
||||
<GroupBox Style="{StaticResource ObjectEditGroupBox}">
|
||||
<GroupBox.Header>
|
||||
Aktuell definierte KI-Prompts
|
||||
</GroupBox.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="200" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="2*" MinWidth="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<GroupBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0,7,0,0"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Header="Bibliothek"
|
||||
Style="{StaticResource ObjectEditGroupBox}">
|
||||
<TreeView
|
||||
x:Name="treeView"
|
||||
MinHeight="100"
|
||||
Padding="4,16,4,16"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
AllowDrop="True"
|
||||
BorderThickness="1,0,0,1"
|
||||
ContextMenuOpening="treeView_ContextMenuOpening"
|
||||
Focusable="True"
|
||||
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
|
||||
ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}"
|
||||
ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}"
|
||||
PreviewMouseDown="Grid_PreviewMouseDown"
|
||||
PreviewMouseRightButtonDown="OnPreviewMouseRightButtonDown"
|
||||
SelectedItemChanged="treeView_SelectedItemChanged"
|
||||
TreeViewItem.Selected="treeView_Selected">
|
||||
<TreeView.Resources>
|
||||
<Style x:Key="igoal_treeitemstyle" TargetType="TreeViewItem">
|
||||
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
|
||||
</Style>
|
||||
</TreeView.Resources>
|
||||
<TreeView.InputBindings>
|
||||
<KeyBinding Key="Delete" Command="{Binding DeleteFolderCommand}" />
|
||||
<KeyBinding Key="Enter" Command="{Binding OpenEditFolderDialogCommand}" />
|
||||
<KeyBinding Key="N" Command="{Binding OpenAddFolderDialogCommand}" />
|
||||
<!--<KeyBinding
|
||||
Key="C"
|
||||
Command="{Binding CopyFolderCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="V"
|
||||
Command="{Binding PasteFolderCommand}"
|
||||
Modifiers="Ctrl" />-->
|
||||
</TreeView.InputBindings>
|
||||
<TreeView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem
|
||||
Command="{Binding OpenAddFolderDialogCommand}"
|
||||
Header="Neuer Ordner"
|
||||
ToolTip="Shortcut: N">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
Command="{Binding OpenEditFolderDialogCommand}"
|
||||
Header="Bearbeiten"
|
||||
ToolTip="Shortcut: Enter">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Rename24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<!--<Separator />
|
||||
<MenuItem
|
||||
Command="{Binding CopyFolderCommand}"
|
||||
Header="Kopieren"
|
||||
ToolTip="Shortcut: Strg+C">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Copy24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
Command="{Binding PasteFolderCommand}"
|
||||
Header="Einfügen"
|
||||
ToolTip="Shortcut: Strg+V">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Paste24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>-->
|
||||
<Separator />
|
||||
<MenuItem
|
||||
Command="{Binding DeleteFolderCommand}"
|
||||
Header="Löschen"
|
||||
ToolTip="Shortcut: Entf">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="..\..\..\Ressources\Icons\Delete24.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
</TreeView>
|
||||
</GroupBox>
|
||||
<GridSplitter
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="1"
|
||||
HorizontalAlignment="Center"
|
||||
Background="#878890" />
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Grid.ColumnSpan="2">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Grid">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=treeView, Path=SelectedItem}" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Hidden" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<TabControl
|
||||
x:Name="tabcontrol_1"
|
||||
Padding="0"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="0,1,1,1"
|
||||
SelectionChanged="TabControl_SelectionChanged">
|
||||
<TabControl.Resources>
|
||||
<Style TargetType="{x:Type TabItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
MinHeight="20"
|
||||
Padding="12,3,12,3"
|
||||
Background="Transparent"
|
||||
TextElement.FontFamily="Microsoft Sans Serif"
|
||||
TextElement.FontSize="16"
|
||||
TextElement.Foreground="{StaticResource TabItemHotTextBrush}">
|
||||
<ContentPresenter ContentSource="Header" RecognizesAccessKey="True" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Panel.ZIndex" Value="100" />
|
||||
<Setter TargetName="Border" Property="Background" Value="#22000000" />
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Border" Property="Background" Value="DarkRed" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="Black" />
|
||||
<Setter Property="Foreground" Value="DarkGray" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource {x:Type dxe:ListBoxEdit}}" TargetType="dxe:ListBoxEdit">
|
||||
<Setter Property="Padding" Value="8,16" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="AllowDrop" Value="False" />
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource PromptListBoxItem}" />
|
||||
<Setter Property="ItemTemplateSelector" Value="{StaticResource AiPromptbausteinFolderItemTemplateSelector}" />
|
||||
<Setter Property="SelectedItem" Value="{Binding SelectedItem, Mode=TwoWay}" />
|
||||
<Setter Property="SelectionMode" Value="Single" />
|
||||
<Setter Property="ShowBorder" Value="False" />
|
||||
<Setter Property="Focusable" Value="True" />
|
||||
<Setter Property="IsTabStop" Value="True" />
|
||||
<EventSetter Event="ContextMenuOpening" Handler="ListBox_ContextMenuOpening" />
|
||||
<EventSetter Event="PreviewMouseDown" Handler="listBoxEdit3_PreviewMouseDown" />
|
||||
</Style>
|
||||
</TabControl.Resources>
|
||||
<TabItem 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>
|
||||
<controls:AiPromptbausteinLibraryControl
|
||||
PromptActivatedCommand="{Binding OpenEditPromptDialogCommand}"
|
||||
RoutineActivatedCommand="{Binding OpenEditRoutineDialogCommand}" />
|
||||
</GroupBox>
|
||||
</view:BeWoView>
|
||||
|
||||
@@ -1,44 +1,17 @@
|
||||
using BeWo.Core;
|
||||
using BeWo.ViewModel;
|
||||
using BeWo.ViewModel.View.Administration;
|
||||
using DevExpress.DataAccess.DataFederation;
|
||||
using DevExpress.Mvvm;
|
||||
using DevExpress.Xpf.Accordion;
|
||||
using DevExpress.Xpf.Core.Native;
|
||||
using DevExpress.Xpf.Editors;
|
||||
using DevExpress.XtraEditors.TextEditController.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace BeWo.View.Detail.AI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AiPromptbausteinTreeView.xaml
|
||||
/// Interaktionslogik für AiPromptbausteinComplexTreeView.xaml
|
||||
/// </summary>
|
||||
public partial class AiPromptbausteinComplexTreeView : BeWoView
|
||||
{
|
||||
public bool IsDragging = false;
|
||||
|
||||
public AiPromptbausteinComplexTreeView(AiPromptbausteinComplexTreeViewModel viewModel = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (viewModel == null )
|
||||
if (viewModel == null)
|
||||
viewModel = new AiPromptbausteinComplexTreeViewModel(BeWoApp.WindowService, BS.Shared.AiActionType.ServiceRecordConversation);
|
||||
|
||||
DataContext = ViewModel = viewModel;
|
||||
@@ -49,158 +22,5 @@ namespace BeWo.View.Detail.AI
|
||||
public AiPromptbausteinComplexTreeViewModel ViewModel { get; set; }
|
||||
|
||||
public override bool IsDirty => ViewModel is object && ViewModel.IsDirty;
|
||||
|
||||
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(e.OriginalSource as DependencyObject);
|
||||
|
||||
if (treeViewItem != null)
|
||||
{
|
||||
treeViewItem.Focus();
|
||||
e.Handled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
if (ViewModel.SelectedFolder == null)
|
||||
return;
|
||||
|
||||
|
||||
_LastTreeViewItem.IsSelected = false;
|
||||
|
||||
treeView.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
static T VisualUpwardSearch<T>(DependencyObject source) where T : DependencyObject
|
||||
{
|
||||
while (source != null && !(source is T))
|
||||
source = VisualTreeHelper.GetParent(source);
|
||||
|
||||
return source as T;
|
||||
}
|
||||
|
||||
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||
{
|
||||
if (ViewModel is null)
|
||||
return;
|
||||
|
||||
ViewModel.SelectedFolder = treeView.SelectedValue as AiPromptbausteinFolderVM;
|
||||
}
|
||||
|
||||
private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
private TreeViewItem _LastTreeViewItem;
|
||||
private void treeView_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_LastTreeViewItem = e.OriginalSource as TreeViewItem;
|
||||
}
|
||||
|
||||
private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
{
|
||||
ViewModel.UpdatePromptCommands();
|
||||
}
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Grid_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!ViewModel.OpenEditPromptDialogCommand.CanExecute(null))
|
||||
return;
|
||||
|
||||
if (e.ClickCount == 2)
|
||||
{
|
||||
ViewModel.OpenEditPromptDialogCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if(e.OriginalSource is TabControl)
|
||||
{
|
||||
listBoxEdit1.UnSelectAll();
|
||||
listBoxEdit2.UnSelectAll();
|
||||
listBoxEdit3.UnSelectAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void Grid_PreviewMouseDown_2(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!ViewModel.OpenEditRoutineDialogCommand.CanExecute(null))
|
||||
return;
|
||||
|
||||
if (e.ClickCount == 2)
|
||||
{
|
||||
ViewModel.OpenEditRoutineDialogCommand.Execute(null);
|
||||
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)
|
||||
{
|
||||
if (!(e.OriginalSource is UIElement))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ListBoxItem listBoxItem = VisualUpwardSearch<ListBoxItem>(e.OriginalSource as DependencyObject);
|
||||
|
||||
if(listBoxItem is null)
|
||||
{
|
||||
((ListBoxEdit)sender).Focus();
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void listBoxEdit3_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
BeWo/ViewModel/IAiPromptbausteinComplexViewModel.cs
Normal file
18
BeWo/ViewModel/IAiPromptbausteinComplexViewModel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using DevExpress.Mvvm;
|
||||
|
||||
namespace BeWo.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gemeinsamer Vertrag der Promptbaustein-ViewModels (Verwaltung + Auswahl),
|
||||
/// gegen den das AiPromptbausteinLibraryControl im Code-Behind arbeitet.
|
||||
/// </summary>
|
||||
public interface IAiPromptbausteinComplexViewModel
|
||||
{
|
||||
AiPromptbausteinFolderVM SelectedFolder { get; set; }
|
||||
|
||||
DelegateCommand OpenEditFolderDialogCommand { get; }
|
||||
|
||||
void UpdateFolderCommands();
|
||||
void UpdatePromptCommands();
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace BeWo.ViewModel.View.AI
|
||||
{
|
||||
public class AiPromptbausteinSelectionComplexViewModel : DialogViewModel
|
||||
public class AiPromptbausteinSelectionComplexViewModel : DialogViewModel, IAiPromptbausteinComplexViewModel
|
||||
{
|
||||
public event EventHandler<AbstractBaseVM> ItemAccepted;
|
||||
public event EventHandler VMListReloaded;
|
||||
@@ -54,6 +54,10 @@ namespace BeWo.ViewModel.View.AI
|
||||
public DelegateCommand DeleteRoutineCommand { get; private set; }
|
||||
public DelegateCommand ChangeFavoritenStateRoutineCommand { get; private set; }
|
||||
|
||||
public DelegateCommand OpenEditItemDialogCommand { get; private set; }
|
||||
public DelegateCommand DeleteItemCommand { get; private set; }
|
||||
public DelegateCommand ChangeFavoritenStateItemCommand { get; private set; }
|
||||
|
||||
public bool CanEditPromptbausteine { get; set; }
|
||||
public bool HasCopiedFolder => CopiedFolder is object;
|
||||
public bool HasCopiedPrompt => CopiedPrompt is object;
|
||||
@@ -103,6 +107,18 @@ namespace BeWo.ViewModel.View.AI
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -111,12 +127,18 @@ namespace BeWo.ViewModel.View.AI
|
||||
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
|
||||
@@ -126,6 +148,7 @@ namespace BeWo.ViewModel.View.AI
|
||||
{
|
||||
SetProperty(ref _SelectedItem, value, nameof(SelectedItem));
|
||||
SendCommand.RaiseCanExecuteChanged();
|
||||
UpdateItemCommands();
|
||||
}
|
||||
}
|
||||
public AiPromptbausteinFolderListVM Folders { get; private set; }
|
||||
@@ -140,7 +163,7 @@ namespace BeWo.ViewModel.View.AI
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return Folders.Count > 3 && Folders.VMList[0].Prompts.Count > 0;
|
||||
return Folders.Count > 3 && (Folders.VMList[0].Prompts.Count > 0 || Folders.VMList[0].Routines.Count > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +241,12 @@ namespace BeWo.ViewModel.View.AI
|
||||
DeleteRoutineCommand?.RaiseCanExecuteChanged();
|
||||
ChangeFavoritenStateRoutineCommand?.RaiseCanExecuteChanged();
|
||||
}
|
||||
public void UpdateItemCommands()
|
||||
{
|
||||
OpenEditItemDialogCommand?.RaiseCanExecuteChanged();
|
||||
DeleteItemCommand?.RaiseCanExecuteChanged();
|
||||
ChangeFavoritenStateItemCommand?.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
// --- Folder Commands ---
|
||||
|
||||
@@ -515,5 +544,24 @@ namespace BeWo.ViewModel.View.AI
|
||||
bool canOpenEditRoutineDialog() => SelectedItem is AiPromptbausteinRoutineVM;
|
||||
bool canOpenDeleteRoutineDialog() => CanEditPromptbausteine && ((SelectedItem as AiPromptbausteinRoutineVM)?.CanEdit ?? false);
|
||||
bool canChangeFavoritenStateRoutine() => SelectedItem is AiPromptbausteinRoutineVM;
|
||||
|
||||
void ExecuteItem(Action prompt_action, Action routine_action)
|
||||
{
|
||||
if (SelectedItem is AiPromptbausteinPromptVM)
|
||||
prompt_action();
|
||||
else if (SelectedItem is AiPromptbausteinRoutineVM)
|
||||
routine_action();
|
||||
else
|
||||
throw new NotImplementedException("item is not AiPromptbausteinPromptVM or AiPromptbausteinRoutineVM");
|
||||
}
|
||||
bool canExecuteItem(Func<bool> prompt_func, Func<bool> routine_func)
|
||||
{
|
||||
if (SelectedItem is AiPromptbausteinPromptVM)
|
||||
return prompt_func();
|
||||
else if (SelectedItem is AiPromptbausteinRoutineVM)
|
||||
return routine_func();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ using static DevExpress.Utils.Drawing.Helpers.NativeMethods;
|
||||
|
||||
namespace BeWo.ViewModel.View.Administration
|
||||
{
|
||||
public class AiPromptbausteinComplexTreeViewModel : WindowViewModel
|
||||
public class AiPromptbausteinComplexTreeViewModel : WindowViewModel, IAiPromptbausteinComplexViewModel
|
||||
{
|
||||
private AiPromptbausteinFolderVM _SelectedFolder;
|
||||
private AbstractBaseVM _SelectedItem;
|
||||
|
||||
Reference in New Issue
Block a user