optik
This commit is contained in:
@@ -119,6 +119,7 @@
|
||||
<Compile Include="Converter\NewlineConverter.cs" />
|
||||
<Compile Include="Converter\StringEmptyBoolConverter.cs" />
|
||||
<Compile Include="Core\BeWoAppVersion.cs" />
|
||||
<Compile Include="Core\BeWoUserUtils.cs" />
|
||||
<Compile Include="Core\Commands\CommandFactory.cs" />
|
||||
<Compile Include="Core\EventArg\TextAcceptedEventArgs.cs" />
|
||||
<Compile Include="Scheduling\View\AbsenceTimesCreationView.xaml.cs">
|
||||
|
||||
13
BeWo/Core/BeWoUserUtils.cs
Normal file
13
BeWo/Core/BeWoUserUtils.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeWo.Core
|
||||
{
|
||||
public static class BeWoUserUtils
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -183,6 +183,7 @@
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!--<Border BorderThickness="1" Grid.ColumnSpan="2" Grid.RowSpan="2" BorderBrush="Black"></Border>-->
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="2"
|
||||
@@ -238,8 +239,8 @@
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,4,0,0"
|
||||
Padding="-3"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource MessageTextBoxStyle}" />
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@@ -17,69 +17,76 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style BasedOn="{StaticResource PrimaryButton}" TargetType="{x:Type Button}" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid Visibility="{Binding IsVisible, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<StackPanel
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="12" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="12" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="12" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
x:Name="btnOpenAiConversation"
|
||||
Grid.Column="0"
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOpenAi4"
|
||||
Height="30"
|
||||
Margin="0"
|
||||
Background="Transparent"
|
||||
Content="{StaticResource AiDesignsIconKIChatWeissOrange}"
|
||||
ToolTip="KI Chat öffnen"
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
Command="{Binding OpenConversationPopupCommand}"
|
||||
Style="{StaticResource PrimaryButton}">
|
||||
<!--<Button.InputBindings>
|
||||
Background="Transparent"
|
||||
Command="{Binding OpenConversationPopupCommand}"
|
||||
Content="{StaticResource AiDesignsIconKIChatWeissOrange}"
|
||||
ToolTip="KI Chat öffnen"
|
||||
ToolTipService.ShowOnDisabled="True">
|
||||
<!--<Button.InputBindings>
|
||||
<MouseBinding Command="{Binding OpenConversationPopupCommand}" Gesture="LeftClick" />
|
||||
</Button.InputBindings>-->
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="btnOpenAi5"
|
||||
Height="30"
|
||||
Margin="10,0,0,0"
|
||||
Background="Transparent"
|
||||
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
|
||||
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp"
|
||||
Command="{Binding OpenAllPromptsPopupCommand}"
|
||||
ToolTip="KI Chat mit Prompt-Baustein starten"
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
Style="{StaticResource PrimaryButton}">
|
||||
<!--<Button.InputBindings>
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="btnOpenAiDocumantation"
|
||||
Grid.Column="2"
|
||||
Margin="0"
|
||||
Background="Transparent"
|
||||
Command="{Binding OpenAllPromptsPopupCommand}"
|
||||
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
|
||||
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp"
|
||||
ToolTip="KI Chat mit Prompt-Baustein starten"
|
||||
ToolTipService.ShowOnDisabled="True">
|
||||
<!--<Button.InputBindings>
|
||||
<MouseBinding Command="{Binding OpenAllPromptsPopupCommand}" Gesture="LeftClick" />
|
||||
</Button.InputBindings>-->
|
||||
</Button>
|
||||
<Image
|
||||
x:Name="imgWarning"
|
||||
Height="20"
|
||||
Margin="10,0,0,0"
|
||||
Source="{Binding Source={x:Static draw:SystemIcons.Warning}, Converter={StaticResource IconToImageSourceConverter}, Mode=OneWay}"
|
||||
Visibility="{Binding IsContextSizeTooBig, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<!-- Visibility="{Binding ElementName=btnOpenAi4, Path=Visibility}" -->
|
||||
</Button>
|
||||
<Image
|
||||
x:Name="imgWarning"
|
||||
Grid.Column="4"
|
||||
Height="20"
|
||||
Source="{Binding Source={x:Static draw:SystemIcons.Warning}, Converter={StaticResource IconToImageSourceConverter}, Mode=OneWay}"
|
||||
Visibility="{Binding IsContextSizeTooBig, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<!-- Visibility="{Binding ElementName=btnOpenAi4, Path=Visibility}" -->
|
||||
|
||||
<Image.ToolTip>
|
||||
Die aktuelle Ansicht beinhaltet zu viele Daten.
|
||||
Es können keine neuen Chats zu dieser Ansicht erstellt werden.
|
||||
</Image.ToolTip>
|
||||
</Image>
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding IsHistoryEnabled, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<Button
|
||||
x:Name="btn_AiPromptbausteinUndo"
|
||||
Margin="3,0,0,0"
|
||||
Command="{Binding UndoAiActionCommand}"
|
||||
Style="{StaticResource ButtonPreviousStyle}"
|
||||
Visibility="{Binding IsUndoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
|
||||
<Button
|
||||
x:Name="btn_AiPromptbausteinRedo"
|
||||
Margin="3,0,3,0"
|
||||
Command="{Binding RedoAiActionCommand}"
|
||||
Style="{StaticResource ButtonRedoStyle}"
|
||||
Visibility="{Binding IsRedoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
|
||||
</StackPanel>
|
||||
<Image.ToolTip>
|
||||
Die aktuelle Ansicht beinhaltet zu viele Daten.
|
||||
Es können keine neuen Chats zu dieser Ansicht erstellt werden.
|
||||
</Image.ToolTip>
|
||||
</Image>
|
||||
<StackPanel
|
||||
x:Name="stackpanelUndoRedo"
|
||||
Grid.Column="6"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding IsHistoryEnabled, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<Button
|
||||
x:Name="btn_AiPromptbausteinUndo"
|
||||
Margin="0"
|
||||
Command="{Binding UndoAiActionCommand}"
|
||||
Style="{StaticResource ButtonPreviousStyle}"
|
||||
Visibility="{Binding IsUndoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
|
||||
<Button
|
||||
x:Name="btn_AiPromptbausteinRedo"
|
||||
Margin="3,0,0,0"
|
||||
Command="{Binding RedoAiActionCommand}"
|
||||
Style="{StaticResource ButtonRedoStyle}"
|
||||
Visibility="{Binding IsRedoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
|
||||
</StackPanel>
|
||||
<!--<Popup
|
||||
x:Name="popup_promptbaustein_all"
|
||||
|
||||
@@ -5,6 +5,7 @@ using BeWo.ViewModel.Controls.AI;
|
||||
using BeWo.ViewModel.View.AI;
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using BS.Shared.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -22,11 +23,32 @@ using System.Windows.Shapes;
|
||||
|
||||
namespace BeWo.View.Controls.AI
|
||||
{
|
||||
public enum AiChatButtonOrientation
|
||||
{
|
||||
Right, Left
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AiGenericConversationButton.xaml
|
||||
/// </summary>
|
||||
public partial class AiChatButton : UserControl
|
||||
{
|
||||
public AiChatButtonOrientation AiChatButtonOrientation
|
||||
{
|
||||
get { return (AiChatButtonOrientation)GetValue(AiChatButtonOrientationProperty); }
|
||||
set { SetValue(AiChatButtonOrientationProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty AiChatButtonOrientationProperty =
|
||||
DependencyProperty.Register("AiChatButtonOrientation", typeof(AiChatButtonOrientation), typeof(AiChatButton), new PropertyMetadata(AiChatButtonOrientation.Left, OnOrientationChanged));
|
||||
|
||||
static void OnOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var control = (AiChatButton)d;
|
||||
control.UpdateOrientation((AiChatButtonOrientation)e.NewValue);
|
||||
}
|
||||
|
||||
public AiChatButtonViewModel ViewModel => DataContext as AiChatButtonViewModel;
|
||||
|
||||
public AiChatButton()
|
||||
@@ -36,15 +58,7 @@ namespace BeWo.View.Controls.AI
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ViewModel.IsEnabled)
|
||||
{
|
||||
var actionType = ViewModel.ActionType;
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteinFolder(actionType), folders => InitPromptbausteine(actionType, folders),
|
||||
null,
|
||||
true,
|
||||
this);
|
||||
}
|
||||
ViewModel?.ReloadData(true, InitPromptbausteine);
|
||||
}
|
||||
|
||||
private void InitPromptbausteine(AiActionType actionType, List<AiPromptbausteinFolderDC> folders)
|
||||
@@ -78,5 +92,27 @@ namespace BeWo.View.Controls.AI
|
||||
{
|
||||
ViewModel.OpenFavoritePromptsPopupCommand.Execute(null);
|
||||
}
|
||||
|
||||
void UpdateOrientation(AiChatButtonOrientation orientation)
|
||||
{
|
||||
if(orientation == AiChatButtonOrientation.Left)
|
||||
{
|
||||
Grid.SetColumn(btnOpenAiConversation, 0);
|
||||
Grid.SetColumn(btnOpenAiDocumantation, 2);
|
||||
Grid.SetColumn(imgWarning, 4);
|
||||
Grid.SetColumn(stackpanelUndoRedo, 6);
|
||||
}
|
||||
else if(orientation == AiChatButtonOrientation.Right)
|
||||
{
|
||||
Grid.SetColumn(btnOpenAiConversation, 4);
|
||||
Grid.SetColumn(btnOpenAiDocumantation, 6);
|
||||
Grid.SetColumn(imgWarning, 2);
|
||||
Grid.SetColumn(stackpanelUndoRedo, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw BeWoNotImplementedException.CreateFromEnum(orientation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1520,7 +1520,10 @@
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</StackPanel.Resources>
|
||||
<ai:AiChatButton x:Name="btn_ai_docu" DataContext="{Binding Path=AiChatButtonDocumentationEditViewModel}" />
|
||||
<ai:AiChatButton
|
||||
x:Name="btn_ai_docu"
|
||||
AiChatButtonOrientation="Right"
|
||||
DataContext="{Binding Path=AiChatButtonDocumentationEditViewModel}" />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -1730,7 +1730,10 @@
|
||||
ActionType="ServiceRecordDocumentation"
|
||||
CanExecute="{Binding PrototypeVM.Notice, Converter={StaticResource StringEmptyBoolConverter}}"
|
||||
ItemAccepted="btn_AiPromptbaustein2_ItemAccepted" />-->
|
||||
<ai:AiChatButton x:Name="btn_ai_docu" DataContext="{Binding AiChatButtonDocumentationViewModel}" />
|
||||
<ai:AiChatButton
|
||||
x:Name="btn_ai_docu"
|
||||
AiChatButtonOrientation="Right"
|
||||
DataContext="{Binding AiChatButtonDocumentationViewModel}" />
|
||||
<!--</StackPanel>-->
|
||||
|
||||
|
||||
@@ -3335,7 +3338,13 @@
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ai:AiChatButton x:Name="btn_ai_conv" DataContext="{Binding AiChatButtonConversationViewModel}" />
|
||||
<ai:AiChatButton x:Name="btn_ai_conv" DataContext="{Binding AiChatButtonConversationViewModel}">
|
||||
<ai:AiChatButton.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style BasedOn="{StaticResource NavigationToolbarButtonStyle}" TargetType="{x:Type Button}" />
|
||||
</ResourceDictionary>
|
||||
</ai:AiChatButton.Resources>
|
||||
</ai:AiChatButton>
|
||||
<!--<ai:AiConversationButton
|
||||
x:Name="ai_conversation_btn"
|
||||
Margin="10,0,0,0"
|
||||
|
||||
@@ -50,7 +50,8 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
public AiChatButtonState ButtonState
|
||||
{
|
||||
get => buttonState;
|
||||
set {
|
||||
set
|
||||
{
|
||||
if (!SetProperty(ref buttonState, value, nameof(ButtonState)))
|
||||
return;
|
||||
|
||||
@@ -87,20 +88,20 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
OpenConversationPopupCommand = new DelegateCommand(OpenConversationPopup, () => CanOpenConversation);
|
||||
OpenAllPromptsPopupCommand = new DelegateCommand(OpenAllPromptsPopup, () => CanSendNewMessage);
|
||||
OpenFavoritePromptsPopupCommand = new DelegateCommand(OpenFavoritePromptsPopup, () => CanSendNewMessage);
|
||||
|
||||
ButtonState = AiChatButtonState.Loading;
|
||||
}
|
||||
|
||||
public void CheckContextSize()
|
||||
{
|
||||
if (!IsEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ButtonState = AiChatButtonState.Loading;
|
||||
var context = GetAiVisualContext();
|
||||
if (context != null)
|
||||
{
|
||||
if(context.Primary is null)
|
||||
if (context.Primary is null)
|
||||
{
|
||||
IsVisible = false;
|
||||
ButtonState = AiChatButtonState.Disabled;
|
||||
@@ -121,6 +122,42 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
}
|
||||
}
|
||||
|
||||
public void ReloadData(bool value, Action<AiActionType, List<AiPromptbausteinFolderDC>> initPromptbausteine)
|
||||
{
|
||||
if (!IsEnabled)
|
||||
return;
|
||||
|
||||
var actionType = ActionType;
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteinFolder(actionType), folders => initPromptbausteine(actionType, folders),
|
||||
null,
|
||||
true);
|
||||
}
|
||||
|
||||
public void ItemAccepted(AbstractBaseVM e)
|
||||
{
|
||||
if (e is AiPromptbausteinPromptVM prompt)
|
||||
{
|
||||
var vm = GetConversationViewModel();
|
||||
vm.SendAfterLoaded = true;
|
||||
vm.PromptInput = prompt;
|
||||
vm.MessageInput = prompt.Prompt;
|
||||
BeWoApp.MainControl.WindowService.Show(vm);
|
||||
return;
|
||||
}
|
||||
else if (e is AiPromptbausteinRoutineVM routine)
|
||||
{
|
||||
var vm = GetConversationViewModel();
|
||||
vm.SendAfterLoaded = true;
|
||||
vm.RoutineInput = routine;
|
||||
vm.MessageInput = routine.Steps.VMList[0].PromptReference.Prompt;
|
||||
BeWoApp.MainControl.WindowService.Show(vm);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private protected AiConversationChatViewModel GetConversationViewModel()
|
||||
{
|
||||
var context = GetAiVisualContext();
|
||||
@@ -162,30 +199,6 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
|
||||
throw new InvalidOperationException($"UserRightType '{ActionType}' not implemented");
|
||||
}
|
||||
|
||||
public void ItemAccepted(AbstractBaseVM e)
|
||||
{
|
||||
if(e is AiPromptbausteinPromptVM prompt)
|
||||
{
|
||||
var vm = GetConversationViewModel();
|
||||
vm.SendAfterLoaded = true;
|
||||
vm.PromptInput = prompt;
|
||||
vm.MessageInput = prompt.Prompt;
|
||||
BeWoApp.MainControl.WindowService.Show(vm);
|
||||
return;
|
||||
}
|
||||
else if(e is AiPromptbausteinRoutineVM routine)
|
||||
{
|
||||
var vm = GetConversationViewModel();
|
||||
vm.SendAfterLoaded = true;
|
||||
vm.RoutineInput = routine;
|
||||
vm.MessageInput = routine.Steps.VMList[0].PromptReference.Prompt;
|
||||
BeWoApp.MainControl.WindowService.Show(vm);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class AiMenuItemTemplate
|
||||
|
||||
Reference in New Issue
Block a user