simplify new expression
This commit is contained in:
1 parent
42b2cb3033
commit
193090da43
59 files changed
+149
-149
No files matched your search
@@ -26,8 +26,8 @@ namespace HandyControlDemo
|
||||
|
||||
GlobalShortcut.Init(new List<KeyBinding>
|
||||
{
|
||||
new KeyBinding(ViewModelLocator.Instance.Main.GlobalShortcutInfoCmd, Key.I, ModifierKeys.Control | ModifierKeys.Alt),
|
||||
new KeyBinding(ViewModelLocator.Instance.Main.GlobalShortcutWarningCmd, Key.E, ModifierKeys.Control | ModifierKeys.Alt)
|
||||
new(ViewModelLocator.Instance.Main.GlobalShortcutInfoCmd, Key.I, ModifierKeys.Control | ModifierKeys.Alt),
|
||||
new(ViewModelLocator.Instance.Main.GlobalShortcutWarningCmd, Key.E, ModifierKeys.Control | ModifierKeys.Alt)
|
||||
});
|
||||
|
||||
Dialog.SetToken(this, MessageToken.MainWindow);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace HandyControlDemo.Service
|
||||
{
|
||||
internal ObservableCollection<TabControlDemoModel> GetTabControlDemoDataList()
|
||||
{
|
||||
return new ObservableCollection<TabControlDemoModel>
|
||||
return new()
|
||||
{
|
||||
new TabControlDemoModel
|
||||
{
|
||||
@@ -139,7 +139,7 @@ namespace HandyControlDemo.Service
|
||||
|
||||
internal List<AvatarModel> GetBlogDataList()
|
||||
{
|
||||
return new List<AvatarModel>
|
||||
return new()
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
@@ -170,7 +170,7 @@ namespace HandyControlDemo.Service
|
||||
|
||||
internal List<AvatarModel> GetProjectDataList()
|
||||
{
|
||||
return new List<AvatarModel>
|
||||
return new()
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
@@ -195,7 +195,7 @@ namespace HandyControlDemo.Service
|
||||
|
||||
internal List<AvatarModel> GetWebsiteDataList()
|
||||
{
|
||||
return new List<AvatarModel>
|
||||
return new()
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
@@ -208,7 +208,7 @@ namespace HandyControlDemo.Service
|
||||
|
||||
internal ObservableCollection<CardModel> GetCardDataList()
|
||||
{
|
||||
return new ObservableCollection<CardModel>
|
||||
return new()
|
||||
{
|
||||
new CardModel
|
||||
{
|
||||
@@ -275,7 +275,7 @@ namespace HandyControlDemo.Service
|
||||
|
||||
internal CardModel GetCardData()
|
||||
{
|
||||
return new CardModel
|
||||
return new()
|
||||
{
|
||||
Content = $"/HandyControlDemo;component/Resources/Img/Album/{DateTime.Now.Second % 10 + 1}.jpg"
|
||||
};
|
||||
@@ -283,7 +283,7 @@ namespace HandyControlDemo.Service
|
||||
|
||||
internal List<StepBarDemoModel> GetStepBarDemoDataList()
|
||||
{
|
||||
return new List<StepBarDemoModel>
|
||||
return new()
|
||||
{
|
||||
new StepBarDemoModel
|
||||
{
|
||||
@@ -310,7 +310,7 @@ namespace HandyControlDemo.Service
|
||||
|
||||
internal ObservableCollection<CoverViewDemoModel> GetCoverViewDemoDataList()
|
||||
{
|
||||
return new ObservableCollection<CoverViewDemoModel>
|
||||
return new()
|
||||
{
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace HandyControlDemo.Tools
|
||||
{
|
||||
private static readonly string NameSpaceStr = typeof(AssemblyHelper).Assembly.GetName().Name;
|
||||
|
||||
private static readonly Dictionary<string, object> CacheDic = new Dictionary<string, object>();
|
||||
private static readonly Dictionary<string, object> CacheDic = new();
|
||||
|
||||
public static void Register(string name, object instance) => CacheDic[name] = instance;
|
||||
|
||||
|
||||
@@ -67,17 +67,17 @@ namespace HandyControlDemo.UserControl
|
||||
var textEditorCustomStyle = ResourceHelper.GetResource<Style>("TextEditorCustom");
|
||||
_textEditor = new Dictionary<string, TextEditor>
|
||||
{
|
||||
["XAML"] = new TextEditor
|
||||
["XAML"] = new()
|
||||
{
|
||||
Style = textEditorCustomStyle,
|
||||
SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML")
|
||||
},
|
||||
["C#"] = new TextEditor
|
||||
["C#"] = new()
|
||||
{
|
||||
Style = textEditorCustomStyle,
|
||||
SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#")
|
||||
},
|
||||
["VM"] = new TextEditor
|
||||
["VM"] = new()
|
||||
{
|
||||
Style = textEditorCustomStyle,
|
||||
SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#")
|
||||
|
||||
@@ -10,13 +10,13 @@ namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class GeometryDemoCtl
|
||||
{
|
||||
private readonly HashSet<string> _lineSet = new HashSet<string>
|
||||
private readonly HashSet<string> _lineSet = new()
|
||||
{
|
||||
"CheckedGeometry"
|
||||
};
|
||||
|
||||
public ObservableCollection<GeometryItemModel> GeometryItems { get; set; } =
|
||||
new ObservableCollection<GeometryItemModel>();
|
||||
new();
|
||||
|
||||
public GeometryDemoCtl()
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace HandyControlDemo.ViewModel
|
||||
#endif
|
||||
}
|
||||
|
||||
public ObservableCollection<ChatInfoModel> ChatInfos { get; set; } = new ObservableCollection<ChatInfoModel>();
|
||||
public ObservableCollection<ChatInfoModel> ChatInfos { get; set; } = new();
|
||||
|
||||
public RelayCommand<KeyEventArgs> SendStringCmd => new Lazy<RelayCommand<KeyEventArgs>>(() =>
|
||||
new RelayCommand<KeyEventArgs>(SendString)).Value;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public WindowDemoViewModel WindowDemo => SimpleIoc.Default.GetInstance<WindowDemoViewModel>();
|
||||
|
||||
public ItemsDisplayViewModel ContributorsView => new ItemsDisplayViewModel(SimpleIoc.Default.GetInstance<DataService>().GetContributorDataList);
|
||||
public ItemsDisplayViewModel ContributorsView => new(SimpleIoc.Default.GetInstance<DataService>().GetContributorDataList);
|
||||
|
||||
public ItemsDisplayViewModel BlogsView => SimpleIoc.Default.GetInstance<ItemsDisplayViewModel>("Blogs");
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public PaginationDemoViewModel PaginationDemo => SimpleIoc.Default.GetInstance<PaginationDemoViewModel>();
|
||||
|
||||
public ChatBoxViewModel ChatBox => new ChatBoxViewModel();
|
||||
public ChatBoxViewModel ChatBox => new();
|
||||
|
||||
public CoverViewModel CoverView => SimpleIoc.Default.GetInstance<CoverViewModel>();
|
||||
|
||||
@@ -86,11 +86,11 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public SideMenuDemoViewModel SideMenuDemo => SimpleIoc.Default.GetInstance<SideMenuDemoViewModel>();
|
||||
|
||||
public TabControlDemoViewModel TabControlDemo => new TabControlDemoViewModel(SimpleIoc.Default.GetInstance<DataService>());
|
||||
public TabControlDemoViewModel TabControlDemo => new(SimpleIoc.Default.GetInstance<DataService>());
|
||||
|
||||
public NonClientAreaViewModel NoUser => SimpleIoc.Default.GetInstance<NonClientAreaViewModel>();
|
||||
|
||||
public CardDemoViewModel CardDemo => new CardDemoViewModel(SimpleIoc.Default.GetInstance<DataService>());
|
||||
public CardDemoViewModel CardDemo => new(SimpleIoc.Default.GetInstance<DataService>());
|
||||
|
||||
public SpriteDemoViewModel SpriteDemo => SimpleIoc.Default.GetInstance<SpriteDemoViewModel>();
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public SplitButtonDemoViewModel SplitButtonDemo => SimpleIoc.Default.GetInstance<SplitButtonDemoViewModel>();
|
||||
|
||||
public TagDemoViewModel TagDemo => new TagDemoViewModel(SimpleIoc.Default.GetInstance<DataService>());
|
||||
public TagDemoViewModel TagDemo => new(SimpleIoc.Default.GetInstance<DataService>());
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace HandyControl.Collections
|
||||
[Serializable]
|
||||
public class ManualObservableCollection<T> : Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged
|
||||
{
|
||||
private readonly SimpleMonitor _monitor = new SimpleMonitor();
|
||||
private readonly SimpleMonitor _monitor = new();
|
||||
|
||||
private const string CountString = "Count";
|
||||
|
||||
|
||||
@@ -60,6 +60,6 @@ namespace HandyControl.Controls
|
||||
return mySize;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -44,9 +44,9 @@ namespace HandyControl.Controls
|
||||
|
||||
private DispatcherTimer _updateTimer;
|
||||
|
||||
private readonly List<double> _widthList = new List<double>();
|
||||
private readonly List<double> _widthList = new();
|
||||
|
||||
private readonly Dictionary<object, CarouselItem> _entryDic = new Dictionary<object, CarouselItem>();
|
||||
private readonly Dictionary<object, CarouselItem> _entryDic = new();
|
||||
|
||||
private bool _isRefresh;
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 预设的颜色(一共18个,两行)
|
||||
/// </summary>
|
||||
private readonly List<string> _colorPresetList = new List<string>
|
||||
private readonly List<string> _colorPresetList = new()
|
||||
{
|
||||
"#f44336",
|
||||
"#e91e63",
|
||||
@@ -127,7 +127,7 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 颜色范围集合
|
||||
/// </summary>
|
||||
private readonly List<ColorRange> _colorRangeList = new List<ColorRange>
|
||||
private readonly List<ColorRange> _colorRangeList = new()
|
||||
{
|
||||
new ColorRange
|
||||
{
|
||||
@@ -164,7 +164,7 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 颜色分隔集合
|
||||
/// </summary>
|
||||
private readonly List<Color> _colorSeparateList = new List<Color>
|
||||
private readonly List<Color> _colorSeparateList = new()
|
||||
{
|
||||
Color.FromRgb(255, 0, 0),
|
||||
Color.FromRgb(255, 0, 255),
|
||||
|
||||
@@ -69,12 +69,12 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 存储所有的内容
|
||||
/// </summary>
|
||||
private readonly Dictionary<int, object> _contentDic = new Dictionary<int, object>();
|
||||
private readonly Dictionary<int, object> _contentDic = new();
|
||||
|
||||
/// <summary>
|
||||
/// 当前在显示范围内的项
|
||||
/// </summary>
|
||||
private readonly Dictionary<int, CoverFlowItem> _itemShowDic = new Dictionary<int, CoverFlowItem>();
|
||||
private readonly Dictionary<int, CoverFlowItem> _itemShowDic = new();
|
||||
|
||||
/// <summary>
|
||||
/// 相机
|
||||
|
||||
@@ -72,12 +72,12 @@ namespace HandyControl.Controls
|
||||
|
||||
var textureCoordinates = new PointCollection
|
||||
{
|
||||
new Point(0, 1),
|
||||
new Point(1, 1),
|
||||
new Point(1, 0),
|
||||
new Point(0, 0),
|
||||
new Point(1, 0),
|
||||
new Point(1, 1)
|
||||
new(0, 1),
|
||||
new(1, 1),
|
||||
new(1, 0),
|
||||
new(0, 0),
|
||||
new(1, 0),
|
||||
new(1, 1)
|
||||
};
|
||||
|
||||
var normals = new Vector3DCollection
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace HandyControl.Controls
|
||||
|
||||
private IEnumerable _itemsSourceInternal;
|
||||
|
||||
private readonly Dictionary<object, CoverViewItem> _entryDic = new Dictionary<object, CoverViewItem>();
|
||||
private readonly Dictionary<object, CoverViewItem> _entryDic = new();
|
||||
|
||||
private bool _isRefresh;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace HandyControl.Controls
|
||||
|
||||
private AdornerContainer _container;
|
||||
|
||||
private static readonly Dictionary<string, FrameworkElement> ContainerDic = new Dictionary<string, FrameworkElement>();
|
||||
private static readonly Dictionary<string, FrameworkElement> ContainerDic = new();
|
||||
|
||||
public static readonly DependencyProperty IsClosedProperty = DependencyProperty.Register(
|
||||
"IsClosed", typeof(bool), typeof(Dialog), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
@@ -19,9 +19,9 @@ namespace HandyControl.Controls
|
||||
{
|
||||
public class GifImage : Image, IDisposable
|
||||
{
|
||||
private static readonly Guid GifGuid = new Guid("{b96b3caa-0728-11d3-9d7b-0000f81ef32e}");
|
||||
private static readonly Guid GifGuid = new("{b96b3caa-0728-11d3-9d7b-0000f81ef32e}");
|
||||
|
||||
private static readonly Guid GifSingleFrameGuid = new Guid("{b96b3cb0-0728-11d3-9d7b-0000f81ef32e}");
|
||||
private static readonly Guid GifSingleFrameGuid = new("{b96b3cb0-0728-11d3-9d7b-0000f81ef32e}");
|
||||
|
||||
internal IntPtr NativeImage;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 图片保存对话框
|
||||
/// </summary>
|
||||
private static readonly SaveFileDialog SaveFileDialog = new SaveFileDialog
|
||||
private static readonly SaveFileDialog SaveFileDialog = new()
|
||||
{
|
||||
Filter = $"{Lang.PngImg}|*.png"
|
||||
};
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace HandyControl.Controls
|
||||
"DotDelayTime", typeof(double), typeof(LoadingBase),
|
||||
new FrameworkPropertyMetadata(80.0, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
protected readonly Canvas PrivateCanvas = new Canvas
|
||||
protected readonly Canvas PrivateCanvas = new()
|
||||
{
|
||||
ClipToBounds = true
|
||||
};
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace HandyControl.Controls
|
||||
|
||||
private int _lineCount;
|
||||
|
||||
private readonly List<FlexItemInfo> _orderList = new List<FlexItemInfo>();
|
||||
private readonly List<FlexItemInfo> _orderList = new();
|
||||
|
||||
#region Item
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace HandyControl.Controls
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.SortByName, SortByName, (s, e) => e.CanExecute = ShowSortButton));
|
||||
}
|
||||
|
||||
public virtual PropertyResolver PropertyResolver { get; } = new PropertyResolver();
|
||||
public virtual PropertyResolver PropertyResolver { get; } = new();
|
||||
|
||||
public static readonly RoutedEvent SelectedObjectChangedEvent =
|
||||
EventManager.RegisterRoutedEvent("SelectedObjectChanged", RoutingStrategy.Bubble,
|
||||
@@ -181,7 +181,7 @@ namespace HandyControl.Controls
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual PropertyItem CreatePropertyItem(PropertyDescriptor propertyDescriptor) => new PropertyItem
|
||||
protected virtual PropertyItem CreatePropertyItem(PropertyDescriptor propertyDescriptor) => new()
|
||||
{
|
||||
Category = PropertyResolver.ResolveCategory(propertyDescriptor),
|
||||
DisplayName = PropertyResolver.ResolveDisplayName(propertyDescriptor),
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace HandyControl.Controls
|
||||
{
|
||||
public class PropertyResolver
|
||||
{
|
||||
private static readonly Dictionary<Type, EditorTypeCode> TypeCodeDic = new Dictionary<Type, EditorTypeCode>
|
||||
private static readonly Dictionary<Type, EditorTypeCode> TypeCodeDic = new()
|
||||
{
|
||||
[typeof(string)] = EditorTypeCode.PlainText,
|
||||
[typeof(sbyte)] = EditorTypeCode.SByteNumber,
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace HandyControl.Controls
|
||||
|
||||
private BitmapSource _imageSource;
|
||||
|
||||
private static readonly Guid BmpGuid = new Guid("{b96b3cab-0728-11d3-9d7b-0000f81ef32e}");
|
||||
private static readonly Guid BmpGuid = new("{b96b3cab-0728-11d3-9d7b-0000f81ef32e}");
|
||||
|
||||
#region const
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 选项卡字典
|
||||
/// </summary>
|
||||
internal Dictionary<int, TabItem> ItemDic = new Dictionary<int, TabItem>();
|
||||
internal Dictionary<int, TabItem> ItemDic = new();
|
||||
|
||||
public static readonly DependencyPropertyKey FluidMoveDurationPropertyKey =
|
||||
DependencyProperty.RegisterReadOnly("FluidMoveDuration", typeof(Duration), typeof(TabPanel),
|
||||
|
||||
@@ -240,10 +240,10 @@ namespace HandyControl.Controls
|
||||
|
||||
var positions = new Point3DCollection
|
||||
{
|
||||
new Point3D(-quarterWidth * flag, quarterHeight, 0),
|
||||
new Point3D(-quarterWidth * flag, 0, 0),
|
||||
new Point3D(quarterWidth * flag, 0, 0),
|
||||
new Point3D(quarterWidth * flag, quarterHeight, 0)
|
||||
new(-quarterWidth * flag, quarterHeight, 0),
|
||||
new(-quarterWidth * flag, 0, 0),
|
||||
new(quarterWidth * flag, 0, 0),
|
||||
new(quarterWidth * flag, quarterHeight, 0)
|
||||
};
|
||||
|
||||
var triangleIndices = new Int32Collection
|
||||
@@ -258,10 +258,10 @@ namespace HandyControl.Controls
|
||||
|
||||
var textureCoordinates = new PointCollection
|
||||
{
|
||||
new Point(0, 0),
|
||||
new Point(0, 1),
|
||||
new Point(1, 1),
|
||||
new Point(1, 0)
|
||||
new(0, 0),
|
||||
new(0, 1),
|
||||
new(1, 1),
|
||||
new(1, 0)
|
||||
};
|
||||
|
||||
var geometry3D = new MeshGeometry3D
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 刻度集合
|
||||
/// </summary>
|
||||
private readonly List<SpeTextBlock> _speBlockList = new List<SpeTextBlock>();
|
||||
private readonly List<SpeTextBlock> _speBlockList = new();
|
||||
|
||||
/// <summary>
|
||||
/// 初始化时时间
|
||||
@@ -160,7 +160,7 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 时间段集合
|
||||
/// </summary>
|
||||
private readonly List<int> _timeSpeList = new List<int>
|
||||
private readonly List<int> _timeSpeList = new()
|
||||
{
|
||||
7200000,
|
||||
3600000,
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace HandyControl.Controls
|
||||
|
||||
private const string ElementItemsSelected = "PART_ItemsSelected";
|
||||
|
||||
private readonly Dictionary<object, TransferEntry> _entryDic = new Dictionary<object, TransferEntry>();
|
||||
private readonly Dictionary<object, TransferEntry> _entryDic = new();
|
||||
|
||||
private readonly List<TransferEntry> _entryList = new List<TransferEntry>();
|
||||
private readonly List<TransferEntry> _entryList = new();
|
||||
|
||||
private SimpleItemsControl _itemsOrigin;
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace HandyControl.Data
|
||||
|
||||
public Guid Guid { get; }
|
||||
|
||||
public static GifFrameDimension Time { get; } = new GifFrameDimension(new Guid("{6aedbd6d-3fb5-418a-83a6-7f45229dc872}"));
|
||||
public static GifFrameDimension Time { get; } = new(new Guid("{6aedbd6d-3fb5-418a-83a6-7f45229dc872}"));
|
||||
|
||||
public static GifFrameDimension Resolution { get; } = new GifFrameDimension(new Guid("{84236f7b-3bd3-428f-8dab-4ea1439ca315}"));
|
||||
public static GifFrameDimension Resolution { get; } = new(new Guid("{84236f7b-3bd3-428f-8dab-4ea1439ca315}"));
|
||||
|
||||
public static GifFrameDimension Page { get; } = new GifFrameDimension(new Guid("{7462dc86-6180-4c7e-8e3f-ee7333a7a483}"));
|
||||
public static GifFrameDimension Page { get; } = new(new Guid("{7462dc86-6180-4c7e-8e3f-ee7333a7a483}"));
|
||||
|
||||
public override bool Equals(object o) => o is GifFrameDimension format && Guid == format.Guid;
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ namespace HandyControl.Data
|
||||
{
|
||||
public readonly struct SystemVersionInfo
|
||||
{
|
||||
public static SystemVersionInfo Windows10 => new SystemVersionInfo(10, 0, 10240);
|
||||
public static SystemVersionInfo Windows10 => new(10, 0, 10240);
|
||||
|
||||
public static SystemVersionInfo Windows10_1809 => new SystemVersionInfo(10, 0, 17763);
|
||||
public static SystemVersionInfo Windows10_1809 => new(10, 0, 17763);
|
||||
|
||||
public static SystemVersionInfo Windows10_1903 => new SystemVersionInfo(10, 0, 18362);
|
||||
public static SystemVersionInfo Windows10_1903 => new(10, 0, 18362);
|
||||
|
||||
public SystemVersionInfo(int major, int minor, int build)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
public static OperationResult<bool> Failed(string message = "")
|
||||
{
|
||||
return new OperationResult<bool>
|
||||
return new()
|
||||
{
|
||||
ResultType = ResultType.Failed,
|
||||
Message = message,
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
public static OperationResult<bool> Success(string message = "")
|
||||
{
|
||||
return new OperationResult<bool>
|
||||
return new()
|
||||
{
|
||||
ResultType = ResultType.Success,
|
||||
Message = message,
|
||||
|
||||
@@ -15,36 +15,36 @@ namespace HandyControl.Expression.Drawing
|
||||
|
||||
internal static Rect Bounds(this Size size)
|
||||
{
|
||||
return new Rect(0.0, 0.0, size.Width, size.Height);
|
||||
return new(0.0, 0.0, size.Width, size.Height);
|
||||
}
|
||||
|
||||
internal static Point Center(this Rect rect)
|
||||
{
|
||||
return new Point(rect.X + rect.Width / 2.0, rect.Y + rect.Height / 2.0);
|
||||
return new(rect.X + rect.Width / 2.0, rect.Y + rect.Height / 2.0);
|
||||
}
|
||||
|
||||
internal static Vector Subtract(this Point lhs, Point rhs)
|
||||
{
|
||||
return new Vector(lhs.X - rhs.X, lhs.Y - rhs.Y);
|
||||
return new(lhs.X - rhs.X, lhs.Y - rhs.Y);
|
||||
}
|
||||
|
||||
internal static Thickness Subtract(this Rect lhs, Rect rhs)
|
||||
{
|
||||
return new Thickness(rhs.Left - lhs.Left,
|
||||
return new(rhs.Left - lhs.Left,
|
||||
rhs.Top - lhs.Top, lhs.Right - rhs.Right,
|
||||
lhs.Bottom - rhs.Bottom);
|
||||
}
|
||||
|
||||
internal static Point Lerp(Point pointA, Point pointB, double alpha)
|
||||
{
|
||||
return new Point(
|
||||
return new(
|
||||
MathHelper.Lerp(pointA.X, pointB.X, alpha),
|
||||
MathHelper.Lerp(pointA.Y, pointB.Y, alpha));
|
||||
}
|
||||
|
||||
internal static Vector Lerp(Vector vectorA, Vector vectorB, double alpha)
|
||||
{
|
||||
return new Vector(MathHelper.Lerp(vectorA.X, vectorB.X, alpha),
|
||||
return new(MathHelper.Lerp(vectorA.X, vectorB.X, alpha),
|
||||
MathHelper.Lerp(vectorA.Y, vectorB.Y, alpha));
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace HandyControl.Expression.Drawing
|
||||
|
||||
internal static Point RelativeToAbsolutePoint(Rect bound, Point relative)
|
||||
{
|
||||
return new Point(bound.X + relative.X * bound.Width, bound.Y + relative.Y * bound.Height);
|
||||
return new(bound.X + relative.X * bound.Width, bound.Y + relative.Y * bound.Height);
|
||||
}
|
||||
|
||||
internal static double SquaredDistance(Point lhs, Point rhs)
|
||||
@@ -119,7 +119,7 @@ namespace HandyControl.Expression.Drawing
|
||||
|
||||
internal static Point Midpoint(Point lhs, Point rhs)
|
||||
{
|
||||
return new Point((lhs.X + rhs.X) / 2.0, (lhs.Y + rhs.Y) / 2.0);
|
||||
return new((lhs.X + rhs.X) / 2.0, (lhs.Y + rhs.Y) / 2.0);
|
||||
}
|
||||
|
||||
internal static bool HasValidArea(this Size size)
|
||||
@@ -166,12 +166,12 @@ namespace HandyControl.Expression.Drawing
|
||||
|
||||
internal static Point Plus(this Point lhs, Point rhs)
|
||||
{
|
||||
return new Point(lhs.X + rhs.X, lhs.Y + rhs.Y);
|
||||
return new(lhs.X + rhs.X, lhs.Y + rhs.Y);
|
||||
}
|
||||
|
||||
internal static Point Minus(this Point lhs, Point rhs)
|
||||
{
|
||||
return new Point(lhs.X - rhs.X, lhs.Y - rhs.Y);
|
||||
return new(lhs.X - rhs.X, lhs.Y - rhs.Y);
|
||||
}
|
||||
|
||||
internal static Vector Normal(Point lhs, Point rhs)
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace HandyControl.Expression.Media
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private static Size GetArcSize(Rect bound)
|
||||
{
|
||||
return new Size(bound.Width / 2.0, bound.Height / 2.0);
|
||||
return new(bound.Width / 2.0, bound.Height / 2.0);
|
||||
}
|
||||
|
||||
private static void IncreaseDuplicatedIndex(IList<double> values, ref int index)
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace HandyControl.Expression.Shapes
|
||||
|
||||
protected abstract IGeometrySource CreateGeometrySource();
|
||||
|
||||
protected override Size MeasureOverride(Size availableSize) => new Size(base.StrokeThickness, base.StrokeThickness);
|
||||
protected override Size MeasureOverride(Size availableSize) => new(base.StrokeThickness, base.StrokeThickness);
|
||||
|
||||
private void RealizeGeometry() => RenderedGeometryChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace HandyControl.Interactivity
|
||||
new PropertyMetadata(null));
|
||||
|
||||
private static readonly Dictionary<object, Storyboard> TransitionStoryboardDictionary =
|
||||
new Dictionary<object, Storyboard>();
|
||||
new();
|
||||
|
||||
public Duration Duration
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace HandyControl.Interactivity
|
||||
|
||||
private static DateTime NextToLastPurgeTick = DateTime.MinValue;
|
||||
|
||||
internal static Dictionary<object, TagData> TagDictionary = new Dictionary<object, TagData>();
|
||||
internal static Dictionary<object, TagData> TagDictionary = new();
|
||||
|
||||
public static readonly DependencyProperty TagPathProperty = DependencyProperty.Register("TagPath",
|
||||
typeof(string), typeof(FluidMoveBehaviorBase), new PropertyMetadata(string.Empty));
|
||||
|
||||
@@ -10,176 +10,176 @@ namespace HandyControl.Interactivity
|
||||
/// <summary>
|
||||
/// 搜索
|
||||
/// </summary>
|
||||
public static RoutedCommand Search { get; } = new RoutedCommand(nameof(Search), typeof(ControlCommands));
|
||||
public static RoutedCommand Search { get; } = new(nameof(Search), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 清除
|
||||
/// </summary>
|
||||
public static RoutedCommand Clear { get; } = new RoutedCommand(nameof(Clear), typeof(ControlCommands));
|
||||
public static RoutedCommand Clear { get; } = new(nameof(Clear), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 切换
|
||||
/// </summary>
|
||||
public static RoutedCommand Switch { get; } = new RoutedCommand(nameof(Switch), typeof(ControlCommands));
|
||||
public static RoutedCommand Switch { get; } = new(nameof(Switch), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 右转
|
||||
/// </summary>
|
||||
public static RoutedCommand RotateRight { get; } = new RoutedCommand(nameof(RotateRight), typeof(ControlCommands));
|
||||
public static RoutedCommand RotateRight { get; } = new(nameof(RotateRight), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 左转
|
||||
/// </summary>
|
||||
public static RoutedCommand RotateLeft { get; } = new RoutedCommand(nameof(RotateLeft), typeof(ControlCommands));
|
||||
public static RoutedCommand RotateLeft { get; } = new(nameof(RotateLeft), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 小
|
||||
/// </summary>
|
||||
public static RoutedCommand Reduce { get; } = new RoutedCommand(nameof(Reduce), typeof(ControlCommands));
|
||||
public static RoutedCommand Reduce { get; } = new(nameof(Reduce), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 大
|
||||
/// </summary>
|
||||
public static RoutedCommand Enlarge { get; } = new RoutedCommand(nameof(Enlarge), typeof(ControlCommands));
|
||||
public static RoutedCommand Enlarge { get; } = new(nameof(Enlarge), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 还原
|
||||
/// </summary>
|
||||
public static RoutedCommand Restore { get; } = new RoutedCommand(nameof(Restore), typeof(ControlCommands));
|
||||
public static RoutedCommand Restore { get; } = new(nameof(Restore), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 打开
|
||||
/// </summary>
|
||||
public static RoutedCommand Open { get; } = new RoutedCommand(nameof(Open), typeof(ControlCommands));
|
||||
public static RoutedCommand Open { get; } = new(nameof(Open), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
public static RoutedCommand Save { get; } = new RoutedCommand(nameof(Save), typeof(ControlCommands));
|
||||
public static RoutedCommand Save { get; } = new(nameof(Save), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 选中
|
||||
/// </summary>
|
||||
public static RoutedCommand Selected { get; } = new RoutedCommand(nameof(Selected), typeof(ControlCommands));
|
||||
public static RoutedCommand Selected { get; } = new(nameof(Selected), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 关闭
|
||||
/// </summary>
|
||||
public static RoutedCommand Close { get; } = new RoutedCommand(nameof(Close), typeof(ControlCommands));
|
||||
public static RoutedCommand Close { get; } = new(nameof(Close), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 取消
|
||||
/// </summary>
|
||||
public static RoutedCommand Cancel { get; } = new RoutedCommand(nameof(Cancel), typeof(ControlCommands));
|
||||
public static RoutedCommand Cancel { get; } = new(nameof(Cancel), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 确定
|
||||
/// </summary>
|
||||
public static RoutedCommand Confirm { get; } = new RoutedCommand(nameof(Confirm), typeof(ControlCommands));
|
||||
public static RoutedCommand Confirm { get; } = new(nameof(Confirm), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 是
|
||||
/// </summary>
|
||||
public static RoutedCommand Yes { get; } = new RoutedCommand(nameof(Yes), typeof(ControlCommands));
|
||||
public static RoutedCommand Yes { get; } = new(nameof(Yes), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 否
|
||||
/// </summary>
|
||||
public static RoutedCommand No { get; } = new RoutedCommand(nameof(No), typeof(ControlCommands));
|
||||
public static RoutedCommand No { get; } = new(nameof(No), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 关闭所有
|
||||
/// </summary>
|
||||
public static RoutedCommand CloseAll { get; } = new RoutedCommand(nameof(CloseAll), typeof(ControlCommands));
|
||||
public static RoutedCommand CloseAll { get; } = new(nameof(CloseAll), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 关闭其他
|
||||
/// </summary>
|
||||
public static RoutedCommand CloseOther { get; } = new RoutedCommand(nameof(CloseOther), typeof(ControlCommands));
|
||||
public static RoutedCommand CloseOther { get; } = new(nameof(CloseOther), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 上一个
|
||||
/// </summary>
|
||||
public static RoutedCommand Prev { get; } = new RoutedCommand(nameof(Prev), typeof(ControlCommands));
|
||||
public static RoutedCommand Prev { get; } = new(nameof(Prev), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 下一个
|
||||
/// </summary>
|
||||
public static RoutedCommand Next { get; } = new RoutedCommand(nameof(Next), typeof(ControlCommands));
|
||||
public static RoutedCommand Next { get; } = new(nameof(Next), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 跳转
|
||||
/// </summary>
|
||||
public static RoutedCommand Jump { get; } = new RoutedCommand(nameof(Jump), typeof(ControlCommands));
|
||||
public static RoutedCommand Jump { get; } = new(nameof(Jump), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 上午
|
||||
/// </summary>
|
||||
public static RoutedCommand Am { get; } = new RoutedCommand(nameof(Am), typeof(ControlCommands));
|
||||
public static RoutedCommand Am { get; } = new(nameof(Am), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 下午
|
||||
/// </summary>
|
||||
public static RoutedCommand Pm { get; } = new RoutedCommand(nameof(Pm), typeof(ControlCommands));
|
||||
public static RoutedCommand Pm { get; } = new(nameof(Pm), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 确认
|
||||
/// </summary>
|
||||
public static RoutedCommand Sure { get; } = new RoutedCommand(nameof(Sure), typeof(ControlCommands));
|
||||
public static RoutedCommand Sure { get; } = new(nameof(Sure), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 小时改变
|
||||
/// </summary>
|
||||
public static RoutedCommand HourChange { get; } = new RoutedCommand(nameof(HourChange), typeof(ControlCommands));
|
||||
public static RoutedCommand HourChange { get; } = new(nameof(HourChange), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 分钟改变
|
||||
/// </summary>
|
||||
public static RoutedCommand MinuteChange { get; } = new RoutedCommand(nameof(MinuteChange), typeof(ControlCommands));
|
||||
public static RoutedCommand MinuteChange { get; } = new(nameof(MinuteChange), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 秒改变
|
||||
/// </summary>
|
||||
public static RoutedCommand SecondChange { get; } = new RoutedCommand(nameof(SecondChange), typeof(ControlCommands));
|
||||
public static RoutedCommand SecondChange { get; } = new(nameof(SecondChange), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标移动
|
||||
/// </summary>
|
||||
public static RoutedCommand MouseMove { get; } = new RoutedCommand(nameof(MouseMove), typeof(ControlCommands));
|
||||
public static RoutedCommand MouseMove { get; } = new(nameof(MouseMove), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 打开链接
|
||||
/// </summary>
|
||||
public static OpenLinkCommand OpenLink { get; } = new OpenLinkCommand();
|
||||
public static OpenLinkCommand OpenLink { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 关闭程序
|
||||
/// </summary>
|
||||
public static ShutdownAppCommand ShutdownApp { get; } = new ShutdownAppCommand();
|
||||
public static ShutdownAppCommand ShutdownApp { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 前置主窗口
|
||||
/// </summary>
|
||||
public static PushMainWindow2TopCommand PushMainWindow2Top { get; } = new PushMainWindow2TopCommand();
|
||||
public static PushMainWindow2TopCommand PushMainWindow2Top { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 关闭窗口
|
||||
/// </summary>
|
||||
public static CloseWindowCommand CloseWindow { get; } = new CloseWindowCommand();
|
||||
public static CloseWindowCommand CloseWindow { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 开始截图
|
||||
/// </summary>
|
||||
public static StartScreenshotCommand StartScreenshot { get; } = new StartScreenshotCommand();
|
||||
public static StartScreenshotCommand StartScreenshot { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 按照类别排序
|
||||
/// </summary>
|
||||
public static RoutedCommand SortByCategory { get; } = new RoutedCommand(nameof(SortByCategory), typeof(ControlCommands));
|
||||
public static RoutedCommand SortByCategory { get; } = new(nameof(SortByCategory), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 按照名称排序
|
||||
/// </summary>
|
||||
public static RoutedCommand SortByName { get; } = new RoutedCommand(nameof(SortByName), typeof(ControlCommands));
|
||||
public static RoutedCommand SortByName { get; } = new(nameof(SortByName), typeof(ControlCommands));
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@ namespace HandyControl.Media.Animation
|
||||
return AnimationHelper.ComposeGeometry(Strings, currentIterationValue);
|
||||
}
|
||||
|
||||
protected sealed override Duration GetNaturalDurationCore(Clock clock) => new Duration(LargestTimeSpanKeyTime);
|
||||
protected sealed override Duration GetNaturalDurationCore(Clock clock) => new(LargestTimeSpanKeyTime);
|
||||
|
||||
IList IKeyFrameAnimation.KeyFrames
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace HandyControl.Themes
|
||||
{
|
||||
public class SharedResourceDictionary : ResourceDictionary
|
||||
{
|
||||
public static Dictionary<Uri, ResourceDictionary> SharedDictionaries = new Dictionary<Uri, ResourceDictionary>();
|
||||
public static Dictionary<Uri, ResourceDictionary> SharedDictionaries = new();
|
||||
|
||||
private Uri _sourceUri;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HandyControl.Tools.Converter
|
||||
{
|
||||
Figures = new PathFigureCollection
|
||||
{
|
||||
new PathFigure(new Point(radius.TopLeft, 0), new PathSegment[]
|
||||
new(new Point(radius.TopLeft, 0), new PathSegment[]
|
||||
{
|
||||
new LineSegment(new Point(width - radius.TopRight, 0), false),
|
||||
new ArcSegment(new Point(width, radius.TopRight), new Size(radius.TopRight, radius.TopRight), 90, false, SweepDirection.Clockwise, false),
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace HandyControl.Tools.Extension
|
||||
/// <returns></returns>
|
||||
public static int ToInt32Reverse(this Color color) => color.R | color.G << 8 | color.B << 18;
|
||||
|
||||
internal static List<byte> ToList(this Color color) => new List<byte>
|
||||
internal static List<byte> ToList(this Color color) => new()
|
||||
{
|
||||
color.R,
|
||||
color.G,
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace HandyControl.Tools.Extension
|
||||
{
|
||||
public static class ValueExtension
|
||||
{
|
||||
public static Thickness Add(this Thickness a, Thickness b) => new Thickness(a.Left + b.Left, a.Top + b.Top, a.Right + b.Right, a.Bottom + b.Bottom);
|
||||
public static Thickness Add(this Thickness a, Thickness b) => new(a.Left + b.Left, a.Top + b.Top, a.Right + b.Right, a.Bottom + b.Bottom);
|
||||
|
||||
public static bool IsZero(this Thickness thickness) =>
|
||||
MathHelper.IsZero(thickness.Left)
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
public class ComparerGenerator
|
||||
{
|
||||
private static readonly Dictionary<Type, ComparerTypeCode> TypeCodeDic = new Dictionary<Type, ComparerTypeCode>
|
||||
private static readonly Dictionary<Type, ComparerTypeCode> TypeCodeDic = new()
|
||||
{
|
||||
[typeof(DateTimeRange)] = ComparerTypeCode.DateTimeRange,
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
private static List<GifImageInfo> ImageInfoList;
|
||||
|
||||
private static readonly ReaderWriterLock RwImgListLock = new ReaderWriterLock();
|
||||
private static readonly ReaderWriterLock RwImgListLock = new();
|
||||
|
||||
private static Thread AnimationThread;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
private static ObservableCollection<KeyBinding> KeyBindingCollection;
|
||||
|
||||
private static readonly Dictionary<string, KeyBinding> CommandDic = new Dictionary<string, KeyBinding>();
|
||||
private static readonly Dictionary<string, KeyBinding> CommandDic = new();
|
||||
|
||||
private static void KeyboardHook_KeyDown(object sender, KeyboardHookEventArgs e) => HitTest(e.Key);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HandyControl.Tools
|
||||
/// <returns></returns>
|
||||
public static ThicknessAnimation CreateAnimation(Thickness thickness = default, double milliseconds = 200)
|
||||
{
|
||||
return new ThicknessAnimation(thickness, new Duration(TimeSpan.FromMilliseconds(milliseconds)))
|
||||
return new(thickness, new Duration(TimeSpan.FromMilliseconds(milliseconds)))
|
||||
{
|
||||
EasingFunction = new PowerEase { EasingMode = EasingMode.EaseInOut }
|
||||
};
|
||||
@@ -35,7 +35,7 @@ namespace HandyControl.Tools
|
||||
/// <returns></returns>
|
||||
public static DoubleAnimation CreateAnimation(double toValue, double milliseconds = 200)
|
||||
{
|
||||
return new DoubleAnimation(toValue, new Duration(TimeSpan.FromMilliseconds(milliseconds)))
|
||||
return new(toValue, new Duration(TimeSpan.FromMilliseconds(milliseconds)))
|
||||
{
|
||||
EasingFunction = new PowerEase { EasingMode = EasingMode.EaseInOut }
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace HandyControl.Tools
|
||||
/// </summary>
|
||||
public class SingleOpenHelper
|
||||
{
|
||||
private static readonly Dictionary<string, ISingleOpen> OpenDic = new Dictionary<string, ISingleOpen>();
|
||||
private static readonly Dictionary<string, ISingleOpen> OpenDic = new();
|
||||
|
||||
/// <summary>
|
||||
/// 根据指定的类型创建实例
|
||||
|
||||
@@ -20,13 +20,13 @@ namespace HandyControl.Tools
|
||||
/// <returns></returns>
|
||||
public static Window GetActiveWindow() => Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive);
|
||||
|
||||
private static readonly BitArray _cacheValid = new BitArray((int) InteropValues.CacheSlot.NumSlots);
|
||||
private static readonly BitArray _cacheValid = new((int) InteropValues.CacheSlot.NumSlots);
|
||||
|
||||
private static bool _setDpiX = true;
|
||||
|
||||
private static bool _dpiInitialized;
|
||||
|
||||
private static readonly object _dpiLock = new object();
|
||||
private static readonly object _dpiLock = new();
|
||||
|
||||
private static int _dpi;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
public class SystemMenuHook
|
||||
{
|
||||
private static readonly Dictionary<int, HwndSource> DataDic = new Dictionary<int, HwndSource>();
|
||||
private static readonly Dictionary<int, HwndSource> DataDic = new();
|
||||
|
||||
public static event Action<int> Click;
|
||||
|
||||
|
||||
@@ -30,13 +30,13 @@ namespace HandyControl.Tools.Interop
|
||||
[SecurityCritical]
|
||||
internal HandleRef MakeHandleRef(object obj)
|
||||
{
|
||||
return new HandleRef(obj, handle);
|
||||
return new(obj, handle);
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
internal static BitmapHandle CreateFromHandle(IntPtr hbitmap, bool ownsHandle = true)
|
||||
{
|
||||
return new BitmapHandle(ownsHandle)
|
||||
return new(ownsHandle)
|
||||
{
|
||||
handle = hbitmap,
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace HandyControl.Tools.Interop
|
||||
private static HandleType[] HandleTypes;
|
||||
private static int HandleTypeCount;
|
||||
|
||||
private static readonly object HandleMutex = new object();
|
||||
private static readonly object HandleMutex = new();
|
||||
|
||||
internal static IntPtr Add(IntPtr handle, int type)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HandyControl.Tools.Interop
|
||||
[SecurityCritical, SecuritySafeCritical]
|
||||
internal static IconHandle GetInvalidIcon()
|
||||
{
|
||||
return new IconHandle();
|
||||
return new();
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace HandyControl.Tools.Interop
|
||||
|
||||
internal const int E_FAIL = unchecked((int) 0x80004005);
|
||||
|
||||
internal static readonly IntPtr HRGN_NONE = new IntPtr(-1);
|
||||
internal static readonly IntPtr HRGN_NONE = new(-1);
|
||||
|
||||
[DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto)]
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
|
||||
@@ -240,8 +240,8 @@ namespace HandyControl.Tools.Interop
|
||||
Bottom = (int) rect.Bottom;
|
||||
}
|
||||
|
||||
public Point Position => new Point(Left, Top);
|
||||
public Size Size => new Size(Width, Height);
|
||||
public Point Position => new(Left, Top);
|
||||
public Size Size => new(Width, Height);
|
||||
|
||||
public int Height
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
public class SynchronizedPool<T> : SimplePool<T>
|
||||
{
|
||||
private readonly object _lockObj = new object();
|
||||
private readonly object _lockObj = new();
|
||||
|
||||
public SynchronizedPool(int maxPoolSize) : base(maxPoolSize)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace HandyControl.Tools
|
||||
/// </summary>
|
||||
public static class RegexJudgment
|
||||
{
|
||||
private static readonly RegexPatterns RegexPatterns = new RegexPatterns();
|
||||
private static readonly RegexPatterns RegexPatterns = new();
|
||||
|
||||
/// <summary>
|
||||
/// 判断字符串格式是否符合某种要求
|
||||
|
||||
Reference in new issue
Block a user