Nutzerfreundlichere Interaktion
This commit is contained in:
@@ -198,7 +198,7 @@ namespace BeWo.Services
|
||||
|
||||
if (windowViewModel is DialogViewModel dialogViewModel)
|
||||
{
|
||||
dialogViewModel.RequestClose += (s, e) => window.Close();
|
||||
dialogViewModel.RequestCloseFinal += (s, e) => window.Close();
|
||||
}
|
||||
|
||||
if (options.ShowAsDialog)
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BeWo.View.Controls.AI
|
||||
{
|
||||
var viewmodel = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm);
|
||||
viewmodel.ItemAccepted += ItemAccepted;
|
||||
viewmodel.RequestClose += (s, e) => viewmodel.ResetSelection();
|
||||
viewmodel.RequestCloseFinal += (s, e) => viewmodel.ResetSelection();
|
||||
ViewModel.AllPromptsViewModel = viewmodel;
|
||||
|
||||
var viewmodel2 = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm, true);
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace BeWo.View.Controls.AI
|
||||
{
|
||||
var viewmodel = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm);
|
||||
viewmodel.ItemAccepted += ItemAccepted;
|
||||
viewmodel.RequestClose += (s, e) => viewmodel.ResetSelection();
|
||||
viewmodel.RequestCloseFinal += (s, e) => viewmodel.ResetSelection();
|
||||
AllPromptsViewModel = viewmodel;
|
||||
|
||||
var viewmodel2 = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm, true);
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace BeWo.View.Controls.AI
|
||||
{
|
||||
var viewmodel = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm);
|
||||
viewmodel.ItemAccepted += ItemAccepted;
|
||||
viewmodel.RequestClose += (s, e) => viewmodel.ResetSelection();
|
||||
viewmodel.RequestCloseFinal += (s, e) => viewmodel.ResetSelection();
|
||||
AllPromptsViewModel = viewmodel;
|
||||
|
||||
var viewmodel2 = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm, true);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<UserControl
|
||||
<view:BeWoView
|
||||
x:Class="BeWo.View.Detail.AI.AiPromptbausteinFolderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -8,6 +8,7 @@
|
||||
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
|
||||
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:view="clr-namespace:BeWo.View"
|
||||
xmlns:viewmodel="clr-namespace:BeWo.ViewModel.View.Administration"
|
||||
Width="auto"
|
||||
Height="auto"
|
||||
@@ -23,7 +24,7 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label"/>
|
||||
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid
|
||||
@@ -89,17 +90,17 @@
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Width="100"
|
||||
Command="{Binding CancelCommand}"
|
||||
Command="ApplicationCommands.Close"
|
||||
Visibility="Visible">
|
||||
Abbrechen
|
||||
</Button>
|
||||
<Button
|
||||
Width="100"
|
||||
Command="{Binding AcceptCommand}"
|
||||
Command="{Binding SaveCommand}"
|
||||
Content="{Binding AcceptButtonText}"
|
||||
Visibility="Visible" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</view:BeWoView>
|
||||
|
||||
|
||||
@@ -20,13 +20,29 @@ namespace BeWo.View.Detail.AI
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AiPromptbausteinFolderView.xaml
|
||||
/// </summary>
|
||||
public partial class AiPromptbausteinFolderView : UserControl
|
||||
public partial class AiPromptbausteinFolderView : BeWoView
|
||||
{
|
||||
public AiPromptbausteinFolderViewModel ViewModel
|
||||
{
|
||||
get => DataContext as AiPromptbausteinFolderViewModel;
|
||||
set => DataContext = value;
|
||||
}
|
||||
|
||||
public AiPromptbausteinFolderView(AiPromptbausteinFolderViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = vm;
|
||||
ViewModel = vm;
|
||||
}
|
||||
|
||||
public override bool IsDirty
|
||||
{
|
||||
get => ViewModel?.ViewModel?.IsDirty ?? false;
|
||||
}
|
||||
|
||||
protected override void Save()
|
||||
{
|
||||
ViewModel.SaveCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<UserControl
|
||||
<view:BeWoView
|
||||
x:Class="BeWo.View.Detail.AI.AiPromptbausteinPromptView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -8,13 +8,14 @@
|
||||
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
|
||||
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:view="clr-namespace:BeWo.View"
|
||||
xmlns:viewmodel="clr-namespace:BeWo.ViewModel.View.Administration"
|
||||
Width="auto"
|
||||
Height="auto"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:AiPromptbausteinPromptViewModel}"
|
||||
Background="{StaticResource ObjectEditBackgroundBrush}"
|
||||
mc:Ignorable="d"
|
||||
Focusable="True">
|
||||
Focusable="True"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.InputBindings>
|
||||
<KeyBinding Key="Esc" Command="{Binding CancelCommand}" />
|
||||
</UserControl.InputBindings>
|
||||
@@ -23,7 +24,7 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label"/>
|
||||
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid
|
||||
@@ -78,13 +79,17 @@
|
||||
IsEnabled="{Binding ViewModel.CanEdit}"
|
||||
Style="{StaticResource TextBoxNoticeLarge}"
|
||||
Text="{Binding ViewModel.Prompt, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" Visibility="{Binding ViewModel.IsPromptVisible, Converter={StaticResource BoolVisibilityConverter}}" />
|
||||
<Label Grid.Row="2"
|
||||
Grid.Column="2" Foreground="DarkGray" FontSize="10"
|
||||
Visibility="{Binding ViewModel.IsPromptVisible, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=Reverse}">
|
||||
TextWrapping="Wrap"
|
||||
Visibility="{Binding ViewModel.IsPromptVisible, Converter={StaticResource BoolVisibilityConverter}}" />
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
FontSize="10"
|
||||
Foreground="DarkGray"
|
||||
Visibility="{Binding ViewModel.IsPromptVisible, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=Reverse}">
|
||||
nicht sichtbar
|
||||
</Label>
|
||||
|
||||
|
||||
<Label
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
@@ -127,11 +132,11 @@ Grid.Column="2" Foreground="DarkGray" FontSize="10"
|
||||
</Button>
|
||||
<Button
|
||||
Width="100"
|
||||
Command="{Binding AcceptCommand}"
|
||||
Command="{Binding SaveCommand}"
|
||||
Content="{Binding AcceptButtonText}"
|
||||
Visibility="Visible" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</view:BeWoView>
|
||||
|
||||
|
||||
@@ -20,13 +20,29 @@ namespace BeWo.View.Detail.AI
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AiPromptbausteinPromptView.xaml
|
||||
/// </summary>
|
||||
public partial class AiPromptbausteinPromptView : UserControl
|
||||
{
|
||||
public partial class AiPromptbausteinPromptView : BeWoView
|
||||
{
|
||||
public AiPromptbausteinPromptViewModel ViewModel
|
||||
{
|
||||
get => DataContext as AiPromptbausteinPromptViewModel;
|
||||
set => DataContext = value;
|
||||
}
|
||||
|
||||
public AiPromptbausteinPromptView(AiPromptbausteinPromptViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = vm;
|
||||
ViewModel = vm;
|
||||
}
|
||||
|
||||
public override bool IsDirty
|
||||
{
|
||||
get => ViewModel?.ViewModel?.IsDirty ?? false;
|
||||
}
|
||||
|
||||
protected override void Save()
|
||||
{
|
||||
ViewModel.SaveCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<UserControl
|
||||
<view:BeWoView
|
||||
xmlns:view="clr-namespace:BeWo.View"
|
||||
x:Class="BeWo.View.Detail.AI.AiPromptbausteinPromptView2"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -122,5 +123,5 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</view:BeWoView>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace BeWo.View.Detail.AI
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AiPromptbausteinPromptView.xaml
|
||||
/// </summary>
|
||||
public partial class AiPromptbausteinPromptView2 : UserControl
|
||||
public partial class AiPromptbausteinPromptView2 : BeWoView
|
||||
{
|
||||
public static readonly DependencyProperty SaveCommandProperty =
|
||||
DependencyProperty.Register("SaveCommand", typeof(ICommand), typeof(AiPromptbausteinPromptView2), new PropertyMetadata(null));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<UserControl
|
||||
<view:BeWoView
|
||||
x:Class="BeWo.View.Detail.AI.AiPromptbausteinRoutineView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -8,6 +8,7 @@
|
||||
xmlns:local="clr-namespace:BeWo.View.Detail.AI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:shared="clr-namespace:BS.Shared;assembly=BS.Shared"
|
||||
xmlns:view="clr-namespace:BeWo.View"
|
||||
xmlns:viewmodel="clr-namespace:BeWo.ViewModel.View.Administration"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:AiPromptbausteinRoutineViewModel}"
|
||||
d:DesignHeight="450"
|
||||
@@ -23,8 +24,8 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label"/>
|
||||
<Style BasedOn="{StaticResource PopupBlackRadioButton}" TargetType="RadioButton"/>
|
||||
<Style BasedOn="{StaticResource PopupBlackLabel2}" TargetType="Label" />
|
||||
<Style BasedOn="{StaticResource PopupBlackRadioButton}" TargetType="RadioButton" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid HorizontalAlignment="Stretch">
|
||||
@@ -54,14 +55,14 @@
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Content="Beschreibung"
|
||||
HorizontalAlignment="Right"/>
|
||||
HorizontalAlignment="Right"
|
||||
Content="Beschreibung" />
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
MaxHeight="100"
|
||||
MaxLength="1024"
|
||||
Margin="3,6,3,3"
|
||||
MaxLength="1024"
|
||||
Style="{StaticResource TextBoxNotice}"
|
||||
Text="{Binding ViewModel.Description, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" />
|
||||
@@ -72,7 +73,8 @@
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal" Margin="3,3">
|
||||
Margin="3,3"
|
||||
Orientation="Horizontal">
|
||||
<RadioButton IsChecked="{Binding ViewModel.RoutineType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static shared:AiRoutineType.Chain}}">Kette</RadioButton>
|
||||
<RadioButton IsChecked="{Binding ViewModel.RoutineType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static shared:AiRoutineType.Stack}}">Stapel</RadioButton>
|
||||
</StackPanel>
|
||||
@@ -82,57 +84,57 @@
|
||||
Grid.Column="0"
|
||||
Content="Promptbausteine" />
|
||||
<ListBox
|
||||
x:Name="steps"
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
Margin="3"
|
||||
HorizontalContentAlignment="Center"
|
||||
ItemsSource="{Binding ViewModel.Steps.VMList}"
|
||||
SelectedItem="{Binding SelectedStep}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Margin="3" Orientation="Horizontal">
|
||||
<!--<TextBlock
|
||||
x:Name="steps"
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
Margin="3"
|
||||
HorizontalContentAlignment="Center"
|
||||
ItemsSource="{Binding ViewModel.Steps.VMList}"
|
||||
SelectedItem="{Binding SelectedStep}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Margin="3" 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 IsValid}" Value="false">
|
||||
<Setter TargetName="border1" Property="Background" Value="LightCoral" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
<!--<DataTemplate.Triggers>
|
||||
<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 IsValid}" Value="false">
|
||||
<Setter TargetName="border1" Property="Background" Value="LightCoral" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
<!--<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
|
||||
<Setter TargetName="arrow" Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>-->
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel
|
||||
Grid.Row="4"
|
||||
Grid.Column="2"
|
||||
Grid.Row="4"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,0,3"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<StackPanel.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style BasedOn="{StaticResource PrimaryButton}" TargetType="Button">
|
||||
@@ -145,33 +147,33 @@ Grid.Column="2"
|
||||
-
|
||||
</Button>
|
||||
<Button
|
||||
Margin="9,3,3,3"
|
||||
Command="{Binding MoveStepUpCommand}"
|
||||
CommandParameter="{Binding SelectedStep}">
|
||||
Margin="9,3,3,3"
|
||||
Command="{Binding MoveStepUpCommand}"
|
||||
CommandParameter="{Binding SelectedStep}">
|
||||
<Path
|
||||
Width="8"
|
||||
Data="{StaticResource Lucide.ChevronUp}"
|
||||
Fill="White"
|
||||
Stretch="Uniform" />
|
||||
Width="8"
|
||||
Data="{StaticResource Lucide.ChevronUp}"
|
||||
Fill="White"
|
||||
Stretch="Uniform" />
|
||||
</Button>
|
||||
<Button Command="{Binding MoveStepDownCommand}" CommandParameter="{Binding SelectedStep}">
|
||||
<Path
|
||||
Width="8"
|
||||
Data="{StaticResource Lucide.ChevronDown}"
|
||||
Fill="White"
|
||||
Stretch="Uniform" />
|
||||
Width="8"
|
||||
Data="{StaticResource Lucide.ChevronDown}"
|
||||
Fill="White"
|
||||
Stretch="Uniform" />
|
||||
</Button>
|
||||
<Popup
|
||||
x:Name="myPopup"
|
||||
Width="600"
|
||||
Height="400"
|
||||
Placement="Top"
|
||||
PlacementTarget="{Binding ElementName=myButton}"
|
||||
StaysOpen="False">
|
||||
x:Name="myPopup"
|
||||
Width="600"
|
||||
Height="400"
|
||||
Placement="Top"
|
||||
PlacementTarget="{Binding ElementName=myButton}"
|
||||
StaysOpen="False">
|
||||
<Border
|
||||
x:Name="myPopupBorder"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
x:Name="myPopupBorder"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<TextBlock Text="Ich bin ein Popup!" />
|
||||
</Border>
|
||||
</Popup>
|
||||
@@ -216,11 +218,11 @@ Grid.Column="2"
|
||||
</Button>
|
||||
<Button
|
||||
Width="100"
|
||||
Command="{Binding AcceptCommand}"
|
||||
Command="{Binding SaveCommand}"
|
||||
Content="{Binding AcceptButtonText}"
|
||||
Visibility="Visible">
|
||||
Speichern
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</view:BeWoView>
|
||||
|
||||
@@ -23,33 +23,19 @@ namespace BeWo.View.Detail.AI
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AiPromptbausteinRoutineView.xaml
|
||||
/// </summary>
|
||||
public partial class AiPromptbausteinRoutineView : UserControl
|
||||
public partial class AiPromptbausteinRoutineView : BeWoView
|
||||
{
|
||||
//public static readonly DependencyProperty RoutineProperty =
|
||||
// DependencyProperty.Register("Routine", typeof(AiPromptbausteinRoutineVM), typeof(AiPromptbausteinRoutineView), new PropertyMetadata(null));
|
||||
|
||||
//public static readonly DependencyProperty FolderListVMProperty =
|
||||
// DependencyProperty.Register("FolderListVM", typeof(AiPromptbausteinFolderListVM), typeof(AiPromptbausteinRoutineView), new PropertyMetadata(null));
|
||||
|
||||
//public AiPromptbausteinRoutineVM Routine
|
||||
//{
|
||||
// get { return (AiPromptbausteinRoutineVM)GetValue(RoutineProperty); }
|
||||
// set { SetValue(RoutineProperty, value); }
|
||||
//}
|
||||
|
||||
//public AiPromptbausteinFolderListVM FolderListVM
|
||||
//{
|
||||
// get { return (AiPromptbausteinFolderListVM)GetValue(FolderListVMProperty); }
|
||||
// set { SetValue(FolderListVMProperty, value); }
|
||||
//}
|
||||
|
||||
public AiPromptbausteinRoutineViewModel ViewModel { get; set; }
|
||||
public AiPromptbausteinRoutineViewModel ViewModel
|
||||
{
|
||||
get => DataContext as AiPromptbausteinRoutineViewModel;
|
||||
set => DataContext = value;
|
||||
}
|
||||
|
||||
public AiPromptbausteinRoutineView(AiPromptbausteinRoutineViewModel viewmodel)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = ViewModel = viewmodel;
|
||||
ViewModel = viewmodel;
|
||||
|
||||
var viewmodel2 = new AiPromptbausteinSelectionComplexViewModel(ViewModel.ViewModel.ActionType, ViewModel.FolderListVM, false, false);
|
||||
var control = new AiPromptbausteinComplexSelectionView(viewmodel2);
|
||||
@@ -89,5 +75,15 @@ namespace BeWo.View.Detail.AI
|
||||
{
|
||||
myPopup.IsOpen = true;
|
||||
}
|
||||
|
||||
public override bool IsDirty
|
||||
{
|
||||
get => ViewModel?.ViewModel?.IsDirty ?? false;
|
||||
}
|
||||
|
||||
protected override void Save()
|
||||
{
|
||||
ViewModel.SaveCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace BeWo.View.Detail.Accounting
|
||||
|
||||
var dialog = new GkvAbrechnungDialogViewModel(vm);
|
||||
|
||||
dialog.RequestClose += (s, ee) => Detail_Window_Closing(s, new CancelEventArgs());
|
||||
dialog.RequestCloseFinal += (s, ee) => Detail_Window_Closing(s, new CancelEventArgs());
|
||||
|
||||
BeWoApp.MainControl.WindowService.ShowGkvAbrechnungDetailWindow(dialog);
|
||||
}
|
||||
|
||||
@@ -35,9 +35,15 @@
|
||||
<Grid x:Name="rootGrid">
|
||||
<GroupBox
|
||||
x:Name="rootGroupBox"
|
||||
x:FieldModifier="public"
|
||||
MouseDoubleClick="RootGroupBox_OnMouseDoubleClick"
|
||||
MouseLeftButtonDown="RootGroupBox_OnMouseLeftButtonDown"
|
||||
Style="{DynamicResource PopUpWindowStyle}" />
|
||||
Style="{DynamicResource PopUpWindowStyle}">
|
||||
<GroupBox.CommandBindings>
|
||||
<CommandBinding Command="ApplicationCommands.Close" Executed="CommandBinding_Close_Executed" />
|
||||
<CommandBinding Command="ApplicationCommands.Save" Executed="CommandBinding_Save_Executed" />
|
||||
</GroupBox.CommandBindings>
|
||||
</GroupBox>
|
||||
<Grid
|
||||
x:Name="_WaitingLayer"
|
||||
HorizontalAlignment="Stretch"
|
||||
|
||||
@@ -254,5 +254,35 @@ namespace BeWo.View.Windows
|
||||
if (!ServiceFacade.IsWaiting() && _WaitLayer != null)
|
||||
EndWaiting();
|
||||
}
|
||||
|
||||
private void CommandBinding_Close_Executed(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
var content = rootGroupBox.Content;
|
||||
|
||||
if (content is BeWoView view)
|
||||
{
|
||||
var canSave = view.DataContext is AcceptCancelDialogViewModel viewModel
|
||||
&& viewModel.SaveCommand.CanExecute(null);
|
||||
|
||||
if ((!canSave) || view.DoSaveCheck())
|
||||
{
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CommandBinding_Save_Executed(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
var content = rootGroupBox.Content;
|
||||
|
||||
if (content is BeWoView view)
|
||||
{
|
||||
view.SaveData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ namespace BeWo.ViewModel
|
||||
private AiPromptbausteinFolderListVM _SubFolders;
|
||||
private AiPromptbausteinPromptListVM _SubPrompts;
|
||||
private AiPromptbausteinRoutineListVM _SubRoutines;
|
||||
private bool _CanAddFolder;
|
||||
private bool _CanAddPrompt;
|
||||
private bool _CanAddRoutine;
|
||||
private bool _CanEdit;
|
||||
|
||||
public AiPromptbausteinFolderVM(AiPromptbausteinFolderDC dc) : base(dc, dc.Oid)
|
||||
{
|
||||
@@ -82,6 +86,27 @@ namespace BeWo.ViewModel
|
||||
set => SetProperty(ref _ActionType, value, nameof(ActionType), () => DataContract.ActionType);
|
||||
}
|
||||
|
||||
public bool CanAddFolder
|
||||
{
|
||||
get => _CanAddFolder;
|
||||
set => SetProperty(ref _CanAddFolder, value, nameof(CanAddFolder));
|
||||
}
|
||||
public bool CanAddPrompt
|
||||
{
|
||||
get => _CanAddPrompt;
|
||||
set => SetProperty(ref _CanAddPrompt, value, nameof(CanAddPrompt));
|
||||
}
|
||||
public bool CanAddRoutine
|
||||
{
|
||||
get => _CanAddRoutine;
|
||||
set => SetProperty(ref _CanAddRoutine, value, nameof(CanAddRoutine));
|
||||
}
|
||||
public bool CanEdit
|
||||
{
|
||||
get => _CanEdit;
|
||||
set => SetProperty(ref _CanEdit, value && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit), nameof(CanEdit));
|
||||
}
|
||||
|
||||
public AiPromptbausteinFolderListVM SubFolders
|
||||
{
|
||||
get => _SubFolders;
|
||||
@@ -194,27 +219,6 @@ namespace BeWo.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanAddFolder
|
||||
{
|
||||
get => DataContract.CanAddFolder;
|
||||
set => DataContract.CanAddFolder = value;
|
||||
}
|
||||
public bool CanAddPrompt
|
||||
{
|
||||
get => DataContract.CanAddPrompt;
|
||||
set => DataContract.CanAddPrompt = value;
|
||||
}
|
||||
public bool CanAddRoutine
|
||||
{
|
||||
get => DataContract.CanAddRoutine;
|
||||
set => DataContract.CanAddRoutine = value;
|
||||
}
|
||||
public bool CanEdit
|
||||
{
|
||||
get => DataContract.CanEdit && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit);
|
||||
set => DataContract.CanEdit = value;
|
||||
}
|
||||
|
||||
public bool IsNewFeature
|
||||
{
|
||||
get => DataContract.IsNewFeature;
|
||||
@@ -274,6 +278,10 @@ namespace BeWo.ViewModel
|
||||
_Position = pDataContract.Position;
|
||||
_IsExpanded = pDataContract.IsExpanded;
|
||||
_ActionType = pDataContract.ActionType;
|
||||
_CanAddFolder = pDataContract.CanAddFolder;
|
||||
_CanAddPrompt = pDataContract.CanAddPrompt;
|
||||
_CanAddRoutine = pDataContract.CanAddRoutine;
|
||||
_CanEdit = pDataContract.CanEdit;
|
||||
SubFolders = new AiPromptbausteinFolderListVM(pDataContract.SubFolders, this);
|
||||
SubPrompts = new AiPromptbausteinPromptListVM(pDataContract.SubPrompts);
|
||||
SubRoutines = new AiPromptbausteinRoutineListVM(pDataContract.SubRoutines);
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace BeWo.ViewModel.View.AI
|
||||
{
|
||||
var selected_prompt = SelectedItem;
|
||||
|
||||
CloseDialogCommand.Execute(null);
|
||||
Close();
|
||||
|
||||
ItemAccepted?.Invoke(this, selected_prompt);
|
||||
}
|
||||
@@ -236,12 +236,9 @@ namespace BeWo.ViewModel.View.AI
|
||||
|
||||
var vm = new AiPromptbausteinFolderViewModel(new_vm, true);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, new_dc) =>
|
||||
{
|
||||
var new_dc = new_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinFolder(new_dc),
|
||||
(new_dcs) => ReloadVMList());
|
||||
ReloadVMList();
|
||||
};
|
||||
|
||||
Close();
|
||||
@@ -259,12 +256,9 @@ namespace BeWo.ViewModel.View.AI
|
||||
|
||||
var vm = new AiPromptbausteinFolderViewModel(edit_vm, false);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, new_dc) =>
|
||||
{
|
||||
var edit_dc = edit_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinFolder(edit_dc),
|
||||
(update_dc) => ReloadVMList());
|
||||
ReloadVMList();
|
||||
};
|
||||
|
||||
Close();
|
||||
@@ -303,19 +297,11 @@ namespace BeWo.ViewModel.View.AI
|
||||
new_vm.CanEdit = true;
|
||||
new_vm.ActionType = AiActionType;
|
||||
|
||||
var vm = new AiPromptbausteinPromptViewModel(new_vm, true);
|
||||
var vm = new AiPromptbausteinPromptViewModel(new_vm);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, e) =>
|
||||
{
|
||||
var dc = new_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinPrompt(dc),
|
||||
new_dc =>
|
||||
{
|
||||
new_vm.UpdateByDataContract(new_dc);
|
||||
sel_folder.SubPrompts.VMList.Add(new_vm);
|
||||
SelectedItem = new_vm;
|
||||
});
|
||||
ReloadVMList();
|
||||
};
|
||||
|
||||
Close();
|
||||
@@ -335,17 +321,11 @@ namespace BeWo.ViewModel.View.AI
|
||||
sel_dc.Version = sel_prompt.DataContract.Version;
|
||||
var edit_vm = new AiPromptbausteinPromptVM(sel_dc);
|
||||
|
||||
var vm = new AiPromptbausteinPromptViewModel(edit_vm, false);
|
||||
var vm = new AiPromptbausteinPromptViewModel(edit_vm);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, e) =>
|
||||
{
|
||||
var edit_dc = edit_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinPrompt(edit_dc),
|
||||
new_dc =>
|
||||
{
|
||||
ReloadVMList();
|
||||
});
|
||||
ReloadVMList();
|
||||
};
|
||||
|
||||
Close();
|
||||
@@ -458,17 +438,11 @@ namespace BeWo.ViewModel.View.AI
|
||||
new_vm.CanEdit = true;
|
||||
new_vm.ActionType = AiActionType;
|
||||
|
||||
var vm = new AiPromptbausteinRoutineViewModel(new_vm, Folders, true);
|
||||
var vm = new AiPromptbausteinRoutineViewModel(new_vm, Folders);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, e) =>
|
||||
{
|
||||
var dc = new_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinRoutine(dc),
|
||||
new_dc =>
|
||||
{
|
||||
ReloadVMList();
|
||||
});
|
||||
ReloadVMList();
|
||||
};
|
||||
|
||||
Close();
|
||||
@@ -488,17 +462,11 @@ namespace BeWo.ViewModel.View.AI
|
||||
sel_dc.Version = sel_prompt.DataContract.Version;
|
||||
var edit_vm = new AiPromptbausteinRoutineVM(sel_dc);
|
||||
|
||||
var vm = new AiPromptbausteinRoutineViewModel(edit_vm, Folders, false);
|
||||
var vm = new AiPromptbausteinRoutineViewModel(edit_vm, Folders);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, e) =>
|
||||
{
|
||||
var edit_dc = edit_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinRoutine(edit_dc),
|
||||
new_dc =>
|
||||
{
|
||||
ReloadVMList();
|
||||
});
|
||||
ReloadVMList();
|
||||
};
|
||||
|
||||
Close();
|
||||
|
||||
@@ -5,44 +5,69 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace BeWo.ViewModel.View
|
||||
{
|
||||
public class AcceptCancelDialogViewModel : DialogViewModel
|
||||
public abstract class AcceptCancelDialogViewModel : DialogViewModel
|
||||
{
|
||||
public event EventHandler Accept_Button_Clicked;
|
||||
public event EventHandler Cancel_Button_Clicked;
|
||||
public DelegateCommand SaveCommand { get; set; }
|
||||
|
||||
public AcceptCancelDialogViewModel() : base()
|
||||
protected AcceptCancelDialogViewModel() : base()
|
||||
{
|
||||
AcceptCommand = new DelegateCommand(Accept, canAccept, false);
|
||||
CancelCommand = new DelegateCommand(Cancel, canCancel, false);
|
||||
SaveCommand = new DelegateCommand(Save, canSave, false);
|
||||
}
|
||||
|
||||
public DelegateCommand AcceptCommand { get; set; }
|
||||
public DelegateCommand CancelCommand { get; set; }
|
||||
|
||||
public void Accept()
|
||||
protected virtual void Save()
|
||||
{
|
||||
Accept_Button_Clicked?.Invoke(this, EventArgs.Empty);
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected virtual bool canSave()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class AcceptCancelDialogViewModel<DCType, VMType> : AcceptCancelDialogViewModel where VMType : AbstractDCMapperVM<DCType> where DCType : new()
|
||||
{
|
||||
public event EventHandler<DCType> DataSaved;
|
||||
|
||||
public VMType ViewModel { get; set; }
|
||||
|
||||
public string AcceptButtonText => ViewModel.IsNew ? "Hinzufügen" : "Speichern";
|
||||
|
||||
public AcceptCancelDialogViewModel(VMType viewModel) : base()
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
|
||||
ViewModel.PropertyChanged += (s, e) =>
|
||||
{
|
||||
SaveCommand.RaiseCanExecuteChanged();
|
||||
};
|
||||
}
|
||||
|
||||
protected void DataSave(DCType dCType)
|
||||
{
|
||||
DataSaved?.Invoke(this, dCType);
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
protected override void Close()
|
||||
{
|
||||
Cancel_Button_Clicked?.Invoke(this, EventArgs.Empty);
|
||||
Close();
|
||||
base.Close();
|
||||
}
|
||||
|
||||
protected virtual bool canAccept()
|
||||
protected override bool canSave()
|
||||
{
|
||||
return true;
|
||||
return ViewModel.IsNew || ViewModel.IsDirty;
|
||||
}
|
||||
|
||||
protected virtual bool canCancel()
|
||||
protected virtual bool isDirty()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,17 +173,11 @@ namespace BeWo.ViewModel.View.Administration
|
||||
|
||||
var vm = new AiPromptbausteinFolderViewModel(new_vm, true);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, new_dc) =>
|
||||
{
|
||||
var dc = new_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinFolder(dc),
|
||||
new_dc =>
|
||||
{
|
||||
new_vm.UpdateByDataContract(new_dc);
|
||||
sel_folder.SubFolders.VMList.Add(new_vm);
|
||||
sel_folder.IsExpanded = true;
|
||||
});
|
||||
new_vm.UpdateByDataContract(new_dc);
|
||||
sel_folder.SubFolders.VMList.Add(new_vm);
|
||||
sel_folder.IsExpanded = true;
|
||||
};
|
||||
|
||||
WindowService.Show(vm);
|
||||
@@ -199,15 +193,9 @@ namespace BeWo.ViewModel.View.Administration
|
||||
|
||||
var vm = new AiPromptbausteinFolderViewModel(edit_vm, false);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, new_dc) =>
|
||||
{
|
||||
var edit_dc = edit_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinFolder(edit_dc),
|
||||
new_dc =>
|
||||
{
|
||||
sel_folder.UpdateByDataContract(new_dc);
|
||||
});
|
||||
sel_folder.UpdateByDataContract(new_dc);
|
||||
};
|
||||
|
||||
WindowService.Show(vm);
|
||||
@@ -271,19 +259,13 @@ namespace BeWo.ViewModel.View.Administration
|
||||
new_vm.CanEdit = true;
|
||||
new_vm.ActionType = AiActionType;
|
||||
|
||||
var vm = new AiPromptbausteinPromptViewModel(new_vm, true);
|
||||
var vm = new AiPromptbausteinPromptViewModel(new_vm);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, new_dc) =>
|
||||
{
|
||||
var dc = new_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinPrompt(dc),
|
||||
new_dc =>
|
||||
{
|
||||
new_vm.UpdateByDataContract(new_dc);
|
||||
sel_folder.SubPrompts.VMList.Add(new_vm);
|
||||
SelectedItem = new_vm;
|
||||
});
|
||||
new_vm.UpdateByDataContract(new_dc);
|
||||
sel_folder.SubPrompts.VMList.Add(new_vm);
|
||||
SelectedItem = new_vm;
|
||||
};
|
||||
|
||||
WindowService.Show(vm);
|
||||
@@ -301,18 +283,12 @@ namespace BeWo.ViewModel.View.Administration
|
||||
sel_dc.Version = sel_prompt.DataContract.Version;
|
||||
var edit_vm = new AiPromptbausteinPromptVM(sel_dc);
|
||||
|
||||
var vm = new AiPromptbausteinPromptViewModel(edit_vm, false);
|
||||
var vm = new AiPromptbausteinPromptViewModel(edit_vm);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, new_dc) =>
|
||||
{
|
||||
var edit_dc = edit_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinPrompt(edit_dc),
|
||||
new_dc =>
|
||||
{
|
||||
sel_prompt.UpdateByDataContract(new_dc);
|
||||
UpdateSelectedPromptFavorite(sel_prompt);
|
||||
});
|
||||
sel_prompt.UpdateByDataContract(new_dc);
|
||||
UpdateSelectedPromptFavorite(sel_prompt);
|
||||
};
|
||||
|
||||
WindowService.Show(vm);
|
||||
@@ -471,19 +447,13 @@ namespace BeWo.ViewModel.View.Administration
|
||||
new_vm.CanEdit = true;
|
||||
new_vm.ActionType = AiActionType;
|
||||
|
||||
var vm = new AiPromptbausteinRoutineViewModel(new_vm, Folders, true);
|
||||
var vm = new AiPromptbausteinRoutineViewModel(new_vm, Folders);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, new_dc) =>
|
||||
{
|
||||
var dc = new_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinRoutine(dc),
|
||||
new_dc =>
|
||||
{
|
||||
new_vm.UpdateByDataContract(new_dc);
|
||||
sel_folder.SubRoutines.VMList.Add(new_vm);
|
||||
SelectedItem = new_vm;
|
||||
});
|
||||
new_vm.UpdateByDataContract(new_dc);
|
||||
sel_folder.SubRoutines.VMList.Add(new_vm);
|
||||
SelectedItem = new_vm;
|
||||
};
|
||||
|
||||
WindowService.Show(vm);
|
||||
@@ -501,18 +471,12 @@ namespace BeWo.ViewModel.View.Administration
|
||||
sel_dc.Version = sel_prompt.DataContract.Version;
|
||||
var edit_vm = new AiPromptbausteinRoutineVM(sel_dc);
|
||||
|
||||
var vm = new AiPromptbausteinRoutineViewModel(edit_vm, Folders, false);
|
||||
var vm = new AiPromptbausteinRoutineViewModel(edit_vm, Folders);
|
||||
|
||||
vm.Accept_Button_Clicked += (s, e) =>
|
||||
vm.DataSaved += (s, new_dc) =>
|
||||
{
|
||||
var edit_dc = edit_vm.CommitToDataContract();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinRoutine(edit_dc),
|
||||
new_dc =>
|
||||
{
|
||||
sel_prompt.UpdateByDataContract(new_dc);
|
||||
UpdateSelectedRoutineFavorite(sel_prompt);
|
||||
});
|
||||
sel_prompt.UpdateByDataContract(new_dc);
|
||||
UpdateSelectedRoutineFavorite(sel_prompt);
|
||||
};
|
||||
|
||||
WindowService.Show(vm);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using DevExpress.DataProcessing.InMemoryDataProcessor;
|
||||
using BeWo.ServiceProxy;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using DevExpress.DataProcessing.InMemoryDataProcessor;
|
||||
using DevExpress.Mvvm;
|
||||
using DevExpress.Mvvm.POCO;
|
||||
using DevExpress.XtraBars.Docking2010.Views.WindowsUI;
|
||||
@@ -11,28 +13,30 @@ using System.Windows.Input;
|
||||
|
||||
namespace BeWo.ViewModel.View.Administration
|
||||
{
|
||||
public class AiPromptbausteinFolderViewModel : AcceptCancelDialogViewModel
|
||||
public class AiPromptbausteinFolderViewModel : AcceptCancelDialogViewModel<AiPromptbausteinFolderDC, AiPromptbausteinFolderVM>
|
||||
{
|
||||
private readonly bool _IsNew;
|
||||
|
||||
public AiPromptbausteinFolderViewModel(AiPromptbausteinFolderVM viewModel, bool isNew) : base()
|
||||
public AiPromptbausteinFolderViewModel(AiPromptbausteinFolderVM viewModel, bool isNew) : base(viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
_IsNew = isNew;
|
||||
|
||||
ViewModel.PropertyChanged += (s, e) =>
|
||||
{
|
||||
AcceptCommand.RaiseCanExecuteChanged();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public AiPromptbausteinFolderVM ViewModel { get; set; }
|
||||
|
||||
public string AcceptButtonText => _IsNew ? "Hinzufügen" : "Speichern";
|
||||
|
||||
protected override bool canAccept()
|
||||
protected override void Save()
|
||||
{
|
||||
return (_IsNew || ViewModel.IsDirty) && !string.IsNullOrWhiteSpace(ViewModel.Title);
|
||||
var dc = ViewModel.CommitToDataContract();
|
||||
|
||||
if (ViewModel.IsNew)
|
||||
{
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinFolder(dc), DataSave);
|
||||
}
|
||||
else
|
||||
{
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinFolder(dc), DataSave);
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool canSave()
|
||||
{
|
||||
return base.canSave() && !string.IsNullOrWhiteSpace(ViewModel.Title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using BeWo.ServiceProxy;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -6,28 +8,32 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BeWo.ViewModel.View.Administration
|
||||
{
|
||||
public class AiPromptbausteinPromptViewModel : AcceptCancelDialogViewModel
|
||||
public class AiPromptbausteinPromptViewModel : AcceptCancelDialogViewModel<AiPromptbausteinPromptDC, AiPromptbausteinPromptVM>
|
||||
{
|
||||
private readonly bool _IsNew;
|
||||
|
||||
public AiPromptbausteinPromptViewModel(AiPromptbausteinPromptVM viewModel, bool isNew) : base()
|
||||
public AiPromptbausteinPromptViewModel(AiPromptbausteinPromptVM viewModel) : base(viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
_IsNew = isNew;
|
||||
|
||||
ViewModel.PropertyChanged += (s, e) =>
|
||||
{
|
||||
AcceptCommand.RaiseCanExecuteChanged();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public AiPromptbausteinPromptVM ViewModel { get; private set; }
|
||||
|
||||
public string AcceptButtonText => _IsNew ? "Hinzufügen" : "Speichern";
|
||||
|
||||
protected override bool canAccept()
|
||||
protected override bool canSave()
|
||||
{
|
||||
return (_IsNew || ViewModel.IsDirty) && !string.IsNullOrWhiteSpace(ViewModel.Title) && !string.IsNullOrWhiteSpace(ViewModel.Prompt);
|
||||
return base.canSave() && !string.IsNullOrWhiteSpace(ViewModel.Title) && !string.IsNullOrWhiteSpace(ViewModel.Prompt);
|
||||
}
|
||||
|
||||
protected override void Save()
|
||||
{
|
||||
var dc = ViewModel.CommitToDataContract();
|
||||
|
||||
if (ViewModel.IsNew)
|
||||
{
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinPrompt(dc),
|
||||
DataSave);
|
||||
}
|
||||
else
|
||||
{
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinPrompt(dc),
|
||||
DataSave);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using BeWo.ViewModel.ListViewModel;
|
||||
using BeWo.ServiceProxy;
|
||||
using BeWo.ViewModel.ListViewModel;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using DevExpress.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,13 +12,12 @@ using System.Windows.Input;
|
||||
|
||||
namespace BeWo.ViewModel.View.Administration
|
||||
{
|
||||
public class AiPromptbausteinRoutineViewModel : AcceptCancelDialogViewModel
|
||||
public class AiPromptbausteinRoutineViewModel : AcceptCancelDialogViewModel<AiPromptbausteinRoutineDC, AiPromptbausteinRoutineVM>
|
||||
{
|
||||
private readonly bool _IsNew;
|
||||
public AiPromptbausteinRoutineStepVM _SelectedStep;
|
||||
|
||||
public AiPromptbausteinFolderListVM FolderListVM { get; set; }
|
||||
public AiPromptbausteinRoutineVM ViewModel { get; private set; }
|
||||
|
||||
public ICommand DeleteStepCommand { get; private set; }
|
||||
public ICommand MoveStepUpCommand { get; private set; }
|
||||
@@ -28,22 +29,13 @@ namespace BeWo.ViewModel.View.Administration
|
||||
set => SetProperty(ref _SelectedStep, value, nameof(SelectedStep));
|
||||
}
|
||||
|
||||
public string AcceptButtonText => _IsNew ? "Hinzufügen" : "Speichern";
|
||||
|
||||
public AiPromptbausteinRoutineViewModel(AiPromptbausteinRoutineVM viewModel, AiPromptbausteinFolderListVM folders, bool isNew) : base()
|
||||
public AiPromptbausteinRoutineViewModel(AiPromptbausteinRoutineVM viewModel, AiPromptbausteinFolderListVM folders) : base(viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
FolderListVM = folders;
|
||||
_IsNew = isNew;
|
||||
|
||||
ViewModel.PropertyChanged += (s, e) =>
|
||||
{
|
||||
AcceptCommand.RaiseCanExecuteChanged();
|
||||
};
|
||||
|
||||
ViewModel.Steps.VMList.ListChanged += (s, e) =>
|
||||
{
|
||||
AcceptCommand.RaiseCanExecuteChanged();
|
||||
SaveCommand.RaiseCanExecuteChanged();
|
||||
};
|
||||
|
||||
DeleteStepCommand = new DelegateCommand<AiPromptbausteinRoutineStepVM>(DeleteStep, canDeleteStep);
|
||||
@@ -81,9 +73,25 @@ namespace BeWo.ViewModel.View.Administration
|
||||
return step is object && ViewModel.Steps.Count > 1 && ViewModel.Steps.VMList.Last() != step;
|
||||
}
|
||||
|
||||
protected override bool canAccept()
|
||||
protected override bool canSave()
|
||||
{
|
||||
return (_IsNew || ViewModel.IsDirty) && !string.IsNullOrWhiteSpace(ViewModel.Title) && (ViewModel.Steps?.VMList.Any() ?? false);
|
||||
return base.canSave() && !string.IsNullOrWhiteSpace(ViewModel.Title) && (ViewModel.Steps?.VMList.Any() ?? false);
|
||||
}
|
||||
|
||||
protected override void Save()
|
||||
{
|
||||
var dc = ViewModel.CommitToDataContract();
|
||||
|
||||
if (ViewModel.IsNew)
|
||||
{
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.InsertAiPromptbausteinRoutine(dc),
|
||||
DataSave);
|
||||
}
|
||||
else
|
||||
{
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiPromptbausteinRoutine(dc),
|
||||
DataSave);
|
||||
}
|
||||
}
|
||||
|
||||
private void swap(AiPromptbausteinRoutineStepVM step_x, int offset_y)
|
||||
|
||||
@@ -10,18 +10,16 @@ namespace BeWo.ViewModel.View
|
||||
{
|
||||
public class DialogViewModel : WindowViewModel
|
||||
{
|
||||
public event EventHandler RequestClose;
|
||||
public event EventHandler RequestCloseFinal;
|
||||
|
||||
public DialogViewModel() : base()
|
||||
{
|
||||
CloseDialogCommand = new DelegateCommand(Close);
|
||||
|
||||
}
|
||||
|
||||
public ICommand CloseDialogCommand { get; set; }
|
||||
|
||||
protected void Close()
|
||||
protected virtual void Close()
|
||||
{
|
||||
RequestClose?.Invoke(this, EventArgs.Empty);
|
||||
RequestCloseFinal?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user