simplify new expression

This commit is contained in:
NaBian committed 2021-06-08 20:35:14 +08:00
1 parent 42b2cb3033
commit 193090da43
59 files changed
+149 -149

No files matched your search

@@ -134,9 +134,9 @@ namespace HandyControl.Controls
set => SetValue(BorderDashOffsetProperty, value);
}
private static Size ConvertThickness2Size(Thickness th) => new Size(th.Left + th.Right, th.Top + th.Bottom);
private static Size ConvertThickness2Size(Thickness th) => new(th.Left + th.Right, th.Top + th.Bottom);
private static Rect DeflateRect(Rect rt, Thickness thick) => new Rect(rt.Left + thick.Left,
private static Rect DeflateRect(Rect rt, Thickness thick) => new(rt.Left + thick.Left,
rt.Top + thick.Top,
Math.Max(0.0, rt.Width - thick.Left - thick.Right),
Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
@@ -18,7 +18,7 @@ namespace HandyControl.Controls
private const string ElementVisualBrush = "PART_VisualBrush";
private VisualBrush _visualBrush = new VisualBrush();
private VisualBrush _visualBrush = new();
private readonly TranslateTransform _translateTransform;
@@ -40,7 +40,7 @@ namespace HandyControl.Controls
set => SetValue(VerticalOffsetProperty, value);
}
public static Magnifier Default => new Magnifier();
public static Magnifier Default => new();
public static readonly DependencyProperty ScaleProperty = DependencyProperty.Register(
"Scale", typeof(double), typeof(Magnifier), new PropertyMetadata(5.0, OnScaleChanged), ValidateHelper.IsInRangeOfPosDouble);
@@ -22,7 +22,7 @@ namespace HandyControl.Controls
private bool _added;
private readonly object _syncObj = new object();
private readonly object _syncObj = new();
private readonly int _id;
@@ -58,7 +58,7 @@ namespace HandyControl.Controls
private static int NextId;
private static readonly Dictionary<string, NotifyIcon> NotifyIconDic = new Dictionary<string, NotifyIcon>();
private static readonly Dictionary<string, NotifyIcon> NotifyIconDic = new();
static NotifyIcon()
{
@@ -383,7 +383,7 @@ namespace HandyControl.Controls
private RadioButton CreateButton(int page)
{
return new RadioButton
return new()
{
Style = ResourceHelper.GetResourceInternal<Style>(ResourceToken.PaginationButtonStyle),
Content = page.ToString()
@@ -148,7 +148,7 @@ namespace HandyControl.Controls
set => SetValue(IsOpenProperty, ValueBoxes.BooleanBox(value));
}
public static Poptip Default => new Poptip();
public static Poptip Default => new();
protected sealed override void OnTargetChanged(FrameworkElement element, bool isNew)
{