chore: use file-scoped namespace

This commit is contained in:
NaBian committed 2022-03-13 20:28:58 +08:00
1 parent 99d2fafb72
commit bbf1b7d4c6
748 files changed
+57929 -58678

No files matched your search

@@ -3,63 +3,62 @@ using System.Windows;
using System.Windows.Controls;
using HandyControl.Tools;
namespace HandyControl.Controls
namespace HandyControl.Controls;
public class RunningBorder : Border
{
public class RunningBorder : Border
private bool _test;
protected override Size MeasureOverride(Size constraint)
{
private bool _test;
protected override Size MeasureOverride(Size constraint)
if (_test)
{
if (_test)
{
_test = false;
return constraint;
}
var child = Child;
var borderThickness = BorderThickness;
var padding = Padding;
if (UseLayoutRounding)
{
var dpiScaleX = DpiHelper.DeviceDpiX;
var dpiScaleY = DpiHelper.DeviceDpiY;
borderThickness = new Thickness(
DpiHelper.RoundLayoutValue(borderThickness.Left, dpiScaleX),
DpiHelper.RoundLayoutValue(borderThickness.Top, dpiScaleY),
DpiHelper.RoundLayoutValue(borderThickness.Right, dpiScaleX),
DpiHelper.RoundLayoutValue(borderThickness.Bottom, dpiScaleY));
}
var borderSize = ConvertThickness2Size(borderThickness);
var paddingSize = ConvertThickness2Size(padding);
var mySize = new Size();
if (child != null)
{
var combined = new Size(borderSize.Width + paddingSize.Width, borderSize.Height + paddingSize.Height);
var borderConstraint = new Size(Math.Max(0.0, constraint.Width - combined.Width), Math.Max(0.0, constraint.Height - combined.Height));
var childConstraint = new Size(Math.Max(0.0, double.PositiveInfinity - combined.Width), Math.Max(0.0, double.PositiveInfinity - combined.Height));
child.Measure(borderConstraint);
var childSize = child.DesiredSize;
mySize.Width = childSize.Width + combined.Width;
mySize.Height = childSize.Height + combined.Height;
child.Measure(childConstraint);
}
else
{
mySize = new Size(borderSize.Width + paddingSize.Width, borderSize.Height + paddingSize.Height);
}
return mySize;
_test = false;
return constraint;
}
private static Size ConvertThickness2Size(Thickness th) => new(th.Left + th.Right, th.Top + th.Bottom);
var child = Child;
var borderThickness = BorderThickness;
var padding = Padding;
if (UseLayoutRounding)
{
var dpiScaleX = DpiHelper.DeviceDpiX;
var dpiScaleY = DpiHelper.DeviceDpiY;
borderThickness = new Thickness(
DpiHelper.RoundLayoutValue(borderThickness.Left, dpiScaleX),
DpiHelper.RoundLayoutValue(borderThickness.Top, dpiScaleY),
DpiHelper.RoundLayoutValue(borderThickness.Right, dpiScaleX),
DpiHelper.RoundLayoutValue(borderThickness.Bottom, dpiScaleY));
}
var borderSize = ConvertThickness2Size(borderThickness);
var paddingSize = ConvertThickness2Size(padding);
var mySize = new Size();
if (child != null)
{
var combined = new Size(borderSize.Width + paddingSize.Width, borderSize.Height + paddingSize.Height);
var borderConstraint = new Size(Math.Max(0.0, constraint.Width - combined.Width), Math.Max(0.0, constraint.Height - combined.Height));
var childConstraint = new Size(Math.Max(0.0, double.PositiveInfinity - combined.Width), Math.Max(0.0, double.PositiveInfinity - combined.Height));
child.Measure(borderConstraint);
var childSize = child.DesiredSize;
mySize.Width = childSize.Width + combined.Width;
mySize.Height = childSize.Height + combined.Height;
child.Measure(childConstraint);
}
else
{
mySize = new Size(borderSize.Width + paddingSize.Width, borderSize.Height + paddingSize.Height);
}
return mySize;
}
}
private static Size ConvertThickness2Size(Thickness th) => new(th.Left + th.Right, th.Top + th.Bottom);
}