Neues Recht (auskommentiert) + Alle Commands durch CommandFactory geleitet
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
d:DesignWidth="500"
|
||||
Focusable="True"
|
||||
mc:Ignorable="d">
|
||||
<Grid Margin="0" Background="{DynamicResource ObjectEditBackgroundBrush}" >
|
||||
<Grid Margin="0" Background="{DynamicResource ObjectEditBackgroundBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
@@ -31,63 +31,72 @@
|
||||
Height="Auto"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Vertical">
|
||||
<Button x:Name="ButtonStart"
|
||||
Click="ButtonStartStop_Click"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
Width="220"
|
||||
Height="50"
|
||||
Margin="0,10,0,0">
|
||||
<Button
|
||||
x:Name="ButtonStart"
|
||||
Grid.Row="1"
|
||||
Width="220"
|
||||
Height="50"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Click="ButtonStartStop_Click">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Source="/BeWoPlaner;component/Ressources/Icons/KI/Icon_KI_Chat_Weiss+Orange.png"
|
||||
Width="32"
|
||||
Height="32"
|
||||
Margin="0,0,10,0"/>
|
||||
<TextBlock Grid.Column="1" x:Name="ButtonText" VerticalAlignment="Center" Text="{t:Translate Aufnahme initiieren}"/>
|
||||
<Viewbox Grid.Column="2" x:Name="VBPlay" Width="40" Height="40" Visibility="Visible">
|
||||
<Image
|
||||
Width="32"
|
||||
Height="32"
|
||||
Margin="0,0,10,0"
|
||||
Source="/BeWoPlaner;component/Ressources/Icons/KI/Icon_KI_Chat_Weiss+Orange.png" />
|
||||
<TextBlock
|
||||
x:Name="ButtonText"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="{t:Translate Aufnahme initiieren}" />
|
||||
<Viewbox
|
||||
x:Name="VBPlay"
|
||||
Grid.Column="2"
|
||||
Width="40"
|
||||
Height="40"
|
||||
Visibility="Visible">
|
||||
<Grid Width="100" Height="100">
|
||||
<Ellipse
|
||||
Width="80"
|
||||
Height="80"
|
||||
Stroke="White"
|
||||
StrokeThickness="6"
|
||||
Fill="Transparent"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
Width="80"
|
||||
Height="80"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Fill="Transparent"
|
||||
Stroke="White"
|
||||
StrokeThickness="6" />
|
||||
|
||||
<Path
|
||||
Fill="White"
|
||||
Data="M 40,30 L 40,70 L 70,50 Z"/>
|
||||
<Path Data="M 40,30 L 40,70 L 70,50 Z" Fill="White" />
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
<Viewbox Grid.Column="2" x:Name="VBStop" Width="40" Height="40" Visibility="Hidden">
|
||||
<Viewbox
|
||||
x:Name="VBStop"
|
||||
Grid.Column="2"
|
||||
Width="40"
|
||||
Height="40"
|
||||
Visibility="Hidden">
|
||||
<Grid Width="100" Height="100">
|
||||
<Ellipse
|
||||
Width="80"
|
||||
Height="80"
|
||||
StrokeThickness="6"
|
||||
Fill="Transparent"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
Width="80"
|
||||
Height="80"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Fill="Transparent"
|
||||
StrokeThickness="6">
|
||||
<Ellipse.Stroke>
|
||||
<LinearGradientBrush
|
||||
x:Name="RingGradient"
|
||||
StartPoint="0,0"
|
||||
EndPoint="1,0">
|
||||
<LinearGradientBrush x:Name="RingGradient" StartPoint="0,0" EndPoint="1,0">
|
||||
|
||||
<LinearGradientBrush.RelativeTransform>
|
||||
<RotateTransform x:Name="GradientRotate"
|
||||
CenterX="0.5"
|
||||
CenterY="0.5"/>
|
||||
<RotateTransform x:Name="GradientRotate" CenterX="0.5" CenterY="0.5" />
|
||||
</LinearGradientBrush.RelativeTransform>
|
||||
|
||||
<GradientStop Color="Red" Offset="0"/>
|
||||
<GradientStop Color="#00FF0000" Offset="1"/>
|
||||
<GradientStop Offset="0" Color="Red" />
|
||||
<GradientStop Offset="1" Color="#00FF0000" />
|
||||
</LinearGradientBrush>
|
||||
</Ellipse.Stroke>
|
||||
|
||||
@@ -96,11 +105,11 @@
|
||||
<BeginStoryboard>
|
||||
<Storyboard RepeatBehavior="Forever">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="GradientRotate"
|
||||
Storyboard.TargetProperty="Angle"
|
||||
From="0"
|
||||
To="360"
|
||||
Duration="0:0:2"/>
|
||||
Storyboard.TargetName="GradientRotate"
|
||||
Storyboard.TargetProperty="Angle"
|
||||
From="0"
|
||||
To="360"
|
||||
Duration="0:0:2" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
@@ -108,73 +117,92 @@
|
||||
</Ellipse>
|
||||
|
||||
<Rectangle
|
||||
Width="33"
|
||||
Height="33"
|
||||
Fill="Red"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
Width="33"
|
||||
Height="33"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Fill="Red" />
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</Button>
|
||||
<Label x:Name="lblStatus" Height="23" HorizontalAlignment="Center"></Label>
|
||||
<StackPanel x:Name="PanelAnimation" Visibility="Hidden" Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<Label
|
||||
x:Name="lblStatus"
|
||||
Height="23"
|
||||
HorizontalAlignment="Center" />
|
||||
<StackPanel
|
||||
x:Name="PanelAnimation"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal"
|
||||
Visibility="Hidden">
|
||||
|
||||
<StackPanel.Resources>
|
||||
<Storyboard x:Key="DotAnimation"
|
||||
RepeatBehavior="Forever">
|
||||
<Storyboard x:Key="DotAnimation" RepeatBehavior="Forever">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:0.6"
|
||||
AutoReverse="True"/>
|
||||
AutoReverse="True"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:0.6" />
|
||||
</Storyboard>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<!-- Punkt 1 -->
|
||||
<Ellipse Width="8" Height="8" Fill="#007ACC" Margin="3">
|
||||
<!-- Punkt 1 -->
|
||||
<Ellipse
|
||||
Width="8"
|
||||
Height="8"
|
||||
Margin="3"
|
||||
Fill="#007ACC">
|
||||
<Ellipse.Triggers>
|
||||
<EventTrigger RoutedEvent="Loaded">
|
||||
<BeginStoryboard Storyboard="{StaticResource DotAnimation}"/>
|
||||
<BeginStoryboard Storyboard="{StaticResource DotAnimation}" />
|
||||
</EventTrigger>
|
||||
</Ellipse.Triggers>
|
||||
</Ellipse>
|
||||
|
||||
<!-- Punkt 2 -->
|
||||
<Ellipse Width="8" Height="8" Fill="#007ACC" Margin="3" Opacity="0.3">
|
||||
<!-- Punkt 2 -->
|
||||
<Ellipse
|
||||
Width="8"
|
||||
Height="8"
|
||||
Margin="3"
|
||||
Fill="#007ACC"
|
||||
Opacity="0.3">
|
||||
<Ellipse.Triggers>
|
||||
<EventTrigger RoutedEvent="Loaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard RepeatBehavior="Forever">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:0.6"
|
||||
BeginTime="0:0:0.2"
|
||||
AutoReverse="True"/>
|
||||
AutoReverse="True"
|
||||
BeginTime="0:0:0.2"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:0.6" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Ellipse.Triggers>
|
||||
</Ellipse>
|
||||
|
||||
<!-- Punkt 3 -->
|
||||
<Ellipse Width="8" Height="8" Fill="#007ACC" Margin="3" Opacity="0.3">
|
||||
<!-- Punkt 3 -->
|
||||
<Ellipse
|
||||
Width="8"
|
||||
Height="8"
|
||||
Margin="3"
|
||||
Fill="#007ACC"
|
||||
Opacity="0.3">
|
||||
<Ellipse.Triggers>
|
||||
<EventTrigger RoutedEvent="Loaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard RepeatBehavior="Forever">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:0.6"
|
||||
BeginTime="0:0:0.4"
|
||||
AutoReverse="True"/>
|
||||
AutoReverse="True"
|
||||
BeginTime="0:0:0.4"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:0.6" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
@@ -183,9 +211,9 @@
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
x:Name="PanelAiButtons"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal"
|
||||
x:Name="PanelAiButtons"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal"
|
||||
Visibility="Collapsed">
|
||||
<StackPanel.Resources>
|
||||
<ResourceDictionary>
|
||||
@@ -196,25 +224,24 @@
|
||||
</StackPanel.Resources>
|
||||
|
||||
<Button
|
||||
x:Name="btn_AiPromptbaustein"
|
||||
Padding="0"
|
||||
Command="{Binding OpenAiPromptSelectionCommand}"
|
||||
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
|
||||
Style="{StaticResource PrimaryButton}" />
|
||||
x:Name="btn_AiPromptbaustein"
|
||||
Padding="0"
|
||||
Command="{Binding OpenAiPromptSelectionCommand}"
|
||||
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
|
||||
Style="{StaticResource PrimaryButton}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<TextBox
|
||||
Style="{x:Null}"
|
||||
x:Name="TextBoxErgebnis"
|
||||
Grid.Row="1"
|
||||
AcceptsReturn="True"
|
||||
AcceptsTab="True"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
TextWrapping="Wrap"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
x:Name="TextBoxErgebnis"
|
||||
Grid.Row="1"
|
||||
Margin="3"
|
||||
/>
|
||||
AcceptsReturn="True"
|
||||
AcceptsTab="True"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
Style="{x:Null}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace BeWo.Core.Commands
|
||||
{
|
||||
public static class CommandFactory
|
||||
{
|
||||
public static DelegateCommand GetAiViewCommand(Action openView, UserRightType userRightType, Func<bool> additionalCheckup = null, bool? useCommandManager = null)
|
||||
public static DelegateCommand GetAiViewCommand(Action openView, UserRightType? userRightType, Func<bool> additionalCheckup = null, bool? useCommandManager = null)
|
||||
{
|
||||
bool canExecute() =>
|
||||
(BeWoApp.AppSettings?.ModuleAiEnabled ?? BeWoApp.AppSettings?.ShowAI ?? false) &&
|
||||
BeWoApp.HasLoggedOnUserRight(userRightType) &&
|
||||
(userRightType is null || BeWoApp.HasLoggedOnUserRight(userRightType.Value)) &&
|
||||
(additionalCheckup is null || additionalCheckup());
|
||||
|
||||
return new DelegateCommand(openView, () => CheckupSafe(canExecute), useCommandManager);
|
||||
|
||||
@@ -1509,8 +1509,8 @@
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal"
|
||||
DataContext="">
|
||||
DataContext=""
|
||||
Orientation="Horizontal">
|
||||
<StackPanel.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
using BeWo.Core;
|
||||
using BeWo.Core.Commands;
|
||||
using BeWo.Core.Service;
|
||||
using BeWo.ServiceProxy;
|
||||
using BeWo.View.Controls.AI;
|
||||
@@ -188,35 +189,38 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
|
||||
vm_doku.PromptAccepted += PromptAccepted;
|
||||
|
||||
OpenAiPromptSelectionCommand = new DelegateCommand(() =>
|
||||
{
|
||||
BeWoApp.MainControl.WindowService.Show(vm_doku);
|
||||
}, () => !string.IsNullOrWhiteSpace(AktuellerDokutext));
|
||||
OpenAiPromptSelectionCommand = CommandFactory.GetAiViewCommand(
|
||||
() => BeWoApp.MainControl.WindowService.Show(vm_doku),
|
||||
null,
|
||||
() => !string.IsNullOrWhiteSpace(AktuellerDokutext));
|
||||
|
||||
UndoAiActionCommand = new DelegateCommand(UndoAiAction);
|
||||
RedoAiActionCommand = new DelegateCommand(RedoAiAction);
|
||||
UndoAiActionCommand = new DelegateCommand(UndoAiAction, () => IsAiButtonVisible);
|
||||
RedoAiActionCommand = new DelegateCommand(RedoAiAction, () => IsAiButtonVisible);
|
||||
|
||||
var vm_edit_doku = new AiPromptbausteinSelectionComplexViewModel(AiActionType.ServiceRecordDocumentation);
|
||||
|
||||
vm_edit_doku.PromptAccepted += EditPromptAccepted;
|
||||
|
||||
OpenEditAiPromptSelectionCommand = new DelegateCommand(() =>
|
||||
OpenEditAiPromptSelectionCommand = CommandFactory.GetAiViewCommand(() =>
|
||||
{
|
||||
_EditAiActionHistory = new List<string>();
|
||||
_EditAiActionHistory.Add(AktuellerEditDokutext);
|
||||
_EditAiActionHistoryIndex = 0;
|
||||
BeWoApp.MainControl.WindowService.Show(vm_edit_doku);
|
||||
}, () => !string.IsNullOrWhiteSpace(AktuellerEditDokutext));
|
||||
},
|
||||
null,
|
||||
() => !string.IsNullOrWhiteSpace(AktuellerEditDokutext));
|
||||
|
||||
UndoEditAiActionCommand = new DelegateCommand(UndoEditAiAction);
|
||||
RedoEditAiActionCommand = new DelegateCommand(RedoEditAiAction);
|
||||
UndoEditAiActionCommand = new DelegateCommand(UndoEditAiAction, () => IsAiButtonVisible);
|
||||
RedoEditAiActionCommand = new DelegateCommand(RedoEditAiAction, () => IsAiButtonVisible);
|
||||
|
||||
_AiActionHistory = new List<string>();
|
||||
_AiActionHistory.Add(AktuellerDokutext);
|
||||
_AiActionHistoryIndex = 0;
|
||||
}
|
||||
|
||||
public AiConversationButtonState AiConversationButtonState {
|
||||
public AiConversationButtonState AiConversationButtonState
|
||||
{
|
||||
get => _AiConversationButtonState;
|
||||
set => SetProperty(ref _AiConversationButtonState, value, nameof(AiConversationButtonState));
|
||||
}
|
||||
@@ -243,7 +247,8 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAiButtonVisible => SelectedCustomerNode is object && (BeWoApp.AppSettings.ShowAI || BeWoApp.AppSettings.ShowAIVoice);
|
||||
public bool IsAiModuleEnabled => (BeWoApp.AppSettings.ShowAI || BeWoApp.AppSettings.ShowAIVoice);
|
||||
public bool IsAiButtonVisible => SelectedCustomerNode is object && IsAiModuleEnabled;
|
||||
public bool IsUndoButtonVisible => _AiActionHistoryIndex > 0;
|
||||
public bool IsRedoButtonVisible => _AiActionHistoryIndex < _AiActionHistory.Count - 1;
|
||||
|
||||
@@ -466,30 +471,27 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
|
||||
public void UpdateViewYearFilter(IEnumerable<ServiceRecordVM> enumerable)
|
||||
{
|
||||
|
||||
if (BeWoApp.AppSettings.ShowAI)
|
||||
if (!IsAiModuleEnabled)
|
||||
{
|
||||
AiConversationButtonState = AiConversationButtonState.Loading;
|
||||
var context = GetVisibleInformationReferences(enumerable);
|
||||
if (context != null)
|
||||
{
|
||||
var context2 = context.ToDictionary(kv => kv.Key, kv => kv.Value.ToList());
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CheckContextSize(AiContextType.ServiceRecord, context2, null),
|
||||
isValid =>
|
||||
{
|
||||
if (isValid)
|
||||
AiConversationButtonState = AiConversationButtonState.Normal;
|
||||
else
|
||||
AiConversationButtonState = AiConversationButtonState.Warning;
|
||||
},
|
||||
(exp) => AiConversationButtonState = AiConversationButtonState.Disabled);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
AiConversationButtonState = AiConversationButtonState.Hidden;
|
||||
return;
|
||||
}
|
||||
|
||||
AiConversationButtonState = AiConversationButtonState.Loading;
|
||||
var context = GetVisibleInformationReferences(enumerable);
|
||||
if (context != null)
|
||||
{
|
||||
var context2 = context.ToDictionary(kv => kv.Key, kv => kv.Value.ToList());
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CheckContextSize(AiContextType.ServiceRecord, context2, null),
|
||||
isValid =>
|
||||
{
|
||||
if (isValid)
|
||||
AiConversationButtonState = AiConversationButtonState.Normal;
|
||||
else
|
||||
AiConversationButtonState = AiConversationButtonState.Warning;
|
||||
},
|
||||
(exp) => AiConversationButtonState = AiConversationButtonState.Disabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -239,6 +239,7 @@ namespace BeWo.Data.Security
|
||||
|| r == UserRightType.AiModulePromptbausteineRemove
|
||||
|| r == UserRightType.AiModulePromptbausteineSeeAll
|
||||
|| r == UserRightType.AiModulePromptbausteineView
|
||||
//|| r == UserRightType.AiModulePromptbausteineExecute
|
||||
|| r == UserRightType.AiVoiceView;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,6 +652,7 @@ namespace BS.Shared
|
||||
AiModulePromptbausteineEdit = 201009,
|
||||
AiModulePromptbausteineRemove = 201010,
|
||||
AiModulePromptbausteineSeeAll = 201011,
|
||||
//AiModulePromptbausteineExecute = 201012,
|
||||
AiVoiceView= 201020,
|
||||
}
|
||||
|
||||
|
||||
@@ -687,7 +687,7 @@ namespace BS.Shared.Core
|
||||
{
|
||||
var dict = new Dictionary<UserRightType, String>();
|
||||
|
||||
var action_keywords = new string[] { "ansehen", "verwalten", "anlegen", "bearbeiten", "löschen", "senden", "klonen", "alle ansehen" };
|
||||
var action_keywords = new string[] { "ansehen", "verwalten", "anlegen", "bearbeiten", "löschen", "senden", "klonen", "alle ansehen", "ausführen" };
|
||||
|
||||
dict.Add(UserRightType.CreateAll, Translator.Translate("Alles anlegen"));
|
||||
|
||||
@@ -779,6 +779,7 @@ namespace BS.Shared.Core
|
||||
dict.Add(UserRightType.AiModulePromptbausteineEdit, Translator.Translate($"KI-Promptbaustein {action_keywords[3]}"));
|
||||
dict.Add(UserRightType.AiModulePromptbausteineRemove, Translator.Translate($"KI-Promptbaustein {action_keywords[4]}"));
|
||||
dict.Add(UserRightType.AiModulePromptbausteineSeeAll, Translator.Translate($"KI-Promptbausteine {action_keywords[7]}"));
|
||||
//dict.Add(UserRightType.AiModulePromptbausteineExecute, Translator.Translate($"KI-Promptbausteine {action_keywords[8]}"));
|
||||
|
||||
dict.Add(UserRightType.PersonView_Create, Translator.Translate("Personen anlegen"));
|
||||
dict.Add(UserRightType.PersonView_Delete, Translator.Translate("Personen löschen"));
|
||||
|
||||
Reference in New Issue
Block a user