SubViewModel.Text Binding
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
xmlns:local="clr-namespace:BeWo.View.Controls.AI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DataContext="{d:DesignInstance Type=ai:AiChatButtonWithHistoryViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Loaded="UserControl_Loaded"
|
||||
Visibility="{Binding IsEnabled, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
Visibility="{Binding IsEnabled, Converter={StaticResource BoolVisibilityConverter}}"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -31,10 +31,12 @@
|
||||
Background="Transparent"
|
||||
Content="{StaticResource AiDesignsIconKIChatWeissOrange}"
|
||||
ToolTip="KI Chat öffnen"
|
||||
ToolTipService.ShowOnDisabled="True">
|
||||
<Button.InputBindings>
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
Command="{Binding OpenConversationPopupCommand}"
|
||||
Style="{StaticResource PrimaryButton}">
|
||||
<!--<Button.InputBindings>
|
||||
<MouseBinding Command="{Binding OpenConversationPopupCommand}" Gesture="LeftClick" />
|
||||
</Button.InputBindings>
|
||||
</Button.InputBindings>-->
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="btnOpenAi5"
|
||||
@@ -43,18 +45,20 @@
|
||||
Background="Transparent"
|
||||
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
|
||||
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp"
|
||||
Command="{Binding OpenAllPromptsPopupCommand}"
|
||||
ToolTip="KI Chat mit Prompt-Baustein starten"
|
||||
ToolTipService.ShowOnDisabled="True">
|
||||
<Button.InputBindings>
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
Style="{StaticResource PrimaryButton}">
|
||||
<!--<Button.InputBindings>
|
||||
<MouseBinding Command="{Binding OpenAllPromptsPopupCommand}" Gesture="LeftClick" />
|
||||
</Button.InputBindings>
|
||||
</Button.InputBindings>-->
|
||||
</Button>
|
||||
<Image
|
||||
x:Name="imgWarning"
|
||||
Height="20"
|
||||
Margin="10,0,0,0"
|
||||
Source="{Binding Source={x:Static draw:SystemIcons.Warning}, Converter={StaticResource IconToImageSourceConverter}, Mode=OneWay}"
|
||||
Visibility="Visible">
|
||||
Visibility="{Binding IsContextSizeTooBig, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<!-- Visibility="{Binding ElementName=btnOpenAi4, Path=Visibility}" -->
|
||||
|
||||
<Image.ToolTip>
|
||||
@@ -62,21 +66,19 @@
|
||||
Es können keine neuen Chats zu dieser Ansicht erstellt werden.
|
||||
</Image.ToolTip>
|
||||
</Image>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding IsHistoryEnabled, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<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}}" />
|
||||
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}}" />
|
||||
x:Name="btn_AiPromptbausteinRedo"
|
||||
Margin="3,0,3,0"
|
||||
Command="{Binding RedoAiActionCommand}"
|
||||
Style="{StaticResource ButtonRedoStyle}"
|
||||
Visibility="{Binding IsRedoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!--<Popup
|
||||
|
||||
@@ -1730,7 +1730,7 @@
|
||||
ActionType="ServiceRecordDocumentation"
|
||||
CanExecute="{Binding PrototypeVM.Notice, Converter={StaticResource StringEmptyBoolConverter}}"
|
||||
ItemAccepted="btn_AiPromptbaustein2_ItemAccepted" />-->
|
||||
<ai:AiChatButton x:Name="btn_ai_docu" />
|
||||
<ai:AiChatButton x:Name="btn_ai_docu" DataContext="{Binding AiChatButtonDocumentationViewModel}" />
|
||||
<!--</StackPanel>-->
|
||||
|
||||
|
||||
@@ -1772,7 +1772,7 @@
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
Language="de-DE"
|
||||
SpellCheck.IsEnabled="True"
|
||||
Text="{val:ValidationBinding Path=PrototypeVM.Notice,
|
||||
Text="{val:ValidationBinding Path=AktuellerDokutext,
|
||||
UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
@@ -1780,11 +1780,11 @@
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding
|
||||
Key="Z"
|
||||
Command="{Binding UndoAiActionCommand}"
|
||||
Command="{Binding AiChatButtonDocumentationViewModel.UndoAiActionCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="Y"
|
||||
Command="{Binding RedoAiActionCommand}"
|
||||
Command="{Binding AiChatButtonDocumentationViewModel.RedoAiActionCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
@@ -3335,7 +3335,7 @@
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ai:AiChatButton x:Name="btn_ai_conv" />
|
||||
<ai:AiChatButton x:Name="btn_ai_conv" DataContext="{Binding AiChatButtonConversationViewModel}" />
|
||||
<!--<ai:AiConversationButton
|
||||
x:Name="ai_conversation_btn"
|
||||
Margin="10,0,0,0"
|
||||
|
||||
@@ -55,6 +55,7 @@ using BeWo.Core.Commands;
|
||||
using BeWo.ViewModel.View.AI;
|
||||
using System.Text;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BeWo.View.Detail.Zeiterfassung
|
||||
{
|
||||
@@ -348,10 +349,8 @@ namespace BeWo.View.Detail.Zeiterfassung
|
||||
srGridControl.FilterChanged += SrGridControl_FilterChanged;
|
||||
srGridControl.ItemsSourceChanged += SrGridControl_ItemsSourceChanged;
|
||||
|
||||
btn_ai_conv.DataContext = pViewModel.AiChatButtonConversationViewModel;
|
||||
btn_ai_conv.ViewModel.GetAiVisualContext = () => getAiVisualContext();
|
||||
|
||||
btn_ai_docu.DataContext = pViewModel.AiChatButtonDocumentationViewModel;
|
||||
pViewModel.AiChatButtonConversationViewModel.GetAiVisualContext = () => getAiVisualContext();
|
||||
pViewModel.AiChatButtonDocumentationViewModel.GetAiVisualContext = () => getAiVisualContext2();
|
||||
}
|
||||
|
||||
private void SrGridControl_ItemsSourceChanged(object sender, DevExpress.Xpf.Grid.ItemsSourceChangedEventArgs e)
|
||||
@@ -5084,7 +5083,7 @@ namespace BeWo.View.Detail.Zeiterfassung
|
||||
ComboBoxTreeViewControl.TreeViewSourceList = ViewModel.PrototypeVM.GoalTree;
|
||||
}
|
||||
|
||||
private AiViewContextDC getAiVisualContext()
|
||||
private AiViewContextDC getAiVisualContext()
|
||||
{
|
||||
var records = GetVisibleRecordVMs();
|
||||
var context = ViewModel.GetVisibleInformationReferences(records);
|
||||
@@ -5099,7 +5098,16 @@ namespace BeWo.View.Detail.Zeiterfassung
|
||||
return dc;
|
||||
}
|
||||
|
||||
private IEnumerable<ServiceRecordVM> GetVisibleRecordVMs()
|
||||
private AiViewContextDC getAiVisualContext2()
|
||||
{
|
||||
var context = getAiVisualContext();
|
||||
|
||||
context.Secondary = ViewModel.PrototypeVM.Notice;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
private IEnumerable<ServiceRecordVM> GetVisibleRecordVMs()
|
||||
{
|
||||
var list = new List<ServiceRecordVM>();
|
||||
|
||||
|
||||
@@ -42,7 +42,12 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
public AiChatButtonState ButtonState
|
||||
{
|
||||
get => buttonState;
|
||||
set => SetProperty(ref buttonState, value, nameof(ButtonState));
|
||||
set {
|
||||
if (!SetProperty(ref buttonState, value, nameof(ButtonState)))
|
||||
return;
|
||||
|
||||
FirePropertyChanged(nameof(IsContextSizeTooBig));
|
||||
}
|
||||
}
|
||||
|
||||
public Func<AiViewContextDC> GetAiVisualContext { get; set; }
|
||||
@@ -53,6 +58,8 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
public DelegateCommand OpenAllPromptsPopupCommand { get; protected set; }
|
||||
public DelegateCommand OpenFavoritePromptsPopupCommand { get; protected set; }
|
||||
|
||||
public bool IsContextSizeTooBig => ButtonState == AiChatButtonState.Warning;
|
||||
|
||||
public AiChatButtonViewModel(AiActionType aiActionType)
|
||||
{
|
||||
ActionType = aiActionType;
|
||||
@@ -92,7 +99,7 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenConversationPopup()
|
||||
private protected void OpenConversationPopup()
|
||||
{
|
||||
var context = GetAiVisualContext();
|
||||
|
||||
@@ -101,12 +108,12 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
BeWoApp.MainControl.WindowService.Show(chat_viewmodel);
|
||||
}
|
||||
|
||||
private void OpenAllPromptsPopup()
|
||||
private protected void OpenAllPromptsPopup()
|
||||
{
|
||||
BeWoApp.MainControl.WindowService.Show(AllPromptsViewModel);
|
||||
}
|
||||
|
||||
private void OpenFavoritePromptsPopup()
|
||||
private protected void OpenFavoritePromptsPopup()
|
||||
{
|
||||
IsFavoritenOpen = true;
|
||||
FirePropertyChanged(nameof(IsFavoritenOpen));
|
||||
|
||||
@@ -51,6 +51,11 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
};
|
||||
UndoAiActionCommand= new DelegateCommand(UndoAiAction);
|
||||
RedoAiActionCommand= new DelegateCommand(RedoAiAction);
|
||||
|
||||
Func<bool> canExecute = () => !string.IsNullOrEmpty(CurrentValue);
|
||||
OpenAllPromptsPopupCommand = new DelegateCommand(OpenAllPromptsPopup, canExecute);
|
||||
OpenConversationPopupCommand = new DelegateCommand(OpenConversationPopup, canExecute);
|
||||
OpenFavoritePromptsPopupCommand = new DelegateCommand(OpenFavoritePromptsPopup, canExecute);
|
||||
}
|
||||
|
||||
public void ClearHistory()
|
||||
|
||||
@@ -217,6 +217,9 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
set
|
||||
{
|
||||
PrototypeVM.Notice = value;
|
||||
AiChatButtonDocumentationViewModel.CurrentValue = value;
|
||||
FirePropertyChanged(nameof(AktuellerDokutext));
|
||||
|
||||
//FirePropertyChanged(nameof(IsAiDocuButtonCanExecute));
|
||||
//FirePropertyChanged(nameof(IsRedoButtonVisible));
|
||||
//FirePropertyChanged(nameof(IsUndoButtonVisible));
|
||||
|
||||
Reference in New Issue
Block a user