code formatting
This commit is contained in:
1 parent
6a3711e6e0
commit
5afb569d11
43 files changed
+200
-287
No files matched your search
@@ -12,7 +12,7 @@ namespace HandyControl.Interactivity
|
||||
{
|
||||
if (parameter is DependencyObject dependencyObject)
|
||||
{
|
||||
if (Window.GetWindow(dependencyObject) is Window window)
|
||||
if (Window.GetWindow(dependencyObject) is { } window)
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace HandyControl.Interactivity
|
||||
private static ResourceManager ResourceMan;
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||
internal static ResourceManager ResourceManager => ResourceMan ?? (ResourceMan = new ResourceManager(nameof(ExceptionStringTable),
|
||||
typeof(ExceptionStringTable).Assembly));
|
||||
internal static ResourceManager ResourceManager => ResourceMan ??= new ResourceManager(nameof(ExceptionStringTable),
|
||||
typeof(ExceptionStringTable).Assembly);
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||
internal static CultureInfo Culture { get; set; }
|
||||
|
||||
@@ -490,44 +490,26 @@ namespace HandyControl.Interactivity
|
||||
var layoutSlot = LayoutInformation.GetLayoutSlot(element);
|
||||
var x = 0.0;
|
||||
var y = 0.0;
|
||||
switch (element.HorizontalAlignment)
|
||||
x = element.HorizontalAlignment switch
|
||||
{
|
||||
case HorizontalAlignment.Left:
|
||||
x = layoutSlot.Left + margin.Left;
|
||||
break;
|
||||
|
||||
case HorizontalAlignment.Center:
|
||||
x = (layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 - actualWidth / 2.0;
|
||||
break;
|
||||
|
||||
case HorizontalAlignment.Right:
|
||||
x = layoutSlot.Right - margin.Right - actualWidth;
|
||||
break;
|
||||
|
||||
case HorizontalAlignment.Stretch:
|
||||
x = Math.Max(layoutSlot.Left + margin.Left,
|
||||
(layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 - actualWidth / 2.0);
|
||||
break;
|
||||
}
|
||||
switch (element.VerticalAlignment)
|
||||
HorizontalAlignment.Left => layoutSlot.Left + margin.Left,
|
||||
HorizontalAlignment.Center => (layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 -
|
||||
actualWidth / 2.0,
|
||||
HorizontalAlignment.Right => layoutSlot.Right - margin.Right - actualWidth,
|
||||
HorizontalAlignment.Stretch => Math.Max(layoutSlot.Left + margin.Left,
|
||||
(layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 - actualWidth / 2.0),
|
||||
_ => x
|
||||
};
|
||||
y = element.VerticalAlignment switch
|
||||
{
|
||||
case VerticalAlignment.Top:
|
||||
y = layoutSlot.Top + margin.Top;
|
||||
break;
|
||||
|
||||
case VerticalAlignment.Center:
|
||||
y = (layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 - actualHeight / 2.0;
|
||||
break;
|
||||
|
||||
case VerticalAlignment.Bottom:
|
||||
y = layoutSlot.Bottom - margin.Bottom - actualHeight;
|
||||
break;
|
||||
|
||||
case VerticalAlignment.Stretch:
|
||||
y = Math.Max(layoutSlot.Top + margin.Top,
|
||||
(layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 - actualHeight / 2.0);
|
||||
break;
|
||||
}
|
||||
VerticalAlignment.Top => layoutSlot.Top + margin.Top,
|
||||
VerticalAlignment.Center => (layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 -
|
||||
actualHeight / 2.0,
|
||||
VerticalAlignment.Bottom => layoutSlot.Bottom - margin.Bottom - actualHeight,
|
||||
VerticalAlignment.Stretch => Math.Max(layoutSlot.Top + margin.Top,
|
||||
(layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 - actualHeight / 2.0),
|
||||
_ => y
|
||||
};
|
||||
return new Rect(x, y, actualWidth, actualHeight);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user