Prompt Titel pflicht

This commit is contained in:
2026-03-20 14:16:43 +01:00
parent c47ec17506
commit ae3f6b00dd
4 changed files with 16 additions and 21 deletions

View File

@@ -177,9 +177,11 @@ namespace BeWo.Services
{
var window = _windowFactory.GetAnimatedBeWoWindow(title, control, options.Height, options.Width);
if(windowViewModel is DialogViewModel dialogViewModel)
window.ViewModel = windowViewModel;
if (windowViewModel is DialogViewModel dialogViewModel)
{
dialogViewModel.RequestClose += (s, e) => window.Close();
dialogViewModel.RequestClose += (s, e) => window.Close();
}
if (options.ShowAsDialog)

View File

@@ -1,5 +1,4 @@
<UserControl
x:Name="root"
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"
@@ -10,6 +9,7 @@
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodel="clr-namespace:BeWo.ViewModel.View.Administration"
x:Name="root"
Width="500"
Height="400">
<UserControl.Resources>
@@ -19,9 +19,7 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid
HorizontalAlignment="Stretch"
Background="#eeeeee">
<Grid HorizontalAlignment="Stretch" Background="#eeeeee">
<Grid Margin="8,4,8,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" MinWidth="80" />
@@ -42,8 +40,7 @@
<TextBox
Grid.Row="0"
Grid.Column="2"
IsEnabled="{Binding CanEdit}"
Text="{Binding Title, UpdateSourceTrigger=PropertyChanged}" />
Text="{Binding PromptVM.Title, UpdateSourceTrigger=PropertyChanged, ElementName=root}" />
<Label
Grid.Row="1"
@@ -53,10 +50,9 @@
Grid.Row="1"
Grid.Column="2"
MaxHeight="100"
IsEnabled="{Binding CanEdit}"
MaxLength="1024"
Style="{StaticResource TextBoxNotice}"
Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}"
Text="{Binding PromptVM.Description, UpdateSourceTrigger=PropertyChanged, ElementName=root}"
TextWrapping="Wrap" />
<Label
@@ -66,7 +62,6 @@
<TextBox
Grid.Row="2"
Grid.Column="2"
IsEnabled="{Binding PromptVM.CanEdit, ElementName=root}"
Style="{StaticResource TextBoxNoticeLarge}"
Text="{Binding PromptVM.Prompt, UpdateSourceTrigger=PropertyChanged, ElementName=root}"
TextWrapping="Wrap" />
@@ -80,22 +75,22 @@
Grid.Column="2"
Margin="3"
IsEnabled="False"
SelectedCompactEmployeeDC="{Binding Creator}" />
SelectedCompactEmployeeDC="{Binding PromptVM.Creator, ElementName=root}" />
<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
<dxe:CheckEdit
Grid.Row="4"
Grid.Column="2"
Margin="3"
IsChecked="{Binding IsPublic}"
IsEnabled="{Binding CanShareEdit, UpdateSourceTrigger=PropertyChanged}" />
IsChecked="{Binding PromptVM.IsPublic, ElementName=root}"
IsEnabled="{Binding PromptVM.CanShareEdit, UpdateSourceTrigger=PropertyChanged, ElementName=root}" />
<Label Grid.Row="5" Grid.Column="0">Favorit</Label>
<dxe:CheckEdit
Grid.Row="5"
Grid.Column="2"
Margin="3"
IsChecked="{Binding IsFavorite}"
IsChecked="{Binding PromptVM.IsFavorite, ElementName=root}"
IsEnabled="true" />

View File

@@ -13,6 +13,7 @@ using BS.Shared.Core;
using DevExpress.Mvvm;
using BeWo.ServiceProxy;
using BS.Shared.Extensions;
using System.Diagnostics;
namespace BeWo.ViewModel.View.AI
{
@@ -50,7 +51,7 @@ namespace BeWo.ViewModel.View.AI
AskDeleteCommand = new DelegateCommand(AskDelete, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordChat) && ListVM.SelectedVM is object);
SavePromptCommand = new DelegateCommand<AiConversationMessageVM>(SavePrompt, vm => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit));
AcceptSavePromptCommand = new DelegateCommand(AcceptSavePrompt);
AcceptSavePromptCommand = new DelegateCommand(AcceptSavePrompt, () => !string.IsNullOrWhiteSpace(SavePromptVM?.Title));
CancelSavePromptCommand = new DelegateCommand(CancelSavePrompt);
ListVM = new AiConversationListVM();

View File

@@ -15,13 +15,10 @@ namespace BeWo.ViewModel.View.Administration
ViewModel = viewModel;
_IsNew = isNew;
if (!_IsNew)
{
ViewModel.PropertyChanged += (s, e) =>
ViewModel.PropertyChanged += (s, e) =>
{
AcceptCommand.RaiseCanExecuteChanged();
};
}
}
public AiPromptbausteinPromptVM ViewModel { get; private set; }
@@ -30,7 +27,7 @@ namespace BeWo.ViewModel.View.Administration
protected override bool canAccept()
{
return _IsNew || ViewModel.IsDirty;
return (_IsNew || ViewModel.IsDirty) && !string.IsNullOrWhiteSpace(ViewModel.Title);
}
}
}