Compare commits
2 Commits
5a8cbe8716
...
7f14de43ce
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f14de43ce | ||
|
|
7653b92eb6 |
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -204,6 +204,7 @@
|
||||
DropDownClosed="ComboBoxControl_DropDownClosed"
|
||||
Background="{Binding ElementName=ComboBoxPagableUc, Path=ComboBoxBackground}"
|
||||
BorderBrush="{Binding ElementName=ComboBoxPagableUc, Path=BorderBrush}"
|
||||
BorderThickness="0"
|
||||
ItemsSource="{Binding ElementName=ComboBoxPagableUc, Path=ItemData}"
|
||||
SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ComboBoxPageable}}, Path=SelectedItem, Mode=TwoWay}"
|
||||
DisplayMemberPath="Key"
|
||||
|
||||
@@ -1944,11 +1944,13 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
if (closeTicketDialog2.SelectedErrorType == null || closeTicketDialog2.SelectedErrorType is ComboBoxItem b && b.Tag == null)
|
||||
{
|
||||
closeTicketDialog2.UpdateErrorTypeValidationState(true);
|
||||
if (!_errors.ContainsKey(propertyName))
|
||||
_errors.Add(propertyName, cMultiLanguageSupport.GetItem("Dialog.CloseCase.ValidationErrorTypeEmpty"));
|
||||
}
|
||||
else
|
||||
{
|
||||
closeTicketDialog2.UpdateErrorTypeValidationState(false);
|
||||
if (_errors.ContainsKey(propertyName))
|
||||
_errors.Remove(propertyName);
|
||||
}
|
||||
@@ -1958,8 +1960,12 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
case "SelectedRoleAndPerson":
|
||||
if (DynamicStatusAdditionBorder.Child is ForwardTicketDialog forwardTicketDialog)
|
||||
{
|
||||
if ((forwardTicketDialog.SelectedPerson.Key == null || forwardTicketDialog.SelectedPerson.Value == null) &&
|
||||
(forwardTicketDialog.SelectedRole.Key == null || forwardTicketDialog.SelectedRole.Value == null))
|
||||
bool hasError = (forwardTicketDialog.SelectedPerson.Key == null || forwardTicketDialog.SelectedPerson.Value == null) &&
|
||||
(forwardTicketDialog.SelectedRole.Key == null || forwardTicketDialog.SelectedRole.Value == null);
|
||||
|
||||
forwardTicketDialog.UpdateResponsibleSelectionValidationState(hasError);
|
||||
|
||||
if (hasError)
|
||||
{
|
||||
if (!_errors.ContainsKey(propertyName))
|
||||
_errors.Add(propertyName, cMultiLanguageSupport.GetItem("Dialog.CloseCase.ValidationErrorRoleAndPersonEmpty"));
|
||||
|
||||
@@ -20,15 +20,22 @@
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.CloseTicket.ErrorType}"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource FontColor.Menu.Categories}" />
|
||||
<Border x:Name="ErrorTypeValidationBorder"
|
||||
Margin="0 5 0 0"
|
||||
BorderThickness="1"
|
||||
Padding="1"
|
||||
CornerRadius="7.5"
|
||||
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
|
||||
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}">
|
||||
<ComboBox x:Name="ErrorTypeComboBox"
|
||||
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
|
||||
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}"
|
||||
SelectedItem="{Binding ElementName=CloseTicketDialogUc, Path=SelectedErrorType, Mode=TwoWay}"
|
||||
Margin="0 5 0 0"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
SelectionChanged="ErrorTypeComboBox_SelectionChanged"
|
||||
DropDownOpened="DropDownOpened"
|
||||
DropDownClosed="DropDownClosed"
|
||||
PreviewKeyDown="ErrorTypeComboBox_PreviewKeyDown"
|
||||
/>
|
||||
PreviewKeyDown="ErrorTypeComboBox_PreviewKeyDown" />
|
||||
</Border>
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.CloseTicket.Solution}"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource FontColor.Menu.Categories}"
|
||||
|
||||
@@ -23,6 +23,15 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
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
|
||||
|
||||
public event EventHandler ErrorTypeValueChanged;
|
||||
@@ -72,7 +81,18 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
DependencyProperty.Register("SelectedErrorType", typeof(ComboBoxItem), typeof(CloseTicketDialog), new PropertyMetadata(null, OnSelectedErrorTypeChanged));
|
||||
private static void OnSelectedErrorTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var control = (CloseTicketDialog)d;
|
||||
if (!(d is CloseTicketDialog control))
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -82,6 +102,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
public CloseTicketDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
defaultErrorTypeBorderBrush = ErrorTypeValidationBorder?.BorderBrush?.CloneCurrentValue();
|
||||
}
|
||||
|
||||
protected override void OnInitialized(EventArgs e)
|
||||
@@ -176,5 +197,30 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,21 +19,35 @@
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource FontColor.Menu.Categories}" />
|
||||
|
||||
<Border x:Name="RoleValidationBorder"
|
||||
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="RoleSelectionControl"
|
||||
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedRole, Mode=TwoWay}"
|
||||
Margin="0 5 0 10"
|
||||
ComboBoxBackground="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
|
||||
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}" />
|
||||
BorderBrush="Transparent" />
|
||||
</Border>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ForwardTicket.ResponsiblePerson}"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource FontColor.Menu.Categories}" />
|
||||
|
||||
<local:ComboBoxPageable x:Name="PersonSelectionControl"
|
||||
<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="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}" />
|
||||
BorderBrush="Transparent" />
|
||||
</Border>
|
||||
|
||||
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ForwardTicket.Comment}"
|
||||
FontWeight="Bold"
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Basics.UserControls
|
||||
@@ -14,6 +15,17 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
public partial class ForwardTicketDialog : UserControl
|
||||
{
|
||||
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 lastRoleSearch = string.Empty;
|
||||
@@ -75,6 +87,9 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
InitializeComponent();
|
||||
_dataProvider = dataProvider;
|
||||
defaultRoleBorderBrush = RoleValidationBorder?.BorderBrush?.CloneCurrentValue();
|
||||
defaultPersonBorderBrush = PersonValidationBorder?.BorderBrush?.CloneCurrentValue();
|
||||
UpdateResponsibleSelectionValidationState(true);
|
||||
}
|
||||
|
||||
protected override void OnInitialized(EventArgs e)
|
||||
@@ -192,5 +207,29 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user