Fix ESC handling in ticket completion dropdowns
This commit is contained in:
@@ -222,6 +222,15 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool CloseDropDownIfOpen()
|
||||
{
|
||||
if (ComboBoxControl?.IsDropDownOpen != true)
|
||||
return false;
|
||||
|
||||
ComboBoxControl.IsDropDownOpen = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#region Paging Events
|
||||
|
||||
#region PageBack
|
||||
|
||||
@@ -34,6 +34,15 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
searchDelayTimer.Tick += SearchDelayTimer_Tick;
|
||||
}
|
||||
|
||||
public bool CloseDropDownIfOpen()
|
||||
{
|
||||
if (ComboBoxControl?.IsDropDownOpen != true)
|
||||
return false;
|
||||
|
||||
ComboBoxControl.IsDropDownOpen = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
@@ -2665,6 +2665,48 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
#region DropDown
|
||||
private static bool IsInsidePageable(FrameworkElement fe) => cUiElementHelper.GetFirstParentOfType<ComboBoxPageable>(fe) != null;
|
||||
|
||||
public bool TryHandleEscapeKey()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TicketSelectionPopUp?.IsOpen == true)
|
||||
{
|
||||
TicketSelectionPopUp.IsOpen = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (QuickTicketSelection?.IsDropDownOpen == true)
|
||||
{
|
||||
QuickTicketSelection.IsDropDownOpen = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CategorySelectionControl?.CloseDropDownIfOpen() == true)
|
||||
return true;
|
||||
|
||||
if (ComputerSelection?.IsDropDownOpen == true)
|
||||
{
|
||||
ComputerSelection.IsDropDownOpen = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ServiceSelectionControl?.CloseDropDownIfOpen() == true)
|
||||
return true;
|
||||
|
||||
if (TicketStatusCombobox?.IsDropDownOpen == true)
|
||||
{
|
||||
TicketStatusCombobox.IsDropDownOpen = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
if (!(sender is FrameworkElement fe)) return;
|
||||
|
||||
@@ -285,7 +285,14 @@ namespace FasdDesktopUi.Pages.TicketCompletion
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Escape:
|
||||
if (CloseCaseDialogUc?.TryHandleEscapeKey() == true)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Close_Click();
|
||||
e.Handled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user