fixed fallabschluss höhe
This commit is contained in:
@@ -18,8 +18,10 @@ namespace FasdDesktopUi.Pages.TicketCompletion
|
||||
{
|
||||
public partial class TicketCompletion : Window, IBlurInvoker, INotifyPropertyChanged
|
||||
{
|
||||
private const double MinWindowHeightDip = 220d;
|
||||
private const double WindowWorkingAreaMarginDip = 12d;
|
||||
private const double DialogNonContentReserveDip = 180d;
|
||||
private bool isUpdatingDialogBounds;
|
||||
private bool isCanceled = false;
|
||||
|
||||
private bool _WaitForClosing = false;
|
||||
@@ -53,6 +55,8 @@ namespace FasdDesktopUi.Pages.TicketCompletion
|
||||
|
||||
cFocusInvoker.GotFocus += ElementGotFocus;
|
||||
cFocusInvoker.LostFocus += ElementLostFocus;
|
||||
SizeChanged += TicketCompletion_SizeChanged;
|
||||
Loaded += TicketCompletion_Loaded;
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
@@ -67,6 +71,10 @@ namespace FasdDesktopUi.Pages.TicketCompletion
|
||||
UpdateDialogMaxHeightToScreen();
|
||||
}
|
||||
|
||||
private void TicketCompletion_Loaded(object sender, RoutedEventArgs e) => UpdateDialogMaxHeightToScreen();
|
||||
|
||||
private void TicketCompletion_SizeChanged(object sender, SizeChangedEventArgs e) => UpdateDialogMaxHeightToScreen();
|
||||
|
||||
#region ClosingBusy
|
||||
|
||||
public bool IsClosingBusy
|
||||
@@ -145,6 +153,10 @@ namespace FasdDesktopUi.Pages.TicketCompletion
|
||||
|
||||
private void UpdateDialogMaxHeightToScreen()
|
||||
{
|
||||
if (isUpdatingDialogBounds)
|
||||
return;
|
||||
|
||||
isUpdatingDialogBounds = true;
|
||||
try
|
||||
{
|
||||
WinForms.Screen screen = null;
|
||||
@@ -164,15 +176,45 @@ namespace FasdDesktopUi.Pages.TicketCompletion
|
||||
screen = screen ?? WinForms.Screen.PrimaryScreen;
|
||||
var workingArea = screen?.WorkingArea ?? WinForms.Screen.PrimaryScreen.WorkingArea;
|
||||
var dpiScaleY = VisualTreeHelper.GetDpi(this).DpiScaleY;
|
||||
var maxHeightDip = (workingArea.Height / Math.Max(0.1, dpiScaleY)) - WindowWorkingAreaMarginDip;
|
||||
var safeDpiScaleY = Math.Max(0.1, dpiScaleY);
|
||||
var workingAreaTopDip = workingArea.Top / safeDpiScaleY;
|
||||
var workingAreaBottomDip = workingArea.Bottom / safeDpiScaleY;
|
||||
var workingAreaHeightDip = workingArea.Height / safeDpiScaleY;
|
||||
var availableWindowHeightDip = workingAreaHeightDip - (WindowWorkingAreaMarginDip * 2);
|
||||
|
||||
MaxHeight = Math.Max(220, maxHeightDip);
|
||||
CloseCaseDialogUc?.SetDialogContentMaxHeight(MaxHeight - DialogNonContentReserveDip);
|
||||
MaxHeight = Math.Max(MinWindowHeightDip, availableWindowHeightDip);
|
||||
|
||||
if (!double.IsNaN(Top))
|
||||
{
|
||||
var minTop = workingAreaTopDip + WindowWorkingAreaMarginDip;
|
||||
var maxBottom = workingAreaBottomDip - WindowWorkingAreaMarginDip;
|
||||
|
||||
if (Top < minTop)
|
||||
Top = minTop;
|
||||
|
||||
var currentBottom = Top + ActualHeight;
|
||||
if (currentBottom > maxBottom)
|
||||
Top = Math.Max(minTop, maxBottom - ActualHeight);
|
||||
}
|
||||
|
||||
double nonDialogReserve = DialogNonContentReserveDip;
|
||||
if (CloseCaseDialogUc != null && CloseCaseDialogUc.IsLoaded)
|
||||
{
|
||||
var estimatedReserve = ActualHeight - CloseCaseDialogUc.ActualHeight;
|
||||
if (estimatedReserve > 0)
|
||||
nonDialogReserve = Math.Max(nonDialogReserve, estimatedReserve + WindowWorkingAreaMarginDip);
|
||||
}
|
||||
|
||||
CloseCaseDialogUc?.SetDialogContentMaxHeight(MaxHeight - nonDialogReserve);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogException(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
isUpdatingDialogBounds = false;
|
||||
}
|
||||
}
|
||||
|
||||
#region Internal Focus Events
|
||||
|
||||
Reference in New Issue
Block a user