From 193090da43544f237364133e9666d348be354673 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Tue, 8 Jun 2021 20:35:14 +0800 Subject: [PATCH] simplify new expression --- .../MainWindow.xaml.cs | 4 +- .../Service/Data/DataService.cs | 16 ++--- .../Tools/Helper/AssemblyHelper.cs | 2 +- .../UserControl/Main/MainContent.xaml.cs | 6 +- .../Styles/GeometryDemoCtl.xaml.cs | 4 +- .../ViewModel/Basic/ChatBoxViewModel.cs | 2 +- .../ViewModel/ViewModelLocator.cs | 10 +-- .../ManualObservableCollection!1.cs | 2 +- .../Block/RunningBlock/RunningBorder.cs | 2 +- .../Controls/Carousel/Carousel.cs | 4 +- .../Controls/ColorPicker/ColorPicker.cs | 6 +- .../Controls/Cover/CoverFlow/CoverFlow.cs | 4 +- .../Controls/Cover/CoverFlow/CoverFlowItem.cs | 12 ++-- .../Controls/Cover/CoverView/CoverView.cs | 2 +- .../Controls/Dialog/Dialog.cs | 2 +- .../Controls/Image/GifImage.cs | 4 +- .../Controls/Image/ImageViewer.cs | 2 +- .../Controls/Loading/LoadingBase.cs | 2 +- .../Controls/Other/DashedBorder.cs | 4 +- .../Controls/Other/Magnifier.cs | 4 +- .../Controls/Other/NotifyIcon.cs | 4 +- .../Controls/Other/Pagination.cs | 2 +- .../Controls/Other/Poptip.cs | 2 +- .../Controls/Panel/FlexPanel.cs | 2 +- .../Controls/PropertyGrid/PropertyGrid.cs | 4 +- .../Controls/PropertyGrid/PropertyResolver.cs | 2 +- .../Controls/Screenshot/ScreenshotWindow.cs | 2 +- .../Controls/TabControl/TabPanel.cs | 2 +- .../Controls/Time/FlipClock/FlipNumber.cs | 16 ++--- .../Controls/Time/TimeBar/TimeBar.cs | 4 +- .../Controls/Transfer/Transfer.cs | 4 +- .../Data/Gif/GifFrameDimension.cs | 6 +- .../Data/Info/SystemVersionInfo.cs | 6 +- .../Data/Operation/OperationResult.cs | 4 +- .../Expression/Drawing/GeometryHelper.cs | 20 +++--- .../Expression/Media/ArcGeometrySource.cs | 2 +- .../Expression/Shapes/PrimitiveShape.cs | 2 +- .../Behavior/FluidMoveBehavior.cs | 2 +- .../Behavior/FluidMoveBehaviorBase.cs | 2 +- .../Interactivity/Commands/ControlCommands.cs | 70 +++++++++---------- .../GeometryAnimationUsingKeyFrames.cs | 2 +- .../Themes/SharedResourceDictionary.cs | 2 +- .../Tools/Converter/BorderClipConverter.cs | 2 +- .../Tools/Extension/ColorExtension.cs | 2 +- .../Tools/Extension/ValueExtension.cs | 2 +- .../Tools/Generator/ComparerGenerator.cs | 2 +- .../Tools/GifImageAnimator.cs | 2 +- .../Tools/GlobalShortcut.cs | 2 +- .../Tools/Helper/AnimationHelper.cs | 4 +- .../Tools/Helper/SingleOpenHelper.cs | 2 +- .../Tools/Helper/WindowHelper.cs | 4 +- .../Tools/Hook/SystemMenuHook.cs | 2 +- .../Tools/Interop/Handle/BitmapHandle.cs | 4 +- .../Tools/Interop/Handle/HandleCollector.cs | 2 +- .../Tools/Interop/Handle/IconHandle.cs | 2 +- .../Tools/Interop/InteropMethods.cs | 2 +- .../Tools/Interop/InteropValues.cs | 4 +- .../Tools/Pool/SynchronizedPool!1.cs | 2 +- .../Tools/RegexJudgment.cs | 2 +- 59 files changed, 149 insertions(+), 149 deletions(-) diff --git a/src/Shared/HandyControlDemo_Shared/MainWindow.xaml.cs b/src/Shared/HandyControlDemo_Shared/MainWindow.xaml.cs index f95e174a..b49f96ba 100644 --- a/src/Shared/HandyControlDemo_Shared/MainWindow.xaml.cs +++ b/src/Shared/HandyControlDemo_Shared/MainWindow.xaml.cs @@ -26,8 +26,8 @@ namespace HandyControlDemo GlobalShortcut.Init(new List { - 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); diff --git a/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs b/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs index 1bbd4440..1476fd21 100644 --- a/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs +++ b/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs @@ -18,7 +18,7 @@ namespace HandyControlDemo.Service { internal ObservableCollection GetTabControlDemoDataList() { - return new ObservableCollection + return new() { new TabControlDemoModel { @@ -139,7 +139,7 @@ namespace HandyControlDemo.Service internal List GetBlogDataList() { - return new List + return new() { new AvatarModel { @@ -170,7 +170,7 @@ namespace HandyControlDemo.Service internal List GetProjectDataList() { - return new List + return new() { new AvatarModel { @@ -195,7 +195,7 @@ namespace HandyControlDemo.Service internal List GetWebsiteDataList() { - return new List + return new() { new AvatarModel { @@ -208,7 +208,7 @@ namespace HandyControlDemo.Service internal ObservableCollection GetCardDataList() { - return new ObservableCollection + 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 GetStepBarDemoDataList() { - return new List + return new() { new StepBarDemoModel { @@ -310,7 +310,7 @@ namespace HandyControlDemo.Service internal ObservableCollection GetCoverViewDemoDataList() { - return new ObservableCollection + return new() { new CoverViewDemoModel { diff --git a/src/Shared/HandyControlDemo_Shared/Tools/Helper/AssemblyHelper.cs b/src/Shared/HandyControlDemo_Shared/Tools/Helper/AssemblyHelper.cs index 39b9cb34..b3921178 100644 --- a/src/Shared/HandyControlDemo_Shared/Tools/Helper/AssemblyHelper.cs +++ b/src/Shared/HandyControlDemo_Shared/Tools/Helper/AssemblyHelper.cs @@ -7,7 +7,7 @@ namespace HandyControlDemo.Tools { private static readonly string NameSpaceStr = typeof(AssemblyHelper).Assembly.GetName().Name; - private static readonly Dictionary CacheDic = new Dictionary(); + private static readonly Dictionary CacheDic = new(); public static void Register(string name, object instance) => CacheDic[name] = instance; diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml.cs index 84d4eceb..3e779888 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml.cs +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml.cs @@ -67,17 +67,17 @@ namespace HandyControlDemo.UserControl var textEditorCustomStyle = ResourceHelper.GetResource