From f7c2c8bb6504357f43b6886daef8356b69a698be Mon Sep 17 00:00:00 2001 From: vicwjb Date: Sat, 20 Apr 2024 11:17:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=89=B4=E4=BA=8E=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E5=B0=86wpf=E9=A1=B9=E7=9B=AE=E8=BF=9B=E8=A1=8C=E4=BA=86?= =?UTF-8?q?=E6=8B=86=E5=88=86=EF=BC=8C=E7=A7=BB=E9=99=A4wpf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ColorIndex2SolidColorBrushConverter.cs | 163 --------------- IFoxCAD.WPF/DependencyObjectExtensions.cs | 39 ---- IFoxCAD.WPF/GlobalUsings.cs | 7 - IFoxCAD.WPF/IFoxCAD.WPF.csproj | 16 -- IFoxCAD.WPF/MVVM/RelayCommand.cs | 186 ----------------- IFoxCAD.WPF/MVVM/ViewModelBase.cs | 65 ------ .../MarkupExtension/EventBindingExtension.cs | 193 ------------------ IFoxCAD.sln | 6 - 8 files changed, 675 deletions(-) delete mode 100644 IFoxCAD.WPF/Converter/ColorIndex2SolidColorBrushConverter.cs delete mode 100644 IFoxCAD.WPF/DependencyObjectExtensions.cs delete mode 100644 IFoxCAD.WPF/GlobalUsings.cs delete mode 100644 IFoxCAD.WPF/IFoxCAD.WPF.csproj delete mode 100644 IFoxCAD.WPF/MVVM/RelayCommand.cs delete mode 100644 IFoxCAD.WPF/MVVM/ViewModelBase.cs delete mode 100644 IFoxCAD.WPF/MarkupExtension/EventBindingExtension.cs diff --git a/IFoxCAD.WPF/Converter/ColorIndex2SolidColorBrushConverter.cs b/IFoxCAD.WPF/Converter/ColorIndex2SolidColorBrushConverter.cs deleted file mode 100644 index 8047b27..0000000 --- a/IFoxCAD.WPF/Converter/ColorIndex2SolidColorBrushConverter.cs +++ /dev/null @@ -1,163 +0,0 @@ -using System.Collections.Generic; -using System.Globalization; -using System.Windows.Data; -using System.Windows.Media; -using MediaColor = System.Windows.Media.Color; - -namespace IFoxCAD.WPF; - -/// -/// 颜色索引到画刷转换器 -/// 由于不想引用AutoCAD的包,于是用这种ugly的方式来实现 -/// -public class ColorIndex2SolidColorBrushConverter : IValueConverter -{ - public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) - { - if (value is null || !int.TryParse(value.ToString(), out var index)) - return Binding.DoNothing; - index = Math.Abs(index) % 257; - if (index is 0 or 256) - index = 7; - if (colorDict.TryGetValue(index, out var color)) - return color; - return Binding.DoNothing; - } - - public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) - { - return Binding.DoNothing; - } - - private static readonly Dictionary colorDict = new() - { - { 1, new(MediaColor.FromRgb(255, 0, 0)) }, { 2, new(MediaColor.FromRgb(255, 255, 0)) }, - { 3, new(MediaColor.FromRgb(0, 255, 0)) }, { 4, new(MediaColor.FromRgb(0, 255, 255)) }, - { 5, new(MediaColor.FromRgb(0, 0, 255)) }, { 6, new(MediaColor.FromRgb(255, 0, 255)) }, - { 7, new(MediaColor.FromRgb(255, 255, 255)) }, { 8, new(MediaColor.FromRgb(128, 128, 128)) }, - { 9, new(MediaColor.FromRgb(192, 192, 192)) }, { 10, new(MediaColor.FromRgb(255, 0, 0)) }, - { 11, new(MediaColor.FromRgb(255, 127, 127)) }, { 12, new(MediaColor.FromRgb(204, 0, 0)) }, - { 13, new(MediaColor.FromRgb(204, 102, 102)) }, { 14, new(MediaColor.FromRgb(153, 0, 0)) }, - { 15, new(MediaColor.FromRgb(153, 76, 76)) }, { 16, new(MediaColor.FromRgb(127, 0, 0)) }, - { 17, new(MediaColor.FromRgb(127, 63, 63)) }, { 18, new(MediaColor.FromRgb(76, 0, 0)) }, - { 19, new(MediaColor.FromRgb(76, 38, 38)) }, { 20, new(MediaColor.FromRgb(255, 63, 0)) }, - { 21, new(MediaColor.FromRgb(255, 159, 127)) }, { 22, new(MediaColor.FromRgb(204, 51, 0)) }, - { 23, new(MediaColor.FromRgb(204, 127, 102)) }, { 24, new(MediaColor.FromRgb(153, 38, 0)) }, - { 25, new(MediaColor.FromRgb(153, 95, 76)) }, { 26, new(MediaColor.FromRgb(127, 31, 0)) }, - { 27, new(MediaColor.FromRgb(127, 79, 63)) }, { 28, new(MediaColor.FromRgb(76, 19, 0)) }, - { 29, new(MediaColor.FromRgb(76, 47, 38)) }, { 30, new(MediaColor.FromRgb(255, 127, 0)) }, - { 31, new(MediaColor.FromRgb(255, 191, 127)) }, { 32, new(MediaColor.FromRgb(204, 102, 0)) }, - { 33, new(MediaColor.FromRgb(204, 153, 102)) }, { 34, new(MediaColor.FromRgb(153, 76, 0)) }, - { 35, new(MediaColor.FromRgb(153, 114, 76)) }, { 36, new(MediaColor.FromRgb(127, 63, 0)) }, - { 37, new(MediaColor.FromRgb(127, 95, 63)) }, { 38, new(MediaColor.FromRgb(76, 38, 0)) }, - { 39, new(MediaColor.FromRgb(76, 57, 38)) }, { 40, new(MediaColor.FromRgb(255, 191, 0)) }, - { 41, new(MediaColor.FromRgb(255, 223, 127)) }, { 42, new(MediaColor.FromRgb(204, 153, 0)) }, - { 43, new(MediaColor.FromRgb(204, 178, 102)) }, { 44, new(MediaColor.FromRgb(153, 114, 0)) }, - { 45, new(MediaColor.FromRgb(153, 133, 76)) }, { 46, new(MediaColor.FromRgb(127, 95, 0)) }, - { 47, new(MediaColor.FromRgb(127, 111, 63)) }, { 48, new(MediaColor.FromRgb(76, 57, 0)) }, - { 49, new(MediaColor.FromRgb(76, 66, 38)) }, { 50, new(MediaColor.FromRgb(255, 255, 0)) }, - { 51, new(MediaColor.FromRgb(255, 255, 127)) }, { 52, new(MediaColor.FromRgb(204, 204, 0)) }, - { 53, new(MediaColor.FromRgb(204, 204, 102)) }, { 54, new(MediaColor.FromRgb(153, 153, 0)) }, - { 55, new(MediaColor.FromRgb(153, 153, 76)) }, { 56, new(MediaColor.FromRgb(127, 127, 0)) }, - { 57, new(MediaColor.FromRgb(127, 127, 63)) }, { 58, new(MediaColor.FromRgb(76, 76, 0)) }, - { 59, new(MediaColor.FromRgb(76, 76, 38)) }, { 60, new(MediaColor.FromRgb(191, 255, 0)) }, - { 61, new(MediaColor.FromRgb(223, 255, 127)) }, { 62, new(MediaColor.FromRgb(153, 204, 0)) }, - { 63, new(MediaColor.FromRgb(178, 204, 102)) }, { 64, new(MediaColor.FromRgb(114, 153, 0)) }, - { 65, new(MediaColor.FromRgb(133, 153, 76)) }, { 66, new(MediaColor.FromRgb(95, 127, 0)) }, - { 67, new(MediaColor.FromRgb(111, 127, 63)) }, { 68, new(MediaColor.FromRgb(57, 76, 0)) }, - { 69, new(MediaColor.FromRgb(66, 76, 38)) }, { 70, new(MediaColor.FromRgb(127, 255, 0)) }, - { 71, new(MediaColor.FromRgb(191, 255, 127)) }, { 72, new(MediaColor.FromRgb(102, 204, 0)) }, - { 73, new(MediaColor.FromRgb(153, 204, 102)) }, { 74, new(MediaColor.FromRgb(76, 153, 0)) }, - { 75, new(MediaColor.FromRgb(114, 153, 76)) }, { 76, new(MediaColor.FromRgb(63, 127, 0)) }, - { 77, new(MediaColor.FromRgb(95, 127, 63)) }, { 78, new(MediaColor.FromRgb(38, 76, 0)) }, - { 79, new(MediaColor.FromRgb(57, 76, 38)) }, { 80, new(MediaColor.FromRgb(63, 255, 0)) }, - { 81, new(MediaColor.FromRgb(159, 255, 127)) }, { 82, new(MediaColor.FromRgb(51, 204, 0)) }, - { 83, new(MediaColor.FromRgb(127, 204, 102)) }, { 84, new(MediaColor.FromRgb(38, 153, 0)) }, - { 85, new(MediaColor.FromRgb(95, 153, 76)) }, { 86, new(MediaColor.FromRgb(31, 127, 0)) }, - { 87, new(MediaColor.FromRgb(79, 127, 63)) }, { 88, new(MediaColor.FromRgb(19, 76, 0)) }, - { 89, new(MediaColor.FromRgb(47, 76, 38)) }, { 90, new(MediaColor.FromRgb(0, 255, 0)) }, - { 91, new(MediaColor.FromRgb(127, 255, 127)) }, { 92, new(MediaColor.FromRgb(0, 204, 0)) }, - { 93, new(MediaColor.FromRgb(102, 204, 102)) }, { 94, new(MediaColor.FromRgb(0, 153, 0)) }, - { 95, new(MediaColor.FromRgb(76, 153, 76)) }, { 96, new(MediaColor.FromRgb(0, 127, 0)) }, - { 97, new(MediaColor.FromRgb(63, 127, 63)) }, { 98, new(MediaColor.FromRgb(0, 76, 0)) }, - { 99, new(MediaColor.FromRgb(38, 76, 38)) }, { 100, new(MediaColor.FromRgb(0, 255, 63)) }, - { 101, new(MediaColor.FromRgb(127, 255, 159)) }, { 102, new(MediaColor.FromRgb(0, 204, 51)) }, - { 103, new(MediaColor.FromRgb(102, 204, 127)) }, { 104, new(MediaColor.FromRgb(0, 153, 38)) }, - { 105, new(MediaColor.FromRgb(76, 153, 95)) }, { 106, new(MediaColor.FromRgb(0, 127, 31)) }, - { 107, new(MediaColor.FromRgb(63, 127, 79)) }, { 108, new(MediaColor.FromRgb(0, 76, 19)) }, - { 109, new(MediaColor.FromRgb(38, 76, 47)) }, { 110, new(MediaColor.FromRgb(0, 255, 127)) }, - { 111, new(MediaColor.FromRgb(127, 255, 191)) }, { 112, new(MediaColor.FromRgb(0, 204, 102)) }, - { 113, new(MediaColor.FromRgb(102, 204, 153)) }, { 114, new(MediaColor.FromRgb(0, 153, 76)) }, - { 115, new(MediaColor.FromRgb(76, 153, 114)) }, { 116, new(MediaColor.FromRgb(0, 127, 63)) }, - { 117, new(MediaColor.FromRgb(63, 127, 95)) }, { 118, new(MediaColor.FromRgb(0, 76, 38)) }, - { 119, new(MediaColor.FromRgb(38, 76, 57)) }, { 120, new(MediaColor.FromRgb(0, 255, 191)) }, - { 121, new(MediaColor.FromRgb(127, 255, 223)) }, { 122, new(MediaColor.FromRgb(0, 204, 153)) }, - { 123, new(MediaColor.FromRgb(102, 204, 178)) }, { 124, new(MediaColor.FromRgb(0, 153, 114)) }, - { 125, new(MediaColor.FromRgb(76, 153, 133)) }, { 126, new(MediaColor.FromRgb(0, 127, 95)) }, - { 127, new(MediaColor.FromRgb(63, 127, 111)) }, { 128, new(MediaColor.FromRgb(0, 76, 57)) }, - { 129, new(MediaColor.FromRgb(38, 76, 66)) }, { 130, new(MediaColor.FromRgb(0, 255, 255)) }, - { 131, new(MediaColor.FromRgb(127, 255, 255)) }, { 132, new(MediaColor.FromRgb(0, 204, 204)) }, - { 133, new(MediaColor.FromRgb(102, 204, 204)) }, { 134, new(MediaColor.FromRgb(0, 153, 153)) }, - { 135, new(MediaColor.FromRgb(76, 153, 153)) }, { 136, new(MediaColor.FromRgb(0, 127, 127)) }, - { 137, new(MediaColor.FromRgb(63, 127, 127)) }, { 138, new(MediaColor.FromRgb(0, 76, 76)) }, - { 139, new(MediaColor.FromRgb(38, 76, 76)) }, { 140, new(MediaColor.FromRgb(0, 191, 255)) }, - { 141, new(MediaColor.FromRgb(127, 223, 255)) }, { 142, new(MediaColor.FromRgb(0, 153, 204)) }, - { 143, new(MediaColor.FromRgb(102, 178, 204)) }, { 144, new(MediaColor.FromRgb(0, 114, 153)) }, - { 145, new(MediaColor.FromRgb(76, 133, 153)) }, { 146, new(MediaColor.FromRgb(0, 95, 127)) }, - { 147, new(MediaColor.FromRgb(63, 111, 127)) }, { 148, new(MediaColor.FromRgb(0, 57, 76)) }, - { 149, new(MediaColor.FromRgb(38, 66, 76)) }, { 150, new(MediaColor.FromRgb(0, 127, 255)) }, - { 151, new(MediaColor.FromRgb(127, 191, 255)) }, { 152, new(MediaColor.FromRgb(0, 102, 204)) }, - { 153, new(MediaColor.FromRgb(102, 153, 204)) }, { 154, new(MediaColor.FromRgb(0, 76, 153)) }, - { 155, new(MediaColor.FromRgb(76, 114, 153)) }, { 156, new(MediaColor.FromRgb(0, 63, 127)) }, - { 157, new(MediaColor.FromRgb(63, 95, 127)) }, { 158, new(MediaColor.FromRgb(0, 38, 76)) }, - { 159, new(MediaColor.FromRgb(38, 57, 76)) }, { 160, new(MediaColor.FromRgb(0, 63, 255)) }, - { 161, new(MediaColor.FromRgb(127, 159, 255)) }, { 162, new(MediaColor.FromRgb(0, 51, 204)) }, - { 163, new(MediaColor.FromRgb(102, 127, 204)) }, { 164, new(MediaColor.FromRgb(0, 38, 153)) }, - { 165, new(MediaColor.FromRgb(76, 95, 153)) }, { 166, new(MediaColor.FromRgb(0, 31, 127)) }, - { 167, new(MediaColor.FromRgb(63, 79, 127)) }, { 168, new(MediaColor.FromRgb(0, 19, 76)) }, - { 169, new(MediaColor.FromRgb(38, 47, 76)) }, { 170, new(MediaColor.FromRgb(0, 0, 255)) }, - { 171, new(MediaColor.FromRgb(127, 127, 255)) }, { 172, new(MediaColor.FromRgb(0, 0, 204)) }, - { 173, new(MediaColor.FromRgb(102, 102, 204)) }, { 174, new(MediaColor.FromRgb(0, 0, 153)) }, - { 175, new(MediaColor.FromRgb(76, 76, 153)) }, { 176, new(MediaColor.FromRgb(0, 0, 127)) }, - { 177, new(MediaColor.FromRgb(63, 63, 127)) }, { 178, new(MediaColor.FromRgb(0, 0, 76)) }, - { 179, new(MediaColor.FromRgb(38, 38, 76)) }, { 180, new(MediaColor.FromRgb(63, 0, 255)) }, - { 181, new(MediaColor.FromRgb(159, 127, 255)) }, { 182, new(MediaColor.FromRgb(51, 0, 204)) }, - { 183, new(MediaColor.FromRgb(127, 102, 204)) }, { 184, new(MediaColor.FromRgb(38, 0, 153)) }, - { 185, new(MediaColor.FromRgb(95, 76, 153)) }, { 186, new(MediaColor.FromRgb(31, 0, 127)) }, - { 187, new(MediaColor.FromRgb(79, 63, 127)) }, { 188, new(MediaColor.FromRgb(19, 0, 76)) }, - { 189, new(MediaColor.FromRgb(47, 38, 76)) }, { 190, new(MediaColor.FromRgb(127, 0, 255)) }, - { 191, new(MediaColor.FromRgb(191, 127, 255)) }, { 192, new(MediaColor.FromRgb(102, 0, 204)) }, - { 193, new(MediaColor.FromRgb(153, 102, 204)) }, { 194, new(MediaColor.FromRgb(76, 0, 153)) }, - { 195, new(MediaColor.FromRgb(114, 76, 153)) }, { 196, new(MediaColor.FromRgb(63, 0, 127)) }, - { 197, new(MediaColor.FromRgb(95, 63, 127)) }, { 198, new(MediaColor.FromRgb(38, 0, 76)) }, - { 199, new(MediaColor.FromRgb(57, 38, 76)) }, { 200, new(MediaColor.FromRgb(191, 0, 255)) }, - { 201, new(MediaColor.FromRgb(223, 127, 255)) }, { 202, new(MediaColor.FromRgb(153, 0, 204)) }, - { 203, new(MediaColor.FromRgb(178, 102, 204)) }, { 204, new(MediaColor.FromRgb(114, 0, 153)) }, - { 205, new(MediaColor.FromRgb(133, 76, 153)) }, { 206, new(MediaColor.FromRgb(95, 0, 127)) }, - { 207, new(MediaColor.FromRgb(111, 63, 127)) }, { 208, new(MediaColor.FromRgb(57, 0, 76)) }, - { 209, new(MediaColor.FromRgb(66, 38, 76)) }, { 210, new(MediaColor.FromRgb(255, 0, 255)) }, - { 211, new(MediaColor.FromRgb(255, 127, 255)) }, { 212, new(MediaColor.FromRgb(204, 0, 204)) }, - { 213, new(MediaColor.FromRgb(204, 102, 204)) }, { 214, new(MediaColor.FromRgb(153, 0, 153)) }, - { 215, new(MediaColor.FromRgb(153, 76, 153)) }, { 216, new(MediaColor.FromRgb(127, 0, 127)) }, - { 217, new(MediaColor.FromRgb(127, 63, 127)) }, { 218, new(MediaColor.FromRgb(76, 0, 76)) }, - { 219, new(MediaColor.FromRgb(76, 38, 76)) }, { 220, new(MediaColor.FromRgb(255, 0, 191)) }, - { 221, new(MediaColor.FromRgb(255, 127, 223)) }, { 222, new(MediaColor.FromRgb(204, 0, 153)) }, - { 223, new(MediaColor.FromRgb(204, 102, 178)) }, { 224, new(MediaColor.FromRgb(153, 0, 114)) }, - { 225, new(MediaColor.FromRgb(153, 76, 133)) }, { 226, new(MediaColor.FromRgb(127, 0, 95)) }, - { 227, new(MediaColor.FromRgb(127, 63, 111)) }, { 228, new(MediaColor.FromRgb(76, 0, 57)) }, - { 229, new(MediaColor.FromRgb(76, 38, 66)) }, { 230, new(MediaColor.FromRgb(255, 0, 127)) }, - { 231, new(MediaColor.FromRgb(255, 127, 191)) }, { 232, new(MediaColor.FromRgb(204, 0, 102)) }, - { 233, new(MediaColor.FromRgb(204, 102, 153)) }, { 234, new(MediaColor.FromRgb(153, 0, 76)) }, - { 235, new(MediaColor.FromRgb(153, 76, 114)) }, { 236, new(MediaColor.FromRgb(127, 0, 63)) }, - { 237, new(MediaColor.FromRgb(127, 63, 95)) }, { 238, new(MediaColor.FromRgb(76, 0, 38)) }, - { 239, new(MediaColor.FromRgb(76, 38, 57)) }, { 240, new(MediaColor.FromRgb(255, 0, 63)) }, - { 241, new(MediaColor.FromRgb(255, 127, 159)) }, { 242, new(MediaColor.FromRgb(204, 0, 51)) }, - { 243, new(MediaColor.FromRgb(204, 102, 127)) }, { 244, new(MediaColor.FromRgb(153, 0, 38)) }, - { 245, new(MediaColor.FromRgb(153, 76, 95)) }, { 246, new(MediaColor.FromRgb(127, 0, 31)) }, - { 247, new(MediaColor.FromRgb(127, 63, 79)) }, { 248, new(MediaColor.FromRgb(76, 0, 19)) }, - { 249, new(MediaColor.FromRgb(76, 38, 47)) }, { 250, new(MediaColor.FromRgb(51, 51, 51)) }, - { 251, new(MediaColor.FromRgb(91, 91, 91)) }, { 252, new(MediaColor.FromRgb(132, 132, 132)) }, - { 253, new(MediaColor.FromRgb(173, 173, 173)) }, { 254, new(MediaColor.FromRgb(214, 214, 214)) }, - { 255, new(MediaColor.FromRgb(255, 255, 255)) } - }; -} \ No newline at end of file diff --git a/IFoxCAD.WPF/DependencyObjectExtensions.cs b/IFoxCAD.WPF/DependencyObjectExtensions.cs deleted file mode 100644 index 317cba2..0000000 --- a/IFoxCAD.WPF/DependencyObjectExtensions.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Windows.Media; - -namespace IFoxCAD.WPF; - -/// -/// 依赖属性扩展类 -/// -public static class DependencyObjectExtensions -{ - /// - /// 获取父对象依赖属性 - /// - /// 子对象 - /// 依赖属性 - public static DependencyObject? GetParentObject(this DependencyObject? child) - { - if (child is null) - return null; - - if (child is ContentElement ce) - { - var parent = ContentOperations.GetParent(ce); - if (parent is not null) - return parent; - - var fce = ce as FrameworkContentElement; - return fce?.Parent; - } - - if (child is FrameworkElement fe) - { - var parent = fe.Parent; - if (parent is not null) - return parent; - } - - return VisualTreeHelper.GetParent(child); - } -} \ No newline at end of file diff --git a/IFoxCAD.WPF/GlobalUsings.cs b/IFoxCAD.WPF/GlobalUsings.cs deleted file mode 100644 index 391e1c9..0000000 --- a/IFoxCAD.WPF/GlobalUsings.cs +++ /dev/null @@ -1,7 +0,0 @@ -global using System; -global using System.Reflection; -global using System.Reflection.Emit; -global using System.Windows; -global using System.Windows.Input; -global using System.Windows.Markup; -global using System.Diagnostics; \ No newline at end of file diff --git a/IFoxCAD.WPF/IFoxCAD.WPF.csproj b/IFoxCAD.WPF/IFoxCAD.WPF.csproj deleted file mode 100644 index c083866..0000000 --- a/IFoxCAD.WPF/IFoxCAD.WPF.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net48 - Preview - enable - x64 - IFoxCAD.WPF - true - - - - - - - diff --git a/IFoxCAD.WPF/MVVM/RelayCommand.cs b/IFoxCAD.WPF/MVVM/RelayCommand.cs deleted file mode 100644 index cd6dcf9..0000000 --- a/IFoxCAD.WPF/MVVM/RelayCommand.cs +++ /dev/null @@ -1,186 +0,0 @@ -using Microsoft.Xaml.Behaviors; - -namespace IFoxCAD.WPF; - -/// -/// 命令基类 -/// -/// -public class RelayCommand : ICommand -{ - private readonly Func? _canExecute; - private readonly Action _execute; - - /// - /// 初始化 类. - /// - /// 执行函数委托 - /// 是否可执行函数委托 - /// execute - public RelayCommand(Action execute, Func? canExecute = null) - { - _execute = execute ?? throw new ArgumentNullException(nameof(execute)); - _canExecute = canExecute; - } - - /// - /// 当出现影响是否应执行该命令的更改时发生。 - /// - public event EventHandler CanExecuteChanged - { - add - { - if (_canExecute is not null) - CommandManager.RequerySuggested += value; - } - remove - { - if (_canExecute is not null) - CommandManager.RequerySuggested -= value; - } - } - - /// - /// 定义确定此命令是否可在其当前状态下执行的方法。 - /// - /// 此命令使用的数据。 如果此命令不需要传递数据,则该对象可以设置为 。 - /// - /// 如果可执行此命令,则为 ;否则为 。 - /// - [DebuggerStepThrough] - public bool CanExecute(object parameter) - { - return _canExecute is null || _canExecute(parameter); - } - - /// - /// 定义在调用此命令时要调用的方法。 - /// - /// 此命令使用的数据。 如果此命令不需要传递数据,则该对象可以设置为 。 - public void Execute(object parameter) - { - _execute(parameter); - } -} - -/// -/// 命令泛型基类 -/// -/// 事件类型 -/// -public class RelayCommand : ICommand -{ - private readonly Func? _canExecute; - private readonly Action? _execute; - - /// - /// 初始化 类。 - /// - /// 执行函数 - public RelayCommand(Action execute) : this(execute, (_) => true) - { - } - - /// - /// 初始化 类。 - /// - /// 执行函数委托 - /// 是否可执行函数委托 - /// execute - public RelayCommand(Action execute, Func canExecute) - { - _execute = execute ?? throw new ArgumentNullException(nameof(execute)); - _canExecute = canExecute; - } - - /// - /// 当出现影响是否应执行该命令的更改时发生。 - /// - public event EventHandler CanExecuteChanged - { - add - { - if (_canExecute is not null) - CommandManager.RequerySuggested += value; - } - remove - { - if (_canExecute is not null) - CommandManager.RequerySuggested -= value; - } - } - - /// - /// 定义确定此命令是否可在其当前状态下执行的方法。 - /// - /// 此命令使用的数据。 如果此命令不需要传递数据,则该对象可以设置为 。 - /// - /// 如果可执行此命令,则为 ;否则为 。 - /// - public bool CanExecute(object parameter) - { - if (_canExecute is null) - return true; - return _canExecute((T)parameter); - } - - /// - /// 定义在调用此命令时要调用的方法。 - /// - /// 此命令使用的数据。 如果此命令不需要传递数据,则该对象可以设置为 。 - public void Execute(object parameter) - { - if (_execute is not null && CanExecute(parameter)) - _execute((T)parameter); - } -} - -/// -/// 事件命令 -/// -public class EventCommand : TriggerAction -{ - /// - /// 执行动作 - /// - /// 要执行的动作参数, 如果动作为提供参数,就设置为null - protected override void Invoke(object parameter) - { - if (CommandParameter is not null) - parameter = CommandParameter; - if (Command is not null) - Command.Execute(parameter); - } - - /// - /// 事件 - /// - public ICommand? Command - { - get => (ICommand)GetValue(CommandProperty); - set => SetValue(CommandProperty, value); - } - - /// - /// 事件属性 - /// - public static readonly DependencyProperty CommandProperty = - DependencyProperty.Register(nameof(Command), typeof(ICommand), typeof(EventCommand), - new PropertyMetadata(null)); - - /// - /// 事件参数,如果为空,将自动传入事件的真实参数 - /// - public object? CommandParameter - { - get => GetValue(CommandParameterProperty); - set => SetValue(CommandParameterProperty, value); - } - - /// - /// 事件参数属性 - /// - public static readonly DependencyProperty CommandParameterProperty = - DependencyProperty.Register(nameof(CommandParameter), typeof(object), typeof(EventCommand), - new PropertyMetadata(null)); -} \ No newline at end of file diff --git a/IFoxCAD.WPF/MVVM/ViewModelBase.cs b/IFoxCAD.WPF/MVVM/ViewModelBase.cs deleted file mode 100644 index d020ef4..0000000 --- a/IFoxCAD.WPF/MVVM/ViewModelBase.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.ComponentModel; -using System.Runtime.CompilerServices; - -namespace IFoxCAD.WPF; - -/// -/// ViewModel基类 -/// -/// -public class ViewModelBase : INotifyPropertyChanged -{ - /// - /// 属性值更改事件。 - /// - public event PropertyChangedEventHandler? PropertyChanged; - - /// - /// 属性改变时调用 - /// - /// 属性名 - public void OnPropertyChanged([CallerMemberName] string propertyName = "") - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - - /// - /// 设置属性函数,自动通知属性改变事件 - /// - /// 属性类型 - /// 属性 - /// 属性值 - /// 属性名 - /// 成功返回 ,反之 - protected virtual bool Set(ref T storage, T value, [CallerMemberName] string propertyName = "") - { - if (Equals(storage, value)) - return false; - - storage = value; - this.OnPropertyChanged(propertyName); - - return true; - } - - /// - /// 创建命令 - /// - /// 要调用的命令函数委托 - /// WPF命令 - protected RelayCommand CreateCommand(Action executeMethod) - { - return CreateCommand(executeMethod, (_) => true); - } - - /// - /// 创建命令 - /// - /// 要调用的命令函数委托 - /// 命令是否可以执行的委托 - /// WPF命令 - protected RelayCommand CreateCommand(Action executeMethod, Func canExecuteMethod) - { - return new(executeMethod, canExecuteMethod); - } -} \ No newline at end of file diff --git a/IFoxCAD.WPF/MarkupExtension/EventBindingExtension.cs b/IFoxCAD.WPF/MarkupExtension/EventBindingExtension.cs deleted file mode 100644 index abe6a38..0000000 --- a/IFoxCAD.WPF/MarkupExtension/EventBindingExtension.cs +++ /dev/null @@ -1,193 +0,0 @@ -namespace IFoxCAD.WPF; - -/// -/// 事件绑定标签类 -/// -/// -public class EventBindingExtension : MarkupExtension -{ - /// - /// 命令属性 - /// - public string? Command { get; set; } - - /// - /// 命令参数属性 - /// - public string? CommandParameter { get; set; } - - /// - /// 当在派生类中实现时,返回用作此标记扩展的目标属性值的对象。 - /// - /// 可为标记扩展提供服务的服务提供程序帮助程序。 - /// - /// 要在应用了扩展的属性上设置的对象值。 - /// - /// - /// - public override object? ProvideValue(IServiceProvider serviceProvider) - { - if (serviceProvider is null) - throw new ArgumentNullException(nameof(serviceProvider)); - if (serviceProvider.GetService(typeof(IProvideValueTarget)) is not IProvideValueTarget targetProvider) - throw new InvalidOperationException(message: $"{nameof(ProvideValue)}:{nameof(IProvideValueTarget)}"); - - if (targetProvider.TargetObject is not FrameworkElement targetObject) - throw new InvalidOperationException(message: $"{nameof(ProvideValue)}:{nameof(FrameworkElement)}"); - - if (targetProvider.TargetProperty is not MemberInfo memberInfo) - throw new InvalidOperationException(message: $"{nameof(ProvideValue)}:{nameof(MemberInfo)}"); - - if (string.IsNullOrWhiteSpace(Command)) - { - Command = memberInfo.Name.Replace("Add", ""); - if (Command.Contains("Handler")) - Command = Command.Replace("Handler", "Command"); - else - Command += "Command"; - } - - return CreateHandler(memberInfo, Command!, targetObject.GetType()); - } - - private Type? GetEventHandlerType(MemberInfo memberInfo) - { - Type? eventHandlerType = null; - if (memberInfo is EventInfo eventInfo) - { - // var info = memberInfo as EventInfo; - // var eventInfo = info; - eventHandlerType = eventInfo.EventHandlerType; - } - else if (memberInfo is MethodInfo methodInfo) - { - // var info = memberInfo as MethodInfo; - // var methodInfo = info; - var pars = methodInfo.GetParameters(); - eventHandlerType = pars[1].ParameterType; - } - - return eventHandlerType; - } - - private object? CreateHandler(MemberInfo memberInfo, string cmdName, Type targetType) - { - var eventHandlerType = GetEventHandlerType(memberInfo); - if (eventHandlerType is null) - return null; - - var handlerInfo = eventHandlerType.GetMethod("Invoke"); - var method = new DynamicMethod("", handlerInfo!.ReturnType, - [ - handlerInfo.GetParameters()[0].ParameterType, - handlerInfo.GetParameters()[1].ParameterType - ]); - - var gen = method.GetILGenerator(); - gen.Emit(OpCodes.Ldarg, 0); - gen.Emit(OpCodes.Ldarg, 1); - gen.Emit(OpCodes.Ldstr, cmdName); - - if (CommandParameter is null) - gen.Emit(OpCodes.Ldnull); - else - gen.Emit(OpCodes.Ldstr, CommandParameter); - - gen.Emit(OpCodes.Call, getMethod); - gen.Emit(OpCodes.Ret); - - return method.CreateDelegate(eventHandlerType); - } - - static readonly MethodInfo getMethod = typeof(EventBindingExtension) - .GetMethod(nameof(HandlerIntern), - new Type[] { typeof(object), typeof(object), typeof(string), typeof(string) })!; - - static void Handler(object sender, object args) - { - HandlerIntern(sender, args, "cmd", null); - } - - /// - /// Handlers the intern. - /// - /// The sender. - /// The arguments. - /// Name of the command. - /// The command parameter. - public static void HandlerIntern(object sender, object args, string cmdName, string? commandParameter) - { - if (sender is FrameworkElement fe) - { - var cmd = GetCommand(fe, cmdName); - object? commandParam = null; - if (!string.IsNullOrWhiteSpace(commandParameter)) - commandParam = GetCommandParameter(fe, args, commandParameter!); - if ((cmd is not null) && cmd.CanExecute(commandParam)) - cmd.Execute(commandParam); - } - } - - internal static ICommand? GetCommand(FrameworkElement target, string cmdName) - { - var vm = FindViewModel(target); - if (vm is null) - return null; - - var vmType = vm.GetType(); - var cmdProp = vmType.GetProperty(cmdName); - if (cmdProp is not null) - return cmdProp.GetValue(vm) as ICommand; -#if DEBUG - throw new Exception("EventBinding path error: '" + cmdName + "' property not found on '" + vmType + - "' 'DelegateCommand'"); -#else - return null; -#endif - } - - internal static object GetCommandParameter(FrameworkElement target, object args, string commandParameter) - { - var classify = commandParameter.Split('.'); - object ret = classify[0] switch - { - "$e" => args, - "$this" => classify.Length > 1 - ? FollowPropertyPath(target, commandParameter.Replace("$this.", ""), target.GetType()) - : target, - _ => commandParameter, - }; - return ret; - } - - internal static ViewModelBase? FindViewModel(FrameworkElement? target) - { - if (target is null) - return null; - if (target.DataContext is ViewModelBase vm) - return vm; - return FindViewModel(target.GetParentObject() as FrameworkElement); - } - - internal static object FollowPropertyPath(object target, string path, Type? valueType = null) - { - if (target is null) - throw new ArgumentNullException(nameof(target)); - if (path is null) - throw new ArgumentNullException(nameof(path)); - - valueType ??= target.GetType(); - var spls = path.Split('.'); - foreach (var t in spls) - { - var property = valueType.GetProperty(t); - if (property is null) - throw new NullReferenceException("property"); - - target = property.GetValue(target); - valueType = property.PropertyType; - } - - return target; - } -} \ No newline at end of file diff --git a/IFoxCAD.sln b/IFoxCAD.sln index dd317f4..1e17231 100644 --- a/IFoxCAD.sln +++ b/IFoxCAD.sln @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IFoxCAD.Cad", "IFoxCAD.Cad\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", "{0C01F295-0985-436B-A15D-228877C60F1D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IFoxCAD.WPF", "IFoxCAD.WPF\IFoxCAD.WPF.csproj", "{9E6049F1-EA67-4F92-93B8-00D20C49E308}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -23,10 +21,6 @@ Global {0C01F295-0985-436B-A15D-228877C60F1D}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C01F295-0985-436B-A15D-228877C60F1D}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C01F295-0985-436B-A15D-228877C60F1D}.Release|Any CPU.Build.0 = Release|Any CPU - {9E6049F1-EA67-4F92-93B8-00D20C49E308}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9E6049F1-EA67-4F92-93B8-00D20C49E308}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9E6049F1-EA67-4F92-93B8-00D20C49E308}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9E6049F1-EA67-4F92-93B8-00D20C49E308}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- Gitee From adc65a030f10ca9dc1ed9777d4e437d258b97a1e Mon Sep 17 00:00:00 2001 From: vicwjb Date: Sat, 20 Apr 2024 20:35:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=EF=BC=8C=E5=B9=B6=E8=B0=83=E6=95=B4=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=90=8D=E7=A7=B0=E4=B8=BAIFoxCad.AutoCad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Basal/General/ArrayEx.cs | 0 .../Basal/General/DebugHelper.cs | 0 .../Basal/General/EnumEx.cs | 0 .../Basal/General/LinqEx.cs | 0 .../Basal/General/LoopList.cs | 0 .../Basal/General/LoopState.cs | 0 .../Basal/Nullable/ArgumentNullEx.cs | 0 .../CallerArgumentExpressionAttribute.cs | 0 .../Basal/Win/SystemEx.cs | 0 .../Basal/Win/Win32Api.cs | 0 CADShared/CADShared.projitems | 70 +++++++++++++++++++ CADShared/CADShared.shproj | 12 ++++ .../ExtensionMethod/CollectionEx.cs | 0 .../ExtensionMethod/DBDictionaryEx.cs | 0 .../ExtensionMethod/DBObjectEx.cs | 0 .../ExtensionMethod/EditorEx.cs | 0 .../Entity/BlockReferenceEx.cs | 0 .../ExtensionMethod/Entity/BoundingInfo.cs | 0 .../ExtensionMethod/Entity/CircleEx.cs | 0 .../Entity/EntityBoundingInfo.cs | 0 .../ExtensionMethod/Entity/EntityEx.cs | 0 .../ExtensionMethod/Entity/PolylineEx.cs | 0 .../ExtensionMethod/Enums.cs | 0 .../ExtensionMethod/Geomerty/Curve2dEx.cs | 0 .../ExtensionMethod/Geomerty/Curve3dEx.cs | 0 .../ExtensionMethod/Geomerty/GeometryEx.cs | 0 .../ExtensionMethod/Geomerty/PointEx.cs | 0 .../ExtensionMethod/Jig/JigEx.cs | 0 .../ExtensionMethod/Jig/JigExTransient.cs | 0 .../ExtensionMethod/ObjectIdEx.cs | 0 .../ExtensionMethod/RedrawEx.cs | 0 .../ExtensionMethod/SelectionSetEx.cs | 0 .../ExtensionMethod/SingleKeyWordHook.cs | 0 .../ExtensionMethod/SymbolTableEx.cs | 0 .../ExtensionMethod/SymbolTableRecordEx.cs | 0 .../ExtensionMethod/TangentEx.cs | 0 .../ExtensionMethod/TransactionEx.cs | 0 .../ExtensionMethod/WindowEx.cs | 0 .../Initialize/AcadEMR.cs | 0 .../Initialize/AssemInfo.cs | 0 .../Initialize/AutoReg.cs | 0 .../Initialize/AutoRegAssem.cs | 0 .../Initialize/CheckFactory.cs | 0 .../Initialize/IAutoGo.cs | 0 .../Initialize/MethodInfoHelper.cs | 0 .../ResultData/LispList.cs | 0 .../ResultData/TypedValueList.cs | 0 .../ResultData/XDataList.cs | 0 .../ResultData/XRecordDataList.cs | 0 {IFoxCAD.Cad => CADShared}/Runtime/DBTrans.cs | 0 {IFoxCAD.Cad => CADShared}/Runtime/Env.cs | 0 .../Runtime/IdleAction.cs | 0 .../Runtime/IdleNoCommandAction.cs | 0 .../Runtime/SymbolTable.cs | 0 .../SelectionFilter/OpComp.cs | 0 .../SelectionFilter/OpEqual.cs | 0 .../SelectionFilter/OpFilter.cs | 0 .../SelectionFilter/OpList.cs | 0 .../SelectionFilter/OpLogi.cs | 0 .../GlobalUsing.cs | 0 .../IFoxCAD.AutoCad.csproj | 1 + IFoxCAD.sln | 4 +- Test/Test.csproj | 2 +- 63 files changed, 87 insertions(+), 2 deletions(-) rename {IFoxCAD.Cad => CADShared}/Basal/General/ArrayEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/Basal/General/DebugHelper.cs (100%) rename {IFoxCAD.Cad => CADShared}/Basal/General/EnumEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/Basal/General/LinqEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/Basal/General/LoopList.cs (100%) rename {IFoxCAD.Cad => CADShared}/Basal/General/LoopState.cs (100%) rename {IFoxCAD.Cad => CADShared}/Basal/Nullable/ArgumentNullEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/Basal/Nullable/CallerArgumentExpressionAttribute.cs (100%) rename {IFoxCAD.Cad => CADShared}/Basal/Win/SystemEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/Basal/Win/Win32Api.cs (100%) create mode 100644 CADShared/CADShared.projitems create mode 100644 CADShared/CADShared.shproj rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/CollectionEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/DBDictionaryEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/DBObjectEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/EditorEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Entity/BlockReferenceEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Entity/BoundingInfo.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Entity/CircleEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Entity/EntityBoundingInfo.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Entity/EntityEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Entity/PolylineEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Enums.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Geomerty/Curve2dEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Geomerty/Curve3dEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Geomerty/GeometryEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Geomerty/PointEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Jig/JigEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/Jig/JigExTransient.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/ObjectIdEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/RedrawEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/SelectionSetEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/SingleKeyWordHook.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/SymbolTableEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/SymbolTableRecordEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/TangentEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/TransactionEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/ExtensionMethod/WindowEx.cs (100%) rename {IFoxCAD.Cad => CADShared}/Initialize/AcadEMR.cs (100%) rename {IFoxCAD.Cad => CADShared}/Initialize/AssemInfo.cs (100%) rename {IFoxCAD.Cad => CADShared}/Initialize/AutoReg.cs (100%) rename {IFoxCAD.Cad => CADShared}/Initialize/AutoRegAssem.cs (100%) rename {IFoxCAD.Cad => CADShared}/Initialize/CheckFactory.cs (100%) rename {IFoxCAD.Cad => CADShared}/Initialize/IAutoGo.cs (100%) rename {IFoxCAD.Cad => CADShared}/Initialize/MethodInfoHelper.cs (100%) rename {IFoxCAD.Cad => CADShared}/ResultData/LispList.cs (100%) rename {IFoxCAD.Cad => CADShared}/ResultData/TypedValueList.cs (100%) rename {IFoxCAD.Cad => CADShared}/ResultData/XDataList.cs (100%) rename {IFoxCAD.Cad => CADShared}/ResultData/XRecordDataList.cs (100%) rename {IFoxCAD.Cad => CADShared}/Runtime/DBTrans.cs (100%) rename {IFoxCAD.Cad => CADShared}/Runtime/Env.cs (100%) rename {IFoxCAD.Cad => CADShared}/Runtime/IdleAction.cs (100%) rename {IFoxCAD.Cad => CADShared}/Runtime/IdleNoCommandAction.cs (100%) rename {IFoxCAD.Cad => CADShared}/Runtime/SymbolTable.cs (100%) rename {IFoxCAD.Cad => CADShared}/SelectionFilter/OpComp.cs (100%) rename {IFoxCAD.Cad => CADShared}/SelectionFilter/OpEqual.cs (100%) rename {IFoxCAD.Cad => CADShared}/SelectionFilter/OpFilter.cs (100%) rename {IFoxCAD.Cad => CADShared}/SelectionFilter/OpList.cs (100%) rename {IFoxCAD.Cad => CADShared}/SelectionFilter/OpLogi.cs (100%) rename {IFoxCAD.Cad => IFoxCAD.AutoCad}/GlobalUsing.cs (100%) rename IFoxCAD.Cad/IFoxCAD.Cad.csproj => IFoxCAD.AutoCad/IFoxCAD.AutoCad.csproj (94%) diff --git a/IFoxCAD.Cad/Basal/General/ArrayEx.cs b/CADShared/Basal/General/ArrayEx.cs similarity index 100% rename from IFoxCAD.Cad/Basal/General/ArrayEx.cs rename to CADShared/Basal/General/ArrayEx.cs diff --git a/IFoxCAD.Cad/Basal/General/DebugHelper.cs b/CADShared/Basal/General/DebugHelper.cs similarity index 100% rename from IFoxCAD.Cad/Basal/General/DebugHelper.cs rename to CADShared/Basal/General/DebugHelper.cs diff --git a/IFoxCAD.Cad/Basal/General/EnumEx.cs b/CADShared/Basal/General/EnumEx.cs similarity index 100% rename from IFoxCAD.Cad/Basal/General/EnumEx.cs rename to CADShared/Basal/General/EnumEx.cs diff --git a/IFoxCAD.Cad/Basal/General/LinqEx.cs b/CADShared/Basal/General/LinqEx.cs similarity index 100% rename from IFoxCAD.Cad/Basal/General/LinqEx.cs rename to CADShared/Basal/General/LinqEx.cs diff --git a/IFoxCAD.Cad/Basal/General/LoopList.cs b/CADShared/Basal/General/LoopList.cs similarity index 100% rename from IFoxCAD.Cad/Basal/General/LoopList.cs rename to CADShared/Basal/General/LoopList.cs diff --git a/IFoxCAD.Cad/Basal/General/LoopState.cs b/CADShared/Basal/General/LoopState.cs similarity index 100% rename from IFoxCAD.Cad/Basal/General/LoopState.cs rename to CADShared/Basal/General/LoopState.cs diff --git a/IFoxCAD.Cad/Basal/Nullable/ArgumentNullEx.cs b/CADShared/Basal/Nullable/ArgumentNullEx.cs similarity index 100% rename from IFoxCAD.Cad/Basal/Nullable/ArgumentNullEx.cs rename to CADShared/Basal/Nullable/ArgumentNullEx.cs diff --git a/IFoxCAD.Cad/Basal/Nullable/CallerArgumentExpressionAttribute.cs b/CADShared/Basal/Nullable/CallerArgumentExpressionAttribute.cs similarity index 100% rename from IFoxCAD.Cad/Basal/Nullable/CallerArgumentExpressionAttribute.cs rename to CADShared/Basal/Nullable/CallerArgumentExpressionAttribute.cs diff --git a/IFoxCAD.Cad/Basal/Win/SystemEx.cs b/CADShared/Basal/Win/SystemEx.cs similarity index 100% rename from IFoxCAD.Cad/Basal/Win/SystemEx.cs rename to CADShared/Basal/Win/SystemEx.cs diff --git a/IFoxCAD.Cad/Basal/Win/Win32Api.cs b/CADShared/Basal/Win/Win32Api.cs similarity index 100% rename from IFoxCAD.Cad/Basal/Win/Win32Api.cs rename to CADShared/Basal/Win/Win32Api.cs diff --git a/CADShared/CADShared.projitems b/CADShared/CADShared.projitems new file mode 100644 index 0000000..bab98e0 --- /dev/null +++ b/CADShared/CADShared.projitems @@ -0,0 +1,70 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + 00D9188F-646C-4E1A-AD53-5F6C0754346F + + + CADShared + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CADShared/CADShared.shproj b/CADShared/CADShared.shproj new file mode 100644 index 0000000..d138ef0 --- /dev/null +++ b/CADShared/CADShared.shproj @@ -0,0 +1,12 @@ + + + + {5178502E-9A78-4588-B849-33ED439976B2} + + + + + + + diff --git a/IFoxCAD.Cad/ExtensionMethod/CollectionEx.cs b/CADShared/ExtensionMethod/CollectionEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/CollectionEx.cs rename to CADShared/ExtensionMethod/CollectionEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/DBDictionaryEx.cs b/CADShared/ExtensionMethod/DBDictionaryEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/DBDictionaryEx.cs rename to CADShared/ExtensionMethod/DBDictionaryEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/DBObjectEx.cs b/CADShared/ExtensionMethod/DBObjectEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/DBObjectEx.cs rename to CADShared/ExtensionMethod/DBObjectEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/EditorEx.cs b/CADShared/ExtensionMethod/EditorEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/EditorEx.cs rename to CADShared/ExtensionMethod/EditorEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Entity/BlockReferenceEx.cs b/CADShared/ExtensionMethod/Entity/BlockReferenceEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Entity/BlockReferenceEx.cs rename to CADShared/ExtensionMethod/Entity/BlockReferenceEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Entity/BoundingInfo.cs b/CADShared/ExtensionMethod/Entity/BoundingInfo.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Entity/BoundingInfo.cs rename to CADShared/ExtensionMethod/Entity/BoundingInfo.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Entity/CircleEx.cs b/CADShared/ExtensionMethod/Entity/CircleEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Entity/CircleEx.cs rename to CADShared/ExtensionMethod/Entity/CircleEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Entity/EntityBoundingInfo.cs b/CADShared/ExtensionMethod/Entity/EntityBoundingInfo.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Entity/EntityBoundingInfo.cs rename to CADShared/ExtensionMethod/Entity/EntityBoundingInfo.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Entity/EntityEx.cs b/CADShared/ExtensionMethod/Entity/EntityEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Entity/EntityEx.cs rename to CADShared/ExtensionMethod/Entity/EntityEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Entity/PolylineEx.cs b/CADShared/ExtensionMethod/Entity/PolylineEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Entity/PolylineEx.cs rename to CADShared/ExtensionMethod/Entity/PolylineEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Enums.cs b/CADShared/ExtensionMethod/Enums.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Enums.cs rename to CADShared/ExtensionMethod/Enums.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Geomerty/Curve2dEx.cs b/CADShared/ExtensionMethod/Geomerty/Curve2dEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Geomerty/Curve2dEx.cs rename to CADShared/ExtensionMethod/Geomerty/Curve2dEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Geomerty/Curve3dEx.cs b/CADShared/ExtensionMethod/Geomerty/Curve3dEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Geomerty/Curve3dEx.cs rename to CADShared/ExtensionMethod/Geomerty/Curve3dEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Geomerty/GeometryEx.cs b/CADShared/ExtensionMethod/Geomerty/GeometryEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Geomerty/GeometryEx.cs rename to CADShared/ExtensionMethod/Geomerty/GeometryEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Geomerty/PointEx.cs b/CADShared/ExtensionMethod/Geomerty/PointEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Geomerty/PointEx.cs rename to CADShared/ExtensionMethod/Geomerty/PointEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Jig/JigEx.cs b/CADShared/ExtensionMethod/Jig/JigEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Jig/JigEx.cs rename to CADShared/ExtensionMethod/Jig/JigEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/Jig/JigExTransient.cs b/CADShared/ExtensionMethod/Jig/JigExTransient.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/Jig/JigExTransient.cs rename to CADShared/ExtensionMethod/Jig/JigExTransient.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/ObjectIdEx.cs b/CADShared/ExtensionMethod/ObjectIdEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/ObjectIdEx.cs rename to CADShared/ExtensionMethod/ObjectIdEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/RedrawEx.cs b/CADShared/ExtensionMethod/RedrawEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/RedrawEx.cs rename to CADShared/ExtensionMethod/RedrawEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/SelectionSetEx.cs b/CADShared/ExtensionMethod/SelectionSetEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/SelectionSetEx.cs rename to CADShared/ExtensionMethod/SelectionSetEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/SingleKeyWordHook.cs b/CADShared/ExtensionMethod/SingleKeyWordHook.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/SingleKeyWordHook.cs rename to CADShared/ExtensionMethod/SingleKeyWordHook.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/SymbolTableEx.cs b/CADShared/ExtensionMethod/SymbolTableEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/SymbolTableEx.cs rename to CADShared/ExtensionMethod/SymbolTableEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/SymbolTableRecordEx.cs b/CADShared/ExtensionMethod/SymbolTableRecordEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/SymbolTableRecordEx.cs rename to CADShared/ExtensionMethod/SymbolTableRecordEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/TangentEx.cs b/CADShared/ExtensionMethod/TangentEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/TangentEx.cs rename to CADShared/ExtensionMethod/TangentEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/TransactionEx.cs b/CADShared/ExtensionMethod/TransactionEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/TransactionEx.cs rename to CADShared/ExtensionMethod/TransactionEx.cs diff --git a/IFoxCAD.Cad/ExtensionMethod/WindowEx.cs b/CADShared/ExtensionMethod/WindowEx.cs similarity index 100% rename from IFoxCAD.Cad/ExtensionMethod/WindowEx.cs rename to CADShared/ExtensionMethod/WindowEx.cs diff --git a/IFoxCAD.Cad/Initialize/AcadEMR.cs b/CADShared/Initialize/AcadEMR.cs similarity index 100% rename from IFoxCAD.Cad/Initialize/AcadEMR.cs rename to CADShared/Initialize/AcadEMR.cs diff --git a/IFoxCAD.Cad/Initialize/AssemInfo.cs b/CADShared/Initialize/AssemInfo.cs similarity index 100% rename from IFoxCAD.Cad/Initialize/AssemInfo.cs rename to CADShared/Initialize/AssemInfo.cs diff --git a/IFoxCAD.Cad/Initialize/AutoReg.cs b/CADShared/Initialize/AutoReg.cs similarity index 100% rename from IFoxCAD.Cad/Initialize/AutoReg.cs rename to CADShared/Initialize/AutoReg.cs diff --git a/IFoxCAD.Cad/Initialize/AutoRegAssem.cs b/CADShared/Initialize/AutoRegAssem.cs similarity index 100% rename from IFoxCAD.Cad/Initialize/AutoRegAssem.cs rename to CADShared/Initialize/AutoRegAssem.cs diff --git a/IFoxCAD.Cad/Initialize/CheckFactory.cs b/CADShared/Initialize/CheckFactory.cs similarity index 100% rename from IFoxCAD.Cad/Initialize/CheckFactory.cs rename to CADShared/Initialize/CheckFactory.cs diff --git a/IFoxCAD.Cad/Initialize/IAutoGo.cs b/CADShared/Initialize/IAutoGo.cs similarity index 100% rename from IFoxCAD.Cad/Initialize/IAutoGo.cs rename to CADShared/Initialize/IAutoGo.cs diff --git a/IFoxCAD.Cad/Initialize/MethodInfoHelper.cs b/CADShared/Initialize/MethodInfoHelper.cs similarity index 100% rename from IFoxCAD.Cad/Initialize/MethodInfoHelper.cs rename to CADShared/Initialize/MethodInfoHelper.cs diff --git a/IFoxCAD.Cad/ResultData/LispList.cs b/CADShared/ResultData/LispList.cs similarity index 100% rename from IFoxCAD.Cad/ResultData/LispList.cs rename to CADShared/ResultData/LispList.cs diff --git a/IFoxCAD.Cad/ResultData/TypedValueList.cs b/CADShared/ResultData/TypedValueList.cs similarity index 100% rename from IFoxCAD.Cad/ResultData/TypedValueList.cs rename to CADShared/ResultData/TypedValueList.cs diff --git a/IFoxCAD.Cad/ResultData/XDataList.cs b/CADShared/ResultData/XDataList.cs similarity index 100% rename from IFoxCAD.Cad/ResultData/XDataList.cs rename to CADShared/ResultData/XDataList.cs diff --git a/IFoxCAD.Cad/ResultData/XRecordDataList.cs b/CADShared/ResultData/XRecordDataList.cs similarity index 100% rename from IFoxCAD.Cad/ResultData/XRecordDataList.cs rename to CADShared/ResultData/XRecordDataList.cs diff --git a/IFoxCAD.Cad/Runtime/DBTrans.cs b/CADShared/Runtime/DBTrans.cs similarity index 100% rename from IFoxCAD.Cad/Runtime/DBTrans.cs rename to CADShared/Runtime/DBTrans.cs diff --git a/IFoxCAD.Cad/Runtime/Env.cs b/CADShared/Runtime/Env.cs similarity index 100% rename from IFoxCAD.Cad/Runtime/Env.cs rename to CADShared/Runtime/Env.cs diff --git a/IFoxCAD.Cad/Runtime/IdleAction.cs b/CADShared/Runtime/IdleAction.cs similarity index 100% rename from IFoxCAD.Cad/Runtime/IdleAction.cs rename to CADShared/Runtime/IdleAction.cs diff --git a/IFoxCAD.Cad/Runtime/IdleNoCommandAction.cs b/CADShared/Runtime/IdleNoCommandAction.cs similarity index 100% rename from IFoxCAD.Cad/Runtime/IdleNoCommandAction.cs rename to CADShared/Runtime/IdleNoCommandAction.cs diff --git a/IFoxCAD.Cad/Runtime/SymbolTable.cs b/CADShared/Runtime/SymbolTable.cs similarity index 100% rename from IFoxCAD.Cad/Runtime/SymbolTable.cs rename to CADShared/Runtime/SymbolTable.cs diff --git a/IFoxCAD.Cad/SelectionFilter/OpComp.cs b/CADShared/SelectionFilter/OpComp.cs similarity index 100% rename from IFoxCAD.Cad/SelectionFilter/OpComp.cs rename to CADShared/SelectionFilter/OpComp.cs diff --git a/IFoxCAD.Cad/SelectionFilter/OpEqual.cs b/CADShared/SelectionFilter/OpEqual.cs similarity index 100% rename from IFoxCAD.Cad/SelectionFilter/OpEqual.cs rename to CADShared/SelectionFilter/OpEqual.cs diff --git a/IFoxCAD.Cad/SelectionFilter/OpFilter.cs b/CADShared/SelectionFilter/OpFilter.cs similarity index 100% rename from IFoxCAD.Cad/SelectionFilter/OpFilter.cs rename to CADShared/SelectionFilter/OpFilter.cs diff --git a/IFoxCAD.Cad/SelectionFilter/OpList.cs b/CADShared/SelectionFilter/OpList.cs similarity index 100% rename from IFoxCAD.Cad/SelectionFilter/OpList.cs rename to CADShared/SelectionFilter/OpList.cs diff --git a/IFoxCAD.Cad/SelectionFilter/OpLogi.cs b/CADShared/SelectionFilter/OpLogi.cs similarity index 100% rename from IFoxCAD.Cad/SelectionFilter/OpLogi.cs rename to CADShared/SelectionFilter/OpLogi.cs diff --git a/IFoxCAD.Cad/GlobalUsing.cs b/IFoxCAD.AutoCad/GlobalUsing.cs similarity index 100% rename from IFoxCAD.Cad/GlobalUsing.cs rename to IFoxCAD.AutoCad/GlobalUsing.cs diff --git a/IFoxCAD.Cad/IFoxCAD.Cad.csproj b/IFoxCAD.AutoCad/IFoxCAD.AutoCad.csproj similarity index 94% rename from IFoxCAD.Cad/IFoxCAD.Cad.csproj rename to IFoxCAD.AutoCad/IFoxCAD.AutoCad.csproj index 29ebc51..09590ae 100644 --- a/IFoxCAD.Cad/IFoxCAD.Cad.csproj +++ b/IFoxCAD.AutoCad/IFoxCAD.AutoCad.csproj @@ -34,4 +34,5 @@ + diff --git a/IFoxCAD.sln b/IFoxCAD.sln index 1e17231..02a5e11 100644 --- a/IFoxCAD.sln +++ b/IFoxCAD.sln @@ -3,10 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34309.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IFoxCAD.Cad", "IFoxCAD.Cad\IFoxCAD.Cad.csproj", "{6B29955A-5796-4035-9297-210FA15D3846}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IFoxCAD.AutoCad", "IFoxCAD.AutoCad\IFoxCAD.AutoCad.csproj", "{6B29955A-5796-4035-9297-210FA15D3846}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", "{0C01F295-0985-436B-A15D-228877C60F1D}" EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CADShared", "CADShared\CADShared.shproj", "{5178502E-9A78-4588-B849-33ED439976B2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Test/Test.csproj b/Test/Test.csproj index c0139b4..c110209 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -8,7 +8,7 @@ - + -- Gitee