Compare commits

..

2 Commits

Author SHA1 Message Date
Meik
7f14de43ce rote rahmen für req im fallabschluss 2025-11-13 15:03:35 +01:00
Meik
7653b92eb6 rote rahmen für req im fallabschluss 2025-11-13 15:03:17 +01:00
7 changed files with 206 additions and 93 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -199,14 +199,15 @@
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<ComboBox x:Name="ComboBoxControl" <ComboBox x:Name="ComboBoxControl"
DropDownOpened="ComboBoxControl_DropDownOpened" DropDownOpened="ComboBoxControl_DropDownOpened"
DropDownClosed="ComboBoxControl_DropDownClosed" DropDownClosed="ComboBoxControl_DropDownClosed"
Background="{Binding ElementName=ComboBoxPagableUc, Path=ComboBoxBackground}" Background="{Binding ElementName=ComboBoxPagableUc, Path=ComboBoxBackground}"
BorderBrush="{Binding ElementName=ComboBoxPagableUc, Path=BorderBrush}" BorderBrush="{Binding ElementName=ComboBoxPagableUc, Path=BorderBrush}"
ItemsSource="{Binding ElementName=ComboBoxPagableUc, Path=ItemData}" BorderThickness="0"
SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ComboBoxPageable}}, Path=SelectedItem, Mode=TwoWay}" ItemsSource="{Binding ElementName=ComboBoxPagableUc, Path=ItemData}"
DisplayMemberPath="Key" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ComboBoxPageable}}, Path=SelectedItem, Mode=TwoWay}"
Template="{StaticResource ComboBoxPagableTemplate}" /> DisplayMemberPath="Key"
</Grid> Template="{StaticResource ComboBoxPagableTemplate}" />
</Grid>
</UserControl> </UserControl>

View File

@@ -1939,32 +1939,38 @@ namespace FasdDesktopUi.Basics.UserControls
} }
break; break;
case "ErrorTypeValue": case "ErrorTypeValue":
if (DynamicStatusAdditionBorder.Child is CloseTicketDialog closeTicketDialog2) if (DynamicStatusAdditionBorder.Child is CloseTicketDialog closeTicketDialog2)
{ {
if (closeTicketDialog2.SelectedErrorType == null || closeTicketDialog2.SelectedErrorType is ComboBoxItem b && b.Tag == null) if (closeTicketDialog2.SelectedErrorType == null || closeTicketDialog2.SelectedErrorType is ComboBoxItem b && b.Tag == null)
{ {
if (!_errors.ContainsKey(propertyName)) closeTicketDialog2.UpdateErrorTypeValidationState(true);
_errors.Add(propertyName, cMultiLanguageSupport.GetItem("Dialog.CloseCase.ValidationErrorTypeEmpty")); if (!_errors.ContainsKey(propertyName))
} _errors.Add(propertyName, cMultiLanguageSupport.GetItem("Dialog.CloseCase.ValidationErrorTypeEmpty"));
else }
{ else
if (_errors.ContainsKey(propertyName)) {
_errors.Remove(propertyName); closeTicketDialog2.UpdateErrorTypeValidationState(false);
} if (_errors.ContainsKey(propertyName))
} _errors.Remove(propertyName);
break; }
}
break;
case "SelectedRoleAndPerson": case "SelectedRoleAndPerson":
if (DynamicStatusAdditionBorder.Child is ForwardTicketDialog forwardTicketDialog) if (DynamicStatusAdditionBorder.Child is ForwardTicketDialog forwardTicketDialog)
{ {
if ((forwardTicketDialog.SelectedPerson.Key == null || forwardTicketDialog.SelectedPerson.Value == null) && bool hasError = (forwardTicketDialog.SelectedPerson.Key == null || forwardTicketDialog.SelectedPerson.Value == null) &&
(forwardTicketDialog.SelectedRole.Key == null || forwardTicketDialog.SelectedRole.Value == null)) (forwardTicketDialog.SelectedRole.Key == null || forwardTicketDialog.SelectedRole.Value == null);
{
if (!_errors.ContainsKey(propertyName)) forwardTicketDialog.UpdateResponsibleSelectionValidationState(hasError);
_errors.Add(propertyName, cMultiLanguageSupport.GetItem("Dialog.CloseCase.ValidationErrorRoleAndPersonEmpty"));
} if (hasError)
else {
if (!_errors.ContainsKey(propertyName))
_errors.Add(propertyName, cMultiLanguageSupport.GetItem("Dialog.CloseCase.ValidationErrorRoleAndPersonEmpty"));
}
else
{ {
if (_errors.ContainsKey(propertyName)) if (_errors.ContainsKey(propertyName))
_errors.Remove(propertyName); _errors.Remove(propertyName);

View File

@@ -20,15 +20,22 @@
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.CloseTicket.ErrorType}" <TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.CloseTicket.ErrorType}"
FontWeight="Bold" FontWeight="Bold"
Foreground="{DynamicResource FontColor.Menu.Categories}" /> Foreground="{DynamicResource FontColor.Menu.Categories}" />
<ComboBox x:Name="ErrorTypeComboBox" <Border x:Name="ErrorTypeValidationBorder"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}" Margin="0 5 0 0"
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}" BorderThickness="1"
SelectedItem="{Binding ElementName=CloseTicketDialogUc, Path=SelectedErrorType, Mode=TwoWay}" Padding="1"
Margin="0 5 0 0" CornerRadius="7.5"
DropDownOpened="DropDownOpened" Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
DropDownClosed="DropDownClosed" BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}">
PreviewKeyDown="ErrorTypeComboBox_PreviewKeyDown" <ComboBox x:Name="ErrorTypeComboBox"
/> Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
BorderBrush="Transparent"
BorderThickness="0"
SelectionChanged="ErrorTypeComboBox_SelectionChanged"
DropDownOpened="DropDownOpened"
DropDownClosed="DropDownClosed"
PreviewKeyDown="ErrorTypeComboBox_PreviewKeyDown" />
</Border>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.CloseTicket.Solution}" <TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.CloseTicket.Solution}"
FontWeight="Bold" FontWeight="Bold"
Foreground="{DynamicResource FontColor.Menu.Categories}" Foreground="{DynamicResource FontColor.Menu.Categories}"

View File

@@ -21,8 +21,17 @@ using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.UserControls namespace FasdDesktopUi.Basics.UserControls
{ {
public partial class CloseTicketDialog : UserControl public partial class CloseTicketDialog : UserControl
{ {
private static readonly Brush ValidationBrush = CreateValidationBrush();
private static Brush CreateValidationBrush()
{
var brush = new SolidColorBrush(Color.FromRgb(0xF5, 0x7C, 0x73));
if (brush.CanFreeze)
brush.Freeze();
return brush;
}
private Brush defaultErrorTypeBorderBrush;
#region Properties #region Properties
public event EventHandler ErrorTypeValueChanged; public event EventHandler ErrorTypeValueChanged;
@@ -68,21 +77,33 @@ namespace FasdDesktopUi.Basics.UserControls
} }
// Using a DependencyProperty as the backing store for SelectedErrorType. This enables animation, styling, binding, etc... // Using a DependencyProperty as the backing store for SelectedErrorType. This enables animation, styling, binding, etc...
public static readonly DependencyProperty SelectedErrorTypeProperty = public static readonly DependencyProperty SelectedErrorTypeProperty =
DependencyProperty.Register("SelectedErrorType", typeof(ComboBoxItem), typeof(CloseTicketDialog), new PropertyMetadata(null, OnSelectedErrorTypeChanged)); DependencyProperty.Register("SelectedErrorType", typeof(ComboBoxItem), typeof(CloseTicketDialog), new PropertyMetadata(null, OnSelectedErrorTypeChanged));
private static void OnSelectedErrorTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnSelectedErrorTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var control = (CloseTicketDialog)d; if (!(d is CloseTicketDialog control))
control.ErrorTypeValueChanged?.Invoke(control, EventArgs.Empty); return;
}
var newItem = e.NewValue as ComboBoxItem;
bool hasError = newItem == null || newItem.Tag == null;
if (control.ErrorTypeComboBox != null && !Equals(control.ErrorTypeComboBox.SelectedItem, newItem))
{
control.ErrorTypeComboBox.SelectedItem = newItem;
}
control.UpdateErrorTypeValidationState(hasError);
control.ErrorTypeValueChanged?.Invoke(control, EventArgs.Empty);
}
#endregion #endregion
public CloseTicketDialog() public CloseTicketDialog()
{ {
InitializeComponent(); InitializeComponent();
} defaultErrorTypeBorderBrush = ErrorTypeValidationBorder?.BorderBrush?.CloneCurrentValue();
}
protected override void OnInitialized(EventArgs e) protected override void OnInitialized(EventArgs e)
{ {
@@ -170,11 +191,36 @@ namespace FasdDesktopUi.Basics.UserControls
} }
private void ErrorTypeComboBox_PreviewKeyDown(object sender, KeyEventArgs e) private void ErrorTypeComboBox_PreviewKeyDown(object sender, KeyEventArgs e)
{ {
if(e.Key == Key.Escape) { if(e.Key == Key.Escape) {
DropDownClosed(sender, e); DropDownClosed(sender, e);
} }
} }
}
} private void ErrorTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var selected = ErrorTypeComboBox?.SelectedItem as ComboBoxItem;
if (!Equals(SelectedErrorType, selected))
{
SelectedErrorType = selected;
return;
}
bool hasError = selected == null || selected.Tag == null;
UpdateErrorTypeValidationState(hasError);
}
public void UpdateErrorTypeValidationState(bool hasError)
{
if (ErrorTypeValidationBorder == null)
return;
if (defaultErrorTypeBorderBrush == null)
defaultErrorTypeBorderBrush = ErrorTypeValidationBorder.BorderBrush?.CloneCurrentValue();
ErrorTypeValidationBorder.BorderBrush = hasError ? ValidationBrush : defaultErrorTypeBorderBrush;
}
}
}

View File

@@ -19,21 +19,35 @@
FontWeight="Bold" FontWeight="Bold"
Foreground="{DynamicResource FontColor.Menu.Categories}" /> Foreground="{DynamicResource FontColor.Menu.Categories}" />
<local:ComboBoxPageable x:Name="RoleSelectionControl" <Border x:Name="RoleValidationBorder"
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedRole, Mode=TwoWay}" Margin="0 5 0 10"
Margin="0 5 0 10" BorderThickness="1"
ComboBoxBackground="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}" Padding="1"
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}" /> CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ForwardTicket.ResponsiblePerson}" BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}">
FontWeight="Bold" <local:ComboBoxPageable x:Name="RoleSelectionControl"
Foreground="{DynamicResource FontColor.Menu.Categories}" /> SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedRole, Mode=TwoWay}"
ComboBoxBackground="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
<local:ComboBoxPageable x:Name="PersonSelectionControl" BorderBrush="Transparent" />
Margin="0 5 0 10" </Border>
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedPerson, Mode=TwoWay}"
ComboBoxBackground="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}" <TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ForwardTicket.ResponsiblePerson}"
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}" /> FontWeight="Bold"
Foreground="{DynamicResource FontColor.Menu.Categories}" />
<Border x:Name="PersonValidationBorder"
Margin="0 5 0 10"
BorderThickness="1"
Padding="1"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}">
<local:ComboBoxPageable x:Name="PersonSelectionControl"
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedPerson, Mode=TwoWay}"
ComboBoxBackground="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
BorderBrush="Transparent" />
</Border>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ForwardTicket.Comment}" <TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ForwardTicket.Comment}"
FontWeight="Bold" FontWeight="Bold"

View File

@@ -5,15 +5,27 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media;
using static C4IT.Logging.cLogManager; using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.UserControls namespace FasdDesktopUi.Basics.UserControls
{ {
public partial class ForwardTicketDialog : UserControl public partial class ForwardTicketDialog : UserControl
{ {
private readonly cSupportCaseDataProvider _dataProvider; private readonly cSupportCaseDataProvider _dataProvider;
private static readonly Brush ValidationBrush = CreateValidationBrush();
private static Brush CreateValidationBrush()
{
var brush = new SolidColorBrush(Color.FromRgb(0xF5, 0x7C, 0x73));
if (brush.CanFreeze)
brush.Freeze();
return brush;
}
private Brush defaultRoleBorderBrush;
private Brush defaultPersonBorderBrush;
string lastPersonSearch = string.Empty; string lastPersonSearch = string.Empty;
string lastRoleSearch = string.Empty; string lastRoleSearch = string.Empty;
@@ -71,11 +83,14 @@ namespace FasdDesktopUi.Basics.UserControls
} }
public ForwardTicketDialog(cSupportCaseDataProvider dataProvider) public ForwardTicketDialog(cSupportCaseDataProvider dataProvider)
{ {
InitializeComponent(); InitializeComponent();
_dataProvider = dataProvider; _dataProvider = dataProvider;
} defaultRoleBorderBrush = RoleValidationBorder?.BorderBrush?.CloneCurrentValue();
defaultPersonBorderBrush = PersonValidationBorder?.BorderBrush?.CloneCurrentValue();
UpdateResponsibleSelectionValidationState(true);
}
protected override void OnInitialized(EventArgs e) protected override void OnInitialized(EventArgs e)
{ {
@@ -169,8 +184,8 @@ namespace FasdDesktopUi.Basics.UserControls
} }
} }
private ObservableCollection<KeyValuePair<string, object>> GetRoleSelectionData(cF4SDHealthCardRawData.cHealthCardTable dataTable) private ObservableCollection<KeyValuePair<string, object>> GetRoleSelectionData(cF4SDHealthCardRawData.cHealthCardTable dataTable)
{ {
try try
{ {
if (dataTable is null || dataTable.Name != "M42Wpm-Ticket-Roles") if (dataTable is null || dataTable.Name != "M42Wpm-Ticket-Roles")
@@ -191,6 +206,30 @@ namespace FasdDesktopUi.Basics.UserControls
} }
return null; return null;
} }
}
} public void UpdateResponsibleSelectionValidationState(bool hasError)
{
try
{
if (RoleValidationBorder != null)
{
if (defaultRoleBorderBrush == null)
defaultRoleBorderBrush = RoleValidationBorder.BorderBrush?.CloneCurrentValue();
RoleValidationBorder.BorderBrush = hasError ? ValidationBrush : defaultRoleBorderBrush;
}
if (PersonValidationBorder != null)
{
if (defaultPersonBorderBrush == null)
defaultPersonBorderBrush = PersonValidationBorder.BorderBrush?.CloneCurrentValue();
PersonValidationBorder.BorderBrush = hasError ? ValidationBrush : defaultPersonBorderBrush;
}
}
catch (Exception E)
{
LogException(E);
}
}
}
}