AiDocu Button Popup Update
This commit is contained in:
@@ -106,6 +106,7 @@
|
|||||||
<Compile Include="Converter\ComparisonConverter.cs" />
|
<Compile Include="Converter\ComparisonConverter.cs" />
|
||||||
<Compile Include="Converter\IconToImageSourceConverter.cs" />
|
<Compile Include="Converter\IconToImageSourceConverter.cs" />
|
||||||
<Compile Include="Converter\NewlineConverter.cs" />
|
<Compile Include="Converter\NewlineConverter.cs" />
|
||||||
|
<Compile Include="Converter\StringEmptyBoolConverter.cs" />
|
||||||
<Compile Include="Core\BeWoAppVersion.cs" />
|
<Compile Include="Core\BeWoAppVersion.cs" />
|
||||||
<Compile Include="Core\Commands\CommandFactory.cs" />
|
<Compile Include="Core\Commands\CommandFactory.cs" />
|
||||||
<Compile Include="Scheduling\View\AbsenceTimesCreationView.xaml.cs">
|
<Compile Include="Scheduling\View\AbsenceTimesCreationView.xaml.cs">
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
<conv:AddressToStringConverter x:Key="AddressToStringConverter" />
|
<conv:AddressToStringConverter x:Key="AddressToStringConverter" />
|
||||||
<conv:ComparisonConverter x:Key="ComparisonConverter" />
|
<conv:ComparisonConverter x:Key="ComparisonConverter" />
|
||||||
<conv:IconToImageSourceConverter x:Key="IconToImageSourceConverter" />
|
<conv:IconToImageSourceConverter x:Key="IconToImageSourceConverter" />
|
||||||
|
<conv:StringEmptyBoolConverter x:Key="StringEmptyBoolConverter" />
|
||||||
|
|
||||||
<conv:ValidationConverter x:Key="ValidationConverter" />
|
<conv:ValidationConverter x:Key="ValidationConverter" />
|
||||||
<conv:ValueConverterGroup x:Key="Validation2BrushConverter">
|
<conv:ValueConverterGroup x:Key="Validation2BrushConverter">
|
||||||
|
|||||||
28
BeWo/Converter/StringEmptyBoolConverter.cs
Normal file
28
BeWo/Converter/StringEmptyBoolConverter.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace BeWo.Converter
|
||||||
|
{
|
||||||
|
public class StringEmptyBoolConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is string stringi)
|
||||||
|
{
|
||||||
|
return !string.IsNullOrEmpty(stringi);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,10 +22,10 @@
|
|||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</StackPanel.Resources>
|
</StackPanel.Resources>
|
||||||
<Button
|
<Button
|
||||||
Background="Transparent"
|
|
||||||
x:Name="btnOpenAi5"
|
x:Name="btnOpenAi5"
|
||||||
Margin="3"
|
Margin="3"
|
||||||
Click="btnOpenAi5_Click"
|
Click="btnOpenAi5_Click"
|
||||||
|
Style="{StaticResource PrimaryButton}"
|
||||||
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
|
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
|
||||||
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp"
|
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp"
|
||||||
ToolTip="KI Chat mit Prompt-Baustein starten"
|
ToolTip="KI Chat mit Prompt-Baustein starten"
|
||||||
|
|||||||
@@ -36,14 +36,15 @@ namespace BeWo.View.Controls.AI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class AiPromptbausteinButton : UserControl
|
public partial class AiPromptbausteinButton : UserControl
|
||||||
{
|
{
|
||||||
|
public static readonly DependencyProperty CanExecuteProperty =
|
||||||
|
DependencyProperty.Register("CanExecute", typeof(bool), typeof(AiPromptbausteinButton), new PropertyMetadata(true, OnCanExecuteChanged));
|
||||||
|
|
||||||
public static readonly DependencyProperty StateProperty =
|
public static readonly DependencyProperty StateProperty =
|
||||||
DependencyProperty.Register("State", typeof(AiPromptbausteinButtonState), typeof(AiPromptbausteinButton), new PropertyMetadata(AiPromptbausteinButtonState.Normal, OnStateChanged));
|
DependencyProperty.Register("State", typeof(AiPromptbausteinButtonState), typeof(AiPromptbausteinButton), new PropertyMetadata(AiPromptbausteinButtonState.Normal, OnStateChanged));
|
||||||
|
|
||||||
public static readonly DependencyProperty ActionTypeProperty =
|
public static readonly DependencyProperty ActionTypeProperty =
|
||||||
DependencyProperty.Register("ActionType", typeof(AiActionType), typeof(AiPromptbausteinButton), new PropertyMetadata(AiActionType.ServiceRecord, OnActionTypeChanged));
|
DependencyProperty.Register("ActionType", typeof(AiActionType), typeof(AiPromptbausteinButton), new PropertyMetadata(AiActionType.ServiceRecord, OnActionTypeChanged));
|
||||||
|
|
||||||
public event EventHandler<AiPromptbausteinPromptVM> PromptAccepted;
|
|
||||||
|
|
||||||
public AiPromptbausteinButtonState State
|
public AiPromptbausteinButtonState State
|
||||||
{
|
{
|
||||||
get { return (AiPromptbausteinButtonState)GetValue(StateProperty); }
|
get { return (AiPromptbausteinButtonState)GetValue(StateProperty); }
|
||||||
@@ -55,13 +56,17 @@ namespace BeWo.View.Controls.AI
|
|||||||
set { SetValue(ActionTypeProperty, value); }
|
set { SetValue(ActionTypeProperty, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public AiActionType LoadedActionType { get; set; }
|
public bool CanExecute
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(CanExecuteProperty); }
|
||||||
|
set { SetValue(CanExecuteProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<AiPromptbausteinPromptVM> PromptAccepted;
|
||||||
|
|
||||||
public AiPromptbausteinButton()
|
public AiPromptbausteinButton()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
@@ -76,6 +81,12 @@ namespace BeWo.View.Controls.AI
|
|||||||
var actionType = (AiActionType)e.NewValue;
|
var actionType = (AiActionType)e.NewValue;
|
||||||
control.UpdateActionType(actionType);
|
control.UpdateActionType(actionType);
|
||||||
}
|
}
|
||||||
|
private static void OnCanExecuteChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var control = (AiPromptbausteinButton)d;
|
||||||
|
var canExecute = (bool)e.NewValue;
|
||||||
|
control.UpdateCanExecute(canExecute);
|
||||||
|
}
|
||||||
|
|
||||||
public void AiPromptOpenAll()
|
public void AiPromptOpenAll()
|
||||||
{
|
{
|
||||||
@@ -126,22 +137,27 @@ namespace BeWo.View.Controls.AI
|
|||||||
case AiPromptbausteinButtonState.Hidden:
|
case AiPromptbausteinButtonState.Hidden:
|
||||||
root.Visibility = Visibility.Collapsed;
|
root.Visibility = Visibility.Collapsed;
|
||||||
root.IsEnabled = true;
|
root.IsEnabled = true;
|
||||||
|
btnOpenAi5.IsEnabled = true;
|
||||||
break;
|
break;
|
||||||
case AiPromptbausteinButtonState.Normal:
|
case AiPromptbausteinButtonState.Normal:
|
||||||
root.Visibility = Visibility.Visible;
|
root.Visibility = Visibility.Visible;
|
||||||
root.IsEnabled = true;
|
root.IsEnabled = true;
|
||||||
|
btnOpenAi5.IsEnabled = true;
|
||||||
break;
|
break;
|
||||||
case AiPromptbausteinButtonState.Loading:
|
case AiPromptbausteinButtonState.Loading:
|
||||||
root.Visibility = Visibility.Visible;
|
root.Visibility = Visibility.Visible;
|
||||||
root.IsEnabled = false;
|
root.IsEnabled = false;
|
||||||
|
btnOpenAi5.IsEnabled = false;
|
||||||
break;
|
break;
|
||||||
case AiPromptbausteinButtonState.Disabled:
|
case AiPromptbausteinButtonState.Disabled:
|
||||||
throw new NotImplementedException();
|
root.Visibility = Visibility.Visible;
|
||||||
|
root.IsEnabled = true;
|
||||||
|
btnOpenAi5.IsEnabled = false;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void UpdateActionType(AiActionType actionType)
|
private void UpdateActionType(AiActionType actionType)
|
||||||
{
|
{
|
||||||
@@ -156,5 +172,12 @@ namespace BeWo.View.Controls.AI
|
|||||||
State = AiPromptbausteinButtonState.Loading;
|
State = AiPromptbausteinButtonState.Loading;
|
||||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteinFolder(actionType), folders => InitPromptbausteine(actionType, folders));
|
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteinFolder(actionType), folders => InitPromptbausteine(actionType, folders));
|
||||||
}
|
}
|
||||||
|
private void UpdateCanExecute(bool canExecute)
|
||||||
|
{
|
||||||
|
if (canExecute)
|
||||||
|
State = AiPromptbausteinButtonState.Normal;
|
||||||
|
else
|
||||||
|
State = AiPromptbausteinButtonState.Disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1718,16 +1718,11 @@
|
|||||||
Style="{StaticResource ButtonRedoStyle}"
|
Style="{StaticResource ButtonRedoStyle}"
|
||||||
Visibility="{Binding IsRedoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
|
Visibility="{Binding IsRedoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
|
||||||
|
|
||||||
<Button
|
|
||||||
x:Name="btn_AiPromptbaustein"
|
|
||||||
Padding="0"
|
|
||||||
Command="{Binding OpenAiPromptSelectionCommand}"
|
|
||||||
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
|
|
||||||
Style="{StaticResource PrimaryButton}" />
|
|
||||||
<ai:AiPromptbausteinButton
|
<ai:AiPromptbausteinButton
|
||||||
x:Name="btn_AiPromptbaustein2"
|
x:Name="btn_AiPromptbaustein2"
|
||||||
ActionType="ServiceRecordDocumentation"
|
ActionType="ServiceRecordDocumentation"
|
||||||
PromptAccepted="btn_AiPromptbaustein2_PromptAccepted"/>
|
CanExecute="{Binding PrototypeVM.Notice, Converter={StaticResource StringEmptyBoolConverter}}"
|
||||||
|
PromptAccepted="btn_AiPromptbaustein2_PromptAccepted" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
@@ -3332,8 +3327,8 @@
|
|||||||
Margin="10,0,0,0"
|
Margin="10,0,0,0"
|
||||||
ActionType="ServiceRecordConversation"
|
ActionType="ServiceRecordConversation"
|
||||||
OpenAiWindowClick="AiConversationButton_OpenAiWindowClick"
|
OpenAiWindowClick="AiConversationButton_OpenAiWindowClick"
|
||||||
State="{Binding AiConversationButtonState}"
|
PromptAccepted="PromptAccepted"
|
||||||
PromptAccepted="PromptAccepted"/>
|
State="{Binding AiConversationButtonState}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
|
|||||||
@@ -103,14 +103,12 @@ namespace BeWo.ViewModel.ListViewModel
|
|||||||
private int _AiActionHistoryIndex;
|
private int _AiActionHistoryIndex;
|
||||||
private AiConversationButtonState _AiConversationButtonState;
|
private AiConversationButtonState _AiConversationButtonState;
|
||||||
|
|
||||||
public ICommand OpenAiPromptSelectionCommand { get; set; }
|
|
||||||
public ICommand UndoAiActionCommand { get; set; }
|
public ICommand UndoAiActionCommand { get; set; }
|
||||||
public ICommand RedoAiActionCommand { get; set; }
|
public ICommand RedoAiActionCommand { get; set; }
|
||||||
|
|
||||||
private List<string> _EditAiActionHistory;
|
private List<string> _EditAiActionHistory;
|
||||||
private int _EditAiActionHistoryIndex;
|
private int _EditAiActionHistoryIndex;
|
||||||
|
|
||||||
public ICommand OpenEditAiPromptSelectionCommand { get; set; }
|
|
||||||
public ICommand UndoEditAiActionCommand { get; set; }
|
public ICommand UndoEditAiActionCommand { get; set; }
|
||||||
public ICommand RedoEditAiActionCommand { get; set; }
|
public ICommand RedoEditAiActionCommand { get; set; }
|
||||||
|
|
||||||
@@ -232,6 +230,7 @@ namespace BeWo.ViewModel.ListViewModel
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
PrototypeVM.Notice = value;
|
PrototypeVM.Notice = value;
|
||||||
|
FirePropertyChanged(nameof(IsAiDocuButtonCanExecute));
|
||||||
FirePropertyChanged(nameof(IsRedoButtonVisible));
|
FirePropertyChanged(nameof(IsRedoButtonVisible));
|
||||||
FirePropertyChanged(nameof(IsUndoButtonVisible));
|
FirePropertyChanged(nameof(IsUndoButtonVisible));
|
||||||
}
|
}
|
||||||
@@ -250,6 +249,7 @@ namespace BeWo.ViewModel.ListViewModel
|
|||||||
public bool IsAiModuleEnabled => (BeWoApp.AppSettings.ShowAI || BeWoApp.AppSettings.ShowAIVoice);
|
public bool IsAiModuleEnabled => (BeWoApp.AppSettings.ShowAI || BeWoApp.AppSettings.ShowAIVoice);
|
||||||
public bool IsAiChatButtonVisible => SelectedCustomerNode is object && IsAiModuleEnabled && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordChat);
|
public bool IsAiChatButtonVisible => SelectedCustomerNode is object && IsAiModuleEnabled && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordChat);
|
||||||
public bool IsAiDocuButtonVisible => SelectedCustomerNode is object && IsAiModuleEnabled && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordDocu);
|
public bool IsAiDocuButtonVisible => SelectedCustomerNode is object && IsAiModuleEnabled && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordDocu);
|
||||||
|
public bool IsAiDocuButtonCanExecute => !string.IsNullOrWhiteSpace(AktuellerDokutext);
|
||||||
public bool IsUndoButtonVisible => _AiActionHistoryIndex > 0;
|
public bool IsUndoButtonVisible => _AiActionHistoryIndex > 0;
|
||||||
public bool IsRedoButtonVisible => _AiActionHistoryIndex < _AiActionHistory.Count - 1;
|
public bool IsRedoButtonVisible => _AiActionHistoryIndex < _AiActionHistory.Count - 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user