Browse Source

1. 新增Windows窗体示例
2. 新增Windows动画效果示例

Shun 2 years ago
parent
commit
ff43101f24

File diff suppressed because it is too large
+ 9 - 0
src/YSAI.Core.Wpf/resources/svg/WindowSvg.xaml


+ 17 - 0
src/YSAI.DAQ.sln

@@ -91,6 +91,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.Core.Wpf", "YSAI.Core.
 EndProject
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.Tool.Wpf", "YSAI.Tool.Wpf\YSAI.Tool.Wpf.csproj", "{7230DFDC-3287-48A7-B5AF-FB97F211ABB8}"
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.Tool.Wpf", "YSAI.Tool.Wpf\YSAI.Tool.Wpf.csproj", "{7230DFDC-3287-48A7-B5AF-FB97F211ABB8}"
 EndProject
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{ACE972C1-709F-4074-B085-300D80488AAC}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.Windows.Samples", "YSAI.Windows.Samples\YSAI.Windows.Samples.csproj", "{8E8BFF57-ECC4-4D81-A483-A39ABF899838}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.Windows.Anime.Samples", "YSAI.Windows.Anime.Samples\YSAI.Windows.Anime.Samples.csproj", "{A2F3A1D2-2165-403F-B0CE-311ECF807D33}"
+EndProject
 Global
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
 		Debug|Any CPU = Debug|Any CPU
@@ -233,6 +239,14 @@ Global
 		{7230DFDC-3287-48A7-B5AF-FB97F211ABB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{7230DFDC-3287-48A7-B5AF-FB97F211ABB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{7230DFDC-3287-48A7-B5AF-FB97F211ABB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{7230DFDC-3287-48A7-B5AF-FB97F211ABB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{7230DFDC-3287-48A7-B5AF-FB97F211ABB8}.Release|Any CPU.Build.0 = Release|Any CPU
 		{7230DFDC-3287-48A7-B5AF-FB97F211ABB8}.Release|Any CPU.Build.0 = Release|Any CPU
+		{8E8BFF57-ECC4-4D81-A483-A39ABF899838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{8E8BFF57-ECC4-4D81-A483-A39ABF899838}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{8E8BFF57-ECC4-4D81-A483-A39ABF899838}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{8E8BFF57-ECC4-4D81-A483-A39ABF899838}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A2F3A1D2-2165-403F-B0CE-311ECF807D33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A2F3A1D2-2165-403F-B0CE-311ECF807D33}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A2F3A1D2-2165-403F-B0CE-311ECF807D33}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A2F3A1D2-2165-403F-B0CE-311ECF807D33}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 		HideSolutionNode = FALSE
@@ -275,6 +289,9 @@ Global
 		{297E1B53-0E64-464C-A813-965FB7EBE7C2} = {8A8EF816-E6C4-4E0B-8B92-99EE8CE85EED}
 		{297E1B53-0E64-464C-A813-965FB7EBE7C2} = {8A8EF816-E6C4-4E0B-8B92-99EE8CE85EED}
 		{FF5BDE58-1EBD-4AFF-81DE-B1B5EF7BDFC6} = {8A8EF816-E6C4-4E0B-8B92-99EE8CE85EED}
 		{FF5BDE58-1EBD-4AFF-81DE-B1B5EF7BDFC6} = {8A8EF816-E6C4-4E0B-8B92-99EE8CE85EED}
 		{7230DFDC-3287-48A7-B5AF-FB97F211ABB8} = {8AB62EDF-2857-497A-889E-14A7CF88F107}
 		{7230DFDC-3287-48A7-B5AF-FB97F211ABB8} = {8AB62EDF-2857-497A-889E-14A7CF88F107}
+		{ACE972C1-709F-4074-B085-300D80488AAC} = {8AB62EDF-2857-497A-889E-14A7CF88F107}
+		{8E8BFF57-ECC4-4D81-A483-A39ABF899838} = {ACE972C1-709F-4074-B085-300D80488AAC}
+		{A2F3A1D2-2165-403F-B0CE-311ECF807D33} = {ACE972C1-709F-4074-B085-300D80488AAC}
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {5D5D3927-6714-40C0-84EA-44C5BA4C5E87}
 		SolutionGuid = {5D5D3927-6714-40C0-84EA-44C5BA4C5E87}

+ 1 - 1
src/YSAI.DB/YSAI.DB.csproj

@@ -16,7 +16,7 @@
     <Description>$(DescriptionType):$(DescriptionName) ( $(DescriptionDetails) )</Description>
     <Description>$(DescriptionType):$(DescriptionName) ( $(DescriptionDetails) )</Description>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Include="Dapper" Version="2.1.24" />
+    <PackageReference Include="Dapper" Version="2.1.28" />
     <PackageReference Include="MySql.Data" Version="8.2.0" />
     <PackageReference Include="MySql.Data" Version="8.2.0" />
     <PackageReference Include="System.Data.OracleClient" Version="1.0.8" />
     <PackageReference Include="System.Data.OracleClient" Version="1.0.8" />
     <PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
     <PackageReference Include="System.Data.SqlClient" Version="4.8.5" />

+ 11 - 7
src/YSAI.Langs/LangsHelper.cs

@@ -16,7 +16,7 @@ namespace YSAI.Langs
         /// <returns></returns>
         /// <returns></returns>
         public static string GetValue(string Key, string ResourceFileName = "Lang")
         public static string GetValue(string Key, string ResourceFileName = "Lang")
         {
         {
-            string assemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
+            string? assemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
             string fullKey = assemblyName + ":" + ResourceFileName + ":" + Key;
             string fullKey = assemblyName + ":" + ResourceFileName + ":" + Key;
             LocExtension locExtension = new LocExtension(fullKey);
             LocExtension locExtension = new LocExtension(fullKey);
             locExtension.ResolveLocalizedValue(out string localizedString);
             locExtension.ResolveLocalizedValue(out string localizedString);
@@ -68,14 +68,18 @@ namespace YSAI.Langs
         /// 防止边读边写
         /// 防止边读边写
         /// </summary>
         /// </summary>
         public static object Lang_Lock = new object();
         public static object Lang_Lock = new object();
-
-        public static string FuPath = AppDomain.CurrentDomain.BaseDirectory + "config"; //路径
+        /// <summary>
+        /// 路径
+        /// </summary>
+        public static string FuPath = AppDomain.CurrentDomain.BaseDirectory + "config";
+        /// <summary>
+        /// 文件地址
+        /// </summary>
         public static string LangPath = FuPath + "\\LangConfig.json";
         public static string LangPath = FuPath + "\\LangConfig.json";
-
         /// <summary>
         /// <summary>
         /// 配置数据
         /// 配置数据
         /// </summary>
         /// </summary>
-        public static ConfigData configData
+        public static ConfigData? configData
         {
         {
             get
             get
             {
             {
@@ -90,12 +94,12 @@ namespace YSAI.Langs
                                 Directory.CreateDirectory(FuPath);
                                 Directory.CreateDirectory(FuPath);
                             }
                             }
                             ConfigData _configData = new ConfigData() { LangName = "zh" };
                             ConfigData _configData = new ConfigData() { LangName = "zh" };
-                            FileTool.StringToFile(LangPath, JsonTool.JsonEntityToString(_configData));
+                            FileTool.StringToFile(LangPath, _configData.ToJson());
                             return _configData;
                             return _configData;
                         }
                         }
                         else
                         else
                         {
                         {
-                            return JsonTool.StringToJsonEntity<ConfigData>(FileTool.FileToString(LangPath));
+                            return FileTool.FileToString(LangPath).ToJsonEntity<ConfigData>();
                         }
                         }
                     }
                     }
                     catch (Exception ex)
                     catch (Exception ex)

+ 59 - 129
src/YSAI.Unility.Windows/ViewDynamicEffectTool.cs

@@ -35,7 +35,6 @@ namespace YSAI.Unility.Windows
 
 
  //by:Shunnet.top 2022/5/18
  //by:Shunnet.top 2022/5/18
 */
 */
-
     /// <summary>
     /// <summary>
     /// 控件拖动基类
     /// 控件拖动基类
     /// </summary>
     /// </summary>
@@ -61,74 +60,60 @@ namespace YSAI.Unility.Windows
                 InitMove();  //初始化移动
                 InitMove();  //初始化移动
             }
             }
         }
         }
-
         /// <summary>
         /// <summary>
         /// 容器边框颜色
         /// 容器边框颜色
         /// </summary>
         /// </summary>
         public SolidColorBrush BorderColor = new SolidColorBrush(Colors.Green);
         public SolidColorBrush BorderColor = new SolidColorBrush(Colors.Green);
-
         /// <summary>
         /// <summary>
         /// 容器边框线径
         /// 容器边框线径
         /// </summary>
         /// </summary>
         public Thickness BorderWireDiameter = new Thickness(1);
         public Thickness BorderWireDiameter = new Thickness(1);
-
         /// <summary>
         /// <summary>
         /// 容器边框透明度
         /// 容器边框透明度
         /// </summary>
         /// </summary>
         public double BorderOpacity = 0;
         public double BorderOpacity = 0;
-
         /// <summary>
         /// <summary>
         /// 拖拽装饰器的内圈颜色
         /// 拖拽装饰器的内圈颜色
         /// </summary>
         /// </summary>
         public SolidColorBrush ThumbInnerColor = new SolidColorBrush(Colors.Red);
         public SolidColorBrush ThumbInnerColor = new SolidColorBrush(Colors.Red);
-
         /// <summary>
         /// <summary>
         /// 拖拽装饰器的外圈颜色
         /// 拖拽装饰器的外圈颜色
         /// </summary>
         /// </summary>
         public SolidColorBrush ThumbOuterColor = new SolidColorBrush(Colors.Red);
         public SolidColorBrush ThumbOuterColor = new SolidColorBrush(Colors.Red);
-
         /// <summary>
         /// <summary>
         /// 装饰器线径
         /// 装饰器线径
         /// </summary>
         /// </summary>
         public double ThumbWireDiameter = 1;
         public double ThumbWireDiameter = 1;
-
         /// <summary>
         /// <summary>
         /// 装饰器透明度
         /// 装饰器透明度
         /// </summary>
         /// </summary>
         public double ThumbOpacity = 0.6;
         public double ThumbOpacity = 0.6;
-
         /// <summary>
         /// <summary>
         /// 拖拽最小的宽
         /// 拖拽最小的宽
         /// </summary>
         /// </summary>
         public double MinWidths = 100;
         public double MinWidths = 100;
-
         /// <summary>
         /// <summary>
         /// 拖拽最小的高
         /// 拖拽最小的高
         /// </summary>
         /// </summary>
         public double MinHeights = 100;
         public double MinHeights = 100;
-
         /// <summary>
         /// <summary>
         /// 拖拽最大的宽
         /// 拖拽最大的宽
         /// </summary>
         /// </summary>
         public double MaxWidths = 500;
         public double MaxWidths = 500;
-
         /// <summary>
         /// <summary>
         /// 拖拽最大的高
         /// 拖拽最大的高
         /// </summary>
         /// </summary>
         public double MaxHeights = 500;
         public double MaxHeights = 500;
 
 
         #region 私有字段
         #region 私有字段
-
         /// <summary>
         /// <summary>
         /// 4条边
         /// 4条边
         /// </summary>
         /// </summary>
-        private Thumb LeftThumb, TopThumb, RightThumb, BottomThumb;
-
+        Thumb LeftThumb, TopThumb, RightThumb, BottomThumb;
         /// <summary>
         /// <summary>
         /// 4个角
         /// 4个角
         /// </summary>
         /// </summary>
-        private Thumb LefTopThumb, RightTopThumb, RightBottomThumb, LeftbottomThumb;
-
+        Thumb LefTopThumb, RightTopThumb, RightBottomThumb, LeftbottomThumb;
         /// <summary>
         /// <summary>
         /// 中间  目前暂不使用
         /// 中间  目前暂不使用
         /// </summary>
         /// </summary>
@@ -136,42 +121,35 @@ namespace YSAI.Unility.Windows
         /// <summary>
         /// <summary>
         /// 布局容器,如果不使用布局容器,则需要给上述8个控件布局,实现和Grid布局定位是一样的,会比较繁琐且意义不大。
         /// 布局容器,如果不使用布局容器,则需要给上述8个控件布局,实现和Grid布局定位是一样的,会比较繁琐且意义不大。
         /// </summary>
         /// </summary>
-        private Grid Llayout;
+        Grid Llayout;
 
 
         /// <summary>
         /// <summary>
         /// 要拖动的控件
         /// 要拖动的控件
         /// </summary>
         /// </summary>
-        private readonly UIElement Controls;
-
+        readonly UIElement Controls;
         /// <summary>
         /// <summary>
         /// 窗体的布局容器
         /// 窗体的布局容器
         /// </summary>
         /// </summary>
-        private readonly FrameworkElement LlayoutContainer;
-
+        readonly FrameworkElement LlayoutContainer;
         /// <summary>
         /// <summary>
         /// 鼠标是否按下
         /// 鼠标是否按下
         /// </summary>
         /// </summary>
-        private bool IsMouseDown = false;
-
+        bool IsMouseDown = false;
         /// <summary>
         /// <summary>
         /// 鼠标按下的位置
         /// 鼠标按下的位置
         /// </summary>
         /// </summary>
-        private Point MouseDownPosition;
-
+        Point MouseDownPosition;
         /// <summary>
         /// <summary>
         /// 鼠标按下控件的Margin
         /// 鼠标按下控件的Margin
         /// </summary>
         /// </summary>
-        private Thickness MouseDownMargin;
-
-        #endregion 私有字段
+        Thickness MouseDownMargin;
+        #endregion
 
 
         #region 重写方法
         #region 重写方法
-
         protected override Visual GetVisualChild(int index)
         protected override Visual GetVisualChild(int index)
         {
         {
             return Llayout;
             return Llayout;
         }
         }
-
         protected override int VisualChildrenCount
         protected override int VisualChildrenCount
         {
         {
             get
             get
@@ -179,18 +157,15 @@ namespace YSAI.Unility.Windows
                 return 1;
                 return 1;
             }
             }
         }
         }
-
         protected override Size ArrangeOverride(Size finalSize)
         protected override Size ArrangeOverride(Size finalSize)
         {
         {
             //直接给容器布局,容器内部的装饰器会自动布局。
             //直接给容器布局,容器内部的装饰器会自动布局。
             Llayout?.Arrange(new Rect(new Point(-LeftThumb.Width / 2, -LeftThumb.Height / 2), new Size(finalSize.Width + LeftThumb.Width, finalSize.Height + LeftThumb.Height)));
             Llayout?.Arrange(new Rect(new Point(-LeftThumb.Width / 2, -LeftThumb.Height / 2), new Size(finalSize.Width + LeftThumb.Width, finalSize.Height + LeftThumb.Height)));
             return finalSize;
             return finalSize;
         }
         }
-
-        #endregion 重写方法
+        #endregion
 
 
         #region 方法
         #region 方法
-
         /// <summary>
         /// <summary>
         /// 初始化拖拽大小
         /// 初始化拖拽大小
         /// </summary>
         /// </summary>
@@ -288,7 +263,6 @@ namespace YSAI.Unility.Windows
                 }
                 }
             }
             }
         }
         }
-
         /// <summary>
         /// <summary>
         /// 装饰器样式
         /// 装饰器样式
         /// </summary>
         /// </summary>
@@ -297,7 +271,7 @@ namespace YSAI.Unility.Windows
         /// <param name="WireDiameter">线径</param>
         /// <param name="WireDiameter">线径</param>
         /// <param name="Opacity">透明度</param>
         /// <param name="Opacity">透明度</param>
         /// <returns></returns>
         /// <returns></returns>
-        private FrameworkElementFactory GetFactory(System.Windows.Media.Brush InnerColor, System.Windows.Media.Brush OuterColor, double WireDiameter)
+        FrameworkElementFactory GetFactory(System.Windows.Media.Brush InnerColor, System.Windows.Media.Brush OuterColor, double WireDiameter)
         {
         {
             FrameworkElementFactory Element = new FrameworkElementFactory(typeof(Ellipse));  //绘制椭圆形元素
             FrameworkElementFactory Element = new FrameworkElementFactory(typeof(Ellipse));  //绘制椭圆形元素
             Element.SetValue(Ellipse.FillProperty, InnerColor);  //内圈色
             Element.SetValue(Ellipse.FillProperty, InnerColor);  //内圈色
@@ -316,11 +290,9 @@ namespace YSAI.Unility.Windows
             Controls.MouseLeftButtonUp += Control_MouseLeftButtonUp;   //鼠标左键松开
             Controls.MouseLeftButtonUp += Control_MouseLeftButtonUp;   //鼠标左键松开
             Controls.MouseMove += Control_MouseMove;   //鼠标移动
             Controls.MouseMove += Control_MouseMove;   //鼠标移动
         }
         }
-
-        #endregion 方法
+        #endregion
 
 
         #region 事件
         #region 事件
-
         //拖拽大小逻辑
         //拖拽大小逻辑
         private void Control_DragDelta(object sender, DragDeltaEventArgs e)
         private void Control_DragDelta(object sender, DragDeltaEventArgs e)
         {
         {
@@ -385,7 +357,6 @@ namespace YSAI.Unility.Windows
             MouseDownMargin = c.Margin;
             MouseDownMargin = c.Margin;
             c.CaptureMouse();
             c.CaptureMouse();
         }
         }
-
         //鼠标左键松开
         //鼠标左键松开
         private void Control_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
         private void Control_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
         {
         {
@@ -393,7 +364,6 @@ namespace YSAI.Unility.Windows
             IsMouseDown = false;
             IsMouseDown = false;
             c.ReleaseMouseCapture();
             c.ReleaseMouseCapture();
         }
         }
-
         //鼠标移动
         //鼠标移动
         private void Control_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
         private void Control_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
         {
         {
@@ -418,10 +388,8 @@ namespace YSAI.Unility.Windows
                 //double ControlBottom = point.Y + c.Height;  //下
                 //double ControlBottom = point.Y + c.Height;  //下
             }
             }
         }
         }
-
-        #endregion 事件
+        #endregion
     }
     }
-
     /// <summary>
     /// <summary>
     /// 控件拖动实现类
     /// 控件拖动实现类
     /// </summary>
     /// </summary>
@@ -433,8 +401,7 @@ namespace YSAI.Unility.Windows
         /// AdornerLayer:装饰器
         /// AdornerLayer:装饰器
         /// DragControlsBase:装饰器实现类
         /// DragControlsBase:装饰器实现类
         /// </summary>
         /// </summary>
-        private readonly Dictionary<UIElement, Tuple<AdornerLayer, DragControlsBase>> DictionaryDataList = new Dictionary<UIElement, Tuple<AdornerLayer, DragControlsBase>>();
-
+        readonly Dictionary<UIElement, Tuple<AdornerLayer, DragControlsBase>> DictionaryDataList = new Dictionary<UIElement, Tuple<AdornerLayer, DragControlsBase>>();
         /// <summary>
         /// <summary>
         /// 添加项
         /// 添加项
         /// </summary>
         /// </summary>
@@ -463,7 +430,6 @@ namespace YSAI.Unility.Windows
             }
             }
             return Message;
             return Message;
         }
         }
-
         /// <summary>
         /// <summary>
         /// 移除拖动
         /// 移除拖动
         /// </summary>
         /// </summary>
@@ -476,7 +442,6 @@ namespace YSAI.Unility.Windows
                 Delete(Controls);   //在集合移除此项
                 Delete(Controls);   //在集合移除此项
             }
             }
         }
         }
-
         /// <summary>
         /// <summary>
         /// 删除此项
         /// 删除此项
         /// </summary>
         /// </summary>
@@ -495,10 +460,9 @@ namespace YSAI.Unility.Windows
      */
      */
 
 
     #region 后端代码
     #region 后端代码
-
     /*
     /*
     	/// <summary>
     	/// <summary>
-        /// 三合一
+        /// 三合一  
         /// 单个窗体中只能定义一个布局容器,这个布局容器,不能设置Margin,不能设置固定宽高
         /// 单个窗体中只能定义一个布局容器,这个布局容器,不能设置Margin,不能设置固定宽高
         /// </summary>
         /// </summary>
         DragControlsAnimate dragControlsAnimate;
         DragControlsAnimate dragControlsAnimate;
@@ -537,7 +501,6 @@ namespace YSAI.Unility.Windows
                     IsMove = false;
                     IsMove = false;
                     IsDragSize =false;
                     IsDragSize =false;
                     break;
                     break;
-
                 case "ConShow2":
                 case "ConShow2":
                     NewControl = InitControls(1);
                     NewControl = InitControls(1);
                     IsMove = true;
                     IsMove = true;
@@ -552,14 +515,12 @@ namespace YSAI.Unility.Windows
         /// <param name="dashboardDataMode">图标类型</param>
         /// <param name="dashboardDataMode">图标类型</param>
         private Label InitControls(int A)
         private Label InitControls(int A)
         {
         {
-            return new Label() { Background = new SolidColorBrush(A == 0 ? Colors.AliceBlue : Colors.AntiqueWhite), Width = 100, Height = 100,Content= "自定义控件" };
+            return new Label() { Background = new SolidColorBrush(A == 0 ? Colors.AliceBlue : Colors.AntiqueWhite), Width = 100, Height = 100,Content= "自定义控件" }; 
         }
         }
     */
     */
-
-    #endregion 后端代码
+    #endregion
 
 
     #region 前端代码
     #region 前端代码
-
     /*
     /*
          <Window x:Class="WpfApp5.MainWindow"
          <Window x:Class="WpfApp5.MainWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
@@ -580,8 +541,7 @@ namespace YSAI.Unility.Windows
     </Window>
     </Window>
 
 
      */
      */
-
-    #endregion 前端代码
+    #endregion
 
 
     /// <summary>
     /// <summary>
     /// 拖拽控件动画 控件在拖动过程中显示,拖动完成也显示在拖动结束的位置
     /// 拖拽控件动画 控件在拖动过程中显示,拖动完成也显示在拖动结束的位置
@@ -603,55 +563,45 @@ namespace YSAI.Unility.Windows
             this.LlayoutContainer = LlayoutContainer;
             this.LlayoutContainer = LlayoutContainer;
             Windows.SizeChanged += Windwos_SizeChanged;
             Windows.SizeChanged += Windwos_SizeChanged;
         }
         }
-
         #region 私有字段
         #region 私有字段
-
         /// <summary>
         /// <summary>
         /// 高度偏移
         /// 高度偏移
         /// 拖动过度时,已经显示了要拖动的控件[半透明状态],鼠标默认是在中心位置,由于窗体样式原因,导致不在中心点位置,所以加上了偏移
         /// 拖动过度时,已经显示了要拖动的控件[半透明状态],鼠标默认是在中心位置,由于窗体样式原因,导致不在中心点位置,所以加上了偏移
         /// </summary>
         /// </summary>
-        private double HeightOffset { get; set; }
-
+        double HeightOffset { get; set; }
         /// <summary>
         /// <summary>
         /// 宽度偏移
         /// 宽度偏移
         /// 拖动过度时,已经显示了要拖动的控件[半透明状态],鼠标默认是在中心位置,由于窗体样式原因,导致不在中心点位置,所以加上了偏移
         /// 拖动过度时,已经显示了要拖动的控件[半透明状态],鼠标默认是在中心位置,由于窗体样式原因,导致不在中心点位置,所以加上了偏移
         /// </summary>
         /// </summary>
-        private double WidthOffset { get; set; }
-
+        double WidthOffset { get; set; }
         /// <summary>
         /// <summary>
         /// 界面上已经生成的控件,也就是从哪个控件上拖动的集合
         /// 界面上已经生成的控件,也就是从哪个控件上拖动的集合
         /// </summary>
         /// </summary>
-        private readonly List<FrameworkElement> ShowControlsList = new List<FrameworkElement>();
-
+        readonly List<FrameworkElement> ShowControlsList = new List<FrameworkElement>();
         /// <summary>
         /// <summary>
         /// 窗体
         /// 窗体
         /// </summary>
         /// </summary>
-        private readonly FrameworkElement Windows;
-
+        readonly FrameworkElement Windows;
         /// <summary>
         /// <summary>
         /// 容器:让控件在这里面拖动
         /// 容器:让控件在这里面拖动
         /// </summary>
         /// </summary>
-        private readonly object LlayoutContainer;
-
+        readonly object LlayoutContainer;
         /// <summary>
         /// <summary>
         /// 鼠标是否按下
         /// 鼠标是否按下
         /// </summary>
         /// </summary>
-        private bool IsMouseDown = false;
-
+        bool IsMouseDown = false;
         /// <summary>
         /// <summary>
         /// 实时需要拖动的控件
         /// 实时需要拖动的控件
         /// </summary>
         /// </summary>
-        private FrameworkElement ControlsObj;
-
+        FrameworkElement ControlsObj;
         /// <summary>
         /// <summary>
         /// 拖拽大小与移动
         /// 拖拽大小与移动
         /// </summary>
         /// </summary>
-        private readonly DragControlsHelper dragControlsHelper = new DragControlsHelper();
+        readonly DragControlsHelper dragControlsHelper = new DragControlsHelper();
 
 
-        #endregion 私有字段
+        #endregion
 
 
         #region 方法
         #region 方法
-
         /// <summary>
         /// <summary>
         /// 动态修改偏移量
         /// 动态修改偏移量
         /// </summary>
         /// </summary>
@@ -684,7 +634,6 @@ namespace YSAI.Unility.Windows
             //创建拖动与拖拽大小
             //创建拖动与拖拽大小
             dragControlsHelper.Remove(Controls);
             dragControlsHelper.Remove(Controls);
         }
         }
-
         /// <summary>
         /// <summary>
         ///  添加需要拖动的组件
         ///  添加需要拖动的组件
         /// </summary>
         /// </summary>
@@ -697,7 +646,6 @@ namespace YSAI.Unility.Windows
                 ShowControlsList.Add(ControlsShow);
                 ShowControlsList.Add(ControlsShow);
             }
             }
         }
         }
-
         /// <summary>
         /// <summary>
         /// 移除拖动
         /// 移除拖动
         /// </summary>
         /// </summary>
@@ -710,7 +658,6 @@ namespace YSAI.Unility.Windows
                 ShowControlsList.Remove(ControlsShow);  //直接移除
                 ShowControlsList.Remove(ControlsShow);  //直接移除
             }
             }
         }
         }
-
         /// <summary>
         /// <summary>
         /// 创建事件
         /// 创建事件
         /// </summary>
         /// </summary>
@@ -725,7 +672,6 @@ namespace YSAI.Unility.Windows
             ControlsShow.PreviewMouseLeftButtonUp += ControlsShow_PreviewMouseLeftButtonUp;
             ControlsShow.PreviewMouseLeftButtonUp += ControlsShow_PreviewMouseLeftButtonUp;
             ControlsShow.PreviewMouseMove += ControlsShow_PreviewMouseMove;
             ControlsShow.PreviewMouseMove += ControlsShow_PreviewMouseMove;
         }
         }
-
         /// <summary>
         /// <summary>
         /// 移除事件
         /// 移除事件
         /// </summary>
         /// </summary>
@@ -737,7 +683,7 @@ namespace YSAI.Unility.Windows
             ControlsShow.PreviewMouseMove -= ControlsShow_PreviewMouseMove;
             ControlsShow.PreviewMouseMove -= ControlsShow_PreviewMouseMove;
         }
         }
 
 
-        #endregion 方法
+        #endregion
 
 
         #region 委托回调事件
         #region 委托回调事件
 
 
@@ -747,7 +693,6 @@ namespace YSAI.Unility.Windows
         /// <param name="ShowControl">在哪个控件上触发了拖拽</param>
         /// <param name="ShowControl">在哪个控件上触发了拖拽</param>
         /// <returns>返回已经创建了新的控件对象  -   是否需要移动   -  是否需要拖拽大小</returns>
         /// <returns>返回已经创建了新的控件对象  -   是否需要移动   -  是否需要拖拽大小</returns>
         public delegate (FrameworkElement NewControl, bool IsMove, bool IsDragSize) dragEvenTrigger(FrameworkElement ShowControl);
         public delegate (FrameworkElement NewControl, bool IsMove, bool IsDragSize) dragEvenTrigger(FrameworkElement ShowControl);
-
         /// <summary>
         /// <summary>
         /// 实现委托
         /// 实现委托
         /// </summary>
         /// </summary>
@@ -759,13 +704,11 @@ namespace YSAI.Unility.Windows
         /// <param name="Message">消息</param>
         /// <param name="Message">消息</param>
         /// <param name="element">哪个控件显示的消息</param>
         /// <param name="element">哪个控件显示的消息</param>
         public delegate void messageEvenTrigger(string Message, FrameworkElement element);
         public delegate void messageEvenTrigger(string Message, FrameworkElement element);
-
         /// <summary>
         /// <summary>
         /// 实现委托
         /// 实现委托
         /// </summary>
         /// </summary>
         public messageEvenTrigger MessageEvenTrigger;
         public messageEvenTrigger MessageEvenTrigger;
-
-        #endregion 委托回调事件
+        #endregion
 
 
         #region 执行事件
         #region 执行事件
 
 
@@ -802,6 +745,7 @@ namespace YSAI.Unility.Windows
             ControlsObj = null;
             ControlsObj = null;
         }
         }
 
 
+
         //当在已显示的控件左键点击后
         //当在已显示的控件左键点击后
         private void ControlsShow_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         private void ControlsShow_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
         {
@@ -843,8 +787,10 @@ namespace YSAI.Unility.Windows
                     double Right = Windows.ActualWidth - Left - ControlsObj.Width;
                     double Right = Windows.ActualWidth - Left - ControlsObj.Width;
                     double Bottom = Windows.ActualHeight - Top - ControlsObj.Height;
                     double Bottom = Windows.ActualHeight - Top - ControlsObj.Height;
 
 
+
                     ControlsObj.Margin = new Thickness(Left, Top, Right, Bottom);
                     ControlsObj.Margin = new Thickness(Left, Top, Right, Bottom);
 
 
+
                     layout.Children.Add(ControlsObj);
                     layout.Children.Add(ControlsObj);
                     //添加拖拽大小与移动
                     //添加拖拽大小与移动
                     MessageEvenTrigger(MoveAndDragSizeInsert(ControlsObj, Windows, IsMove, IsDragSize), sender as FrameworkElement);
                     MessageEvenTrigger(MoveAndDragSizeInsert(ControlsObj, Windows, IsMove, IsDragSize), sender as FrameworkElement);
@@ -857,6 +803,7 @@ namespace YSAI.Unility.Windows
             }
             }
         }
         }
 
 
+
         //当窗体大小改变,布局容器也要跟着改变大小
         //当窗体大小改变,布局容器也要跟着改变大小
         private void Windwos_SizeChanged(object sender, SizeChangedEventArgs e)
         private void Windwos_SizeChanged(object sender, SizeChangedEventArgs e)
         {
         {
@@ -874,10 +821,11 @@ namespace YSAI.Unility.Windows
                 layout.Height = window.ActualHeight;
                 layout.Height = window.ActualHeight;
             }
             }
         }
         }
+        #endregion
 
 
-        #endregion 执行事件
     }
     }
 
 
+
     /// <summary>
     /// <summary>
     /// 拖拽控件过度动画  使用一个特效控件,在拖动过程中显示,拖动完成隐藏清空   2022.09.15
     /// 拖拽控件过度动画  使用一个特效控件,在拖动过程中显示,拖动完成隐藏清空   2022.09.15
     /// </summary>
     /// </summary>
@@ -898,55 +846,44 @@ namespace YSAI.Unility.Windows
             this.LlayoutContainer = LlayoutContainer;
             this.LlayoutContainer = LlayoutContainer;
             Windows.SizeChanged += Windwos_SizeChanged;
             Windows.SizeChanged += Windwos_SizeChanged;
         }
         }
-
         #region 私有字段
         #region 私有字段
-
         /// <summary>
         /// <summary>
         /// 高度偏移
         /// 高度偏移
         /// 拖动过度时,已经显示了要拖动的控件[半透明状态],鼠标默认是在中心位置,由于窗体样式原因,导致不在中心点位置,所以加上了偏移
         /// 拖动过度时,已经显示了要拖动的控件[半透明状态],鼠标默认是在中心位置,由于窗体样式原因,导致不在中心点位置,所以加上了偏移
         /// </summary>
         /// </summary>
-        private double HeightOffset { get; set; }
-
+        double HeightOffset { get; set; }
         /// <summary>
         /// <summary>
         /// 宽度偏移
         /// 宽度偏移
         /// 拖动过度时,已经显示了要拖动的控件[半透明状态],鼠标默认是在中心位置,由于窗体样式原因,导致不在中心点位置,所以加上了偏移
         /// 拖动过度时,已经显示了要拖动的控件[半透明状态],鼠标默认是在中心位置,由于窗体样式原因,导致不在中心点位置,所以加上了偏移
         /// </summary>
         /// </summary>
-        private double WidthOffset { get; set; }
-
+        double WidthOffset { get; set; }
         /// <summary>
         /// <summary>
         /// 界面上已经生成的控件,也就是从哪个控件上拖动的集合
         /// 界面上已经生成的控件,也就是从哪个控件上拖动的集合
         /// </summary>
         /// </summary>
-        private readonly List<FrameworkElement> ShowControlsList = new List<FrameworkElement>();
-
+        readonly List<FrameworkElement> ShowControlsList = new List<FrameworkElement>();
         /// <summary>
         /// <summary>
         /// 窗体
         /// 窗体
         /// </summary>
         /// </summary>
-        private readonly FrameworkElement Windows;
-
+        readonly FrameworkElement Windows;
         /// <summary>
         /// <summary>
         /// 容器:让控件在这里面拖动
         /// 容器:让控件在这里面拖动
         /// </summary>
         /// </summary>
-        private readonly object LlayoutContainer;
-
+        readonly object LlayoutContainer;
         /// <summary>
         /// <summary>
         /// 鼠标是否按下
         /// 鼠标是否按下
         /// </summary>
         /// </summary>
-        private bool IsMouseDown = false;
-
+        bool IsMouseDown = false;
         /// <summary>
         /// <summary>
         /// 实时需要拖动的控件
         /// 实时需要拖动的控件
         /// </summary>
         /// </summary>
-        private FrameworkElement ControlsObj;
-
+        FrameworkElement ControlsObj;
         /// <summary>
         /// <summary>
         /// 拖拽大小与移动
         /// 拖拽大小与移动
         /// </summary>
         /// </summary>
-        private readonly DragControlsHelper dragControlsHelper = new DragControlsHelper();
-
-        #endregion 私有字段
+        readonly DragControlsHelper dragControlsHelper = new DragControlsHelper();
+        #endregion
 
 
         #region 方法
         #region 方法
-
         /// <summary>
         /// <summary>
         /// 动态修改偏移量
         /// 动态修改偏移量
         /// </summary>
         /// </summary>
@@ -957,7 +894,6 @@ namespace YSAI.Unility.Windows
             this.HeightOffset = HeightOffset;
             this.HeightOffset = HeightOffset;
             this.WidthOffset = WidthOffset;
             this.WidthOffset = WidthOffset;
         }
         }
-
         /// <summary>
         /// <summary>
         /// 移动与拖拽大小添加
         /// 移动与拖拽大小添加
         /// </summary>
         /// </summary>
@@ -979,7 +915,6 @@ namespace YSAI.Unility.Windows
             //创建拖动与拖拽大小
             //创建拖动与拖拽大小
             dragControlsHelper.Remove(Controls);
             dragControlsHelper.Remove(Controls);
         }
         }
-
         /// <summary>
         /// <summary>
         ///  添加需要拖动的组件
         ///  添加需要拖动的组件
         /// </summary>
         /// </summary>
@@ -992,7 +927,6 @@ namespace YSAI.Unility.Windows
                 ShowControlsList.Add(ControlsShow);
                 ShowControlsList.Add(ControlsShow);
             }
             }
         }
         }
-
         /// <summary>
         /// <summary>
         /// 移除拖动
         /// 移除拖动
         /// </summary>
         /// </summary>
@@ -1005,7 +939,6 @@ namespace YSAI.Unility.Windows
                 ShowControlsList.Remove(ControlsShow);  //直接移除
                 ShowControlsList.Remove(ControlsShow);  //直接移除
             }
             }
         }
         }
-
         /// <summary>
         /// <summary>
         /// 创建事件
         /// 创建事件
         /// </summary>
         /// </summary>
@@ -1020,7 +953,6 @@ namespace YSAI.Unility.Windows
             ControlsShow.PreviewMouseLeftButtonUp += ControlsShow_PreviewMouseLeftButtonUp;
             ControlsShow.PreviewMouseLeftButtonUp += ControlsShow_PreviewMouseLeftButtonUp;
             ControlsShow.PreviewMouseMove += ControlsShow_PreviewMouseMove;
             ControlsShow.PreviewMouseMove += ControlsShow_PreviewMouseMove;
         }
         }
-
         /// <summary>
         /// <summary>
         /// 移除事件
         /// 移除事件
         /// </summary>
         /// </summary>
@@ -1032,7 +964,7 @@ namespace YSAI.Unility.Windows
             ControlsShow.PreviewMouseMove -= ControlsShow_PreviewMouseMove;
             ControlsShow.PreviewMouseMove -= ControlsShow_PreviewMouseMove;
         }
         }
 
 
-        #endregion 方法
+        #endregion
 
 
         #region 委托回调事件
         #region 委托回调事件
 
 
@@ -1042,7 +974,6 @@ namespace YSAI.Unility.Windows
         /// <param name="ShowControl">在哪个控件上触发了拖拽</param>
         /// <param name="ShowControl">在哪个控件上触发了拖拽</param>
         /// <returns>返回已经创建了新的控件对象  -   是否需要移动   -  是否需要拖拽大小</returns>
         /// <returns>返回已经创建了新的控件对象  -   是否需要移动   -  是否需要拖拽大小</returns>
         public delegate (FrameworkElement NewControl, bool IsMove, bool IsDragSize) dragEvenTrigger(FrameworkElement ShowControl);
         public delegate (FrameworkElement NewControl, bool IsMove, bool IsDragSize) dragEvenTrigger(FrameworkElement ShowControl);
-
         /// <summary>
         /// <summary>
         /// 实现委托
         /// 实现委托
         /// </summary>
         /// </summary>
@@ -1057,12 +988,10 @@ namespace YSAI.Unility.Windows
             /// 按下
             /// 按下
             /// </summary>
             /// </summary>
             Down,
             Down,
-
             /// <summary>
             /// <summary>
             /// 松开
             /// 松开
             /// </summary>
             /// </summary>
             Up,
             Up,
-
             /// <summary>
             /// <summary>
             /// 移动
             /// 移动
             /// </summary>
             /// </summary>
@@ -1073,13 +1002,11 @@ namespace YSAI.Unility.Windows
         /// 动作事件 告诉外部,按钮目前的状态
         /// 动作事件 告诉外部,按钮目前的状态
         /// </summary>
         /// </summary>
         public delegate void actionEvenTrigger(ButtonState state, Button obj);
         public delegate void actionEvenTrigger(ButtonState state, Button obj);
-
         /// <summary>
         /// <summary>
         /// 实现委托
         /// 实现委托
         /// </summary>
         /// </summary>
         public actionEvenTrigger ActionEvenTrigger;
         public actionEvenTrigger ActionEvenTrigger;
-
-        #endregion 委托回调事件
+        #endregion
 
 
         #region 执行事件
         #region 执行事件
 
 
@@ -1118,12 +1045,13 @@ namespace YSAI.Unility.Windows
             ActionEvenTrigger(ButtonState.Up, sender as Button);
             ActionEvenTrigger(ButtonState.Up, sender as Button);
         }
         }
 
 
+
         //当在已显示的控件左键点击后
         //当在已显示的控件左键点击后
         private void ControlsShow_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         private void ControlsShow_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
         {
             if (LlayoutContainer.GetType().Equals(typeof(Canvas)))
             if (LlayoutContainer.GetType().Equals(typeof(Canvas)))
             {
             {
-                Canvas layout = LlayoutContainer as Canvas;
+                Canvas? layout = LlayoutContainer as Canvas;
                 (FrameworkElement element, bool IsMove, bool IsDragSize) = DragEvenTrigger(sender as FrameworkElement);
                 (FrameworkElement element, bool IsMove, bool IsDragSize) = DragEvenTrigger(sender as FrameworkElement);
                 ControlsObj = element;
                 ControlsObj = element;
                 if (!layout.Children.Contains(ControlsObj))
                 if (!layout.Children.Contains(ControlsObj))
@@ -1138,7 +1066,7 @@ namespace YSAI.Unility.Windows
             }
             }
             else if (LlayoutContainer.GetType().Equals(typeof(Grid)))
             else if (LlayoutContainer.GetType().Equals(typeof(Grid)))
             {
             {
-                Grid layout = LlayoutContainer as Grid;
+                Grid? layout = LlayoutContainer as Grid;
                 (FrameworkElement element, bool IsMove, bool IsDragSize) = DragEvenTrigger(sender as FrameworkElement);
                 (FrameworkElement element, bool IsMove, bool IsDragSize) = DragEvenTrigger(sender as FrameworkElement);
                 ControlsObj = element;
                 ControlsObj = element;
                 if (!layout.Children.Contains(ControlsObj))
                 if (!layout.Children.Contains(ControlsObj))
@@ -1158,13 +1086,14 @@ namespace YSAI.Unility.Windows
             ActionEvenTrigger(ButtonState.Down, sender as Button);
             ActionEvenTrigger(ButtonState.Down, sender as Button);
         }
         }
 
 
+
         //当窗体大小改变,布局容器也要跟着改变大小
         //当窗体大小改变,布局容器也要跟着改变大小
         private void Windwos_SizeChanged(object sender, SizeChangedEventArgs e)
         private void Windwos_SizeChanged(object sender, SizeChangedEventArgs e)
         {
         {
-            FrameworkElement window = sender as FrameworkElement;
+            FrameworkElement? window = sender as FrameworkElement;
             if (LlayoutContainer.GetType().Equals(typeof(Canvas)))
             if (LlayoutContainer.GetType().Equals(typeof(Canvas)))
             {
             {
-                Canvas layout = LlayoutContainer as Canvas;
+                Canvas? layout = LlayoutContainer as Canvas;
                 layout.Width = window.ActualWidth;
                 layout.Width = window.ActualWidth;
                 layout.Height = window.ActualHeight;
                 layout.Height = window.ActualHeight;
             }
             }
@@ -1176,14 +1105,15 @@ namespace YSAI.Unility.Windows
             }
             }
         }
         }
 
 
+
         /// <summary>
         /// <summary>
         /// 控件消失
         /// 控件消失
         /// </summary>
         /// </summary>
         /// <param name="element">控件对象</param>
         /// <param name="element">控件对象</param>
-        private void ControlsVanish(object element)
+        void ControlsVanish(object element)
         {
         {
-            FrameworkElement fe = element as FrameworkElement;
-            double opacity = 1;//记录当前窗体的透明度
+            FrameworkElement? fe = element as FrameworkElement;
+            double opacity = 1;//记录当前窗体的透明度  
             while (true)
             while (true)
             {
             {
                 Application.Current.Dispatcher.Invoke(new Action(() =>
                 Application.Current.Dispatcher.Invoke(new Action(() =>
@@ -1195,7 +1125,7 @@ namespace YSAI.Unility.Windows
                 {
                 {
                     if (LlayoutContainer.GetType().Equals(typeof(Canvas)))
                     if (LlayoutContainer.GetType().Equals(typeof(Canvas)))
                     {
                     {
-                        Canvas layout = LlayoutContainer as Canvas;
+                        Canvas? layout = LlayoutContainer as Canvas;
                         Application.Current.Dispatcher.Invoke(new Action(() =>
                         Application.Current.Dispatcher.Invoke(new Action(() =>
                         {
                         {
                             layout.Children.Remove(fe);
                             layout.Children.Remove(fe);
@@ -1203,7 +1133,7 @@ namespace YSAI.Unility.Windows
                     }
                     }
                     else if (LlayoutContainer.GetType().Equals(typeof(Grid)))
                     else if (LlayoutContainer.GetType().Equals(typeof(Grid)))
                     {
                     {
-                        Grid layout = LlayoutContainer as Grid;
+                        Grid? layout = LlayoutContainer as Grid;
                         Application.Current.Dispatcher.Invoke(new Action(() =>
                         Application.Current.Dispatcher.Invoke(new Action(() =>
                         {
                         {
                             layout.Children.Remove(fe);
                             layout.Children.Remove(fe);
@@ -1214,7 +1144,7 @@ namespace YSAI.Unility.Windows
                 Thread.Sleep(1);
                 Thread.Sleep(1);
             }
             }
         }
         }
+        #endregion
 
 
-        #endregion 执行事件
     }
     }
 }
 }

+ 14 - 0
src/YSAI.Windows.Anime.Samples/App.xaml

@@ -0,0 +1,14 @@
+<Application x:Class="YSAI.Windows.Anime.Samples.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:YSAI.Windows.Anime.Samples"
+             StartupUri="MainWindow.xaml">
+    <Application.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <!--加载默认样式-->
+                <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/themes/WindowTemplate_Black.xaml" />
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </Application.Resources>
+</Application>

+ 14 - 0
src/YSAI.Windows.Anime.Samples/App.xaml.cs

@@ -0,0 +1,14 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace YSAI.Windows.Anime.Samples
+{
+    /// <summary>
+    /// Interaction logic for App.xaml
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+
+}

+ 10 - 0
src/YSAI.Windows.Anime.Samples/AssemblyInfo.cs

@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None,            //where theme specific resource dictionaries are located
+                                                //(used if a resource is not found in the page,
+                                                // or application resource dictionaries)
+    ResourceDictionaryLocation.SourceAssembly   //where the generic resource dictionary is located
+                                                //(used if a resource is not found in the page,
+                                                // app, or any theme specific resource dictionaries)
+)]

+ 27 - 0
src/YSAI.Windows.Anime.Samples/MainWindow.xaml

@@ -0,0 +1,27 @@
+<sv:WindowBase x:Class="YSAI.Windows.Anime.Samples.MainWindow"
+               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+               xmlns:local="clr-namespace:YSAI.Windows.Anime.Samples"
+               xmlns:sv="clr-namespace:YSAI.Core.Wpf;assembly=YSAI.Core.Wpf"
+               Title="拖动动画效果演示DEMO" Height="450" Width="800" Icon="image\YSAI.ico" IsContentBackgroundPicture="True" WindowStartupLocation="CenterScreen">
+    <Grid>
+        <!--<AdornerDecorator>
+        <Canvas Name="Pane" Background="Black">
+        <Label Content="这是使用Canvas容器布局,单个窗体中只能定义一个布局容器,这个布局容器,不能设置Margin,不能设置固定宽高" Foreground="Red" FontWeight="Bold"/>
+        <Button Content="不能拖动" Width="90" Height="50" Name="ConShow1" VerticalAlignment="Top" HorizontalAlignment="Left"  Margin="0,30,0,0"/>
+        <Button Content="可以拖动" Width="90" Height="50" Name="ConShow2" VerticalAlignment="Top" HorizontalAlignment="Left"  Margin="100,30,0,0"/>
+        <Button Content="拖拽过度动画" Width="90" Height="50" Name="ConShow3" VerticalAlignment="Top" HorizontalAlignment="Left"  Margin="200,30,0,0" />
+        </Canvas>
+        </AdornerDecorator>-->
+        <AdornerDecorator >
+            <Grid Name="Pane">
+                <Label Content="这是使用GRID容器布局,单个窗体中只能定义一个布局容器,这个布局容器,不能设置Margin,不能设置固定宽高" Foreground="Red" FontWeight="Bold"/>
+                <Button Content="不能拖动" Width="90" Height="50" Name="ConShow1" VerticalAlignment="Top" HorizontalAlignment="Left"  Margin="0,30,0,0"/>
+                <Button Content="可以拖动" Width="90" Height="50" Name="ConShow2" VerticalAlignment="Top" HorizontalAlignment="Left"  Margin="100,30,0,0"/>
+                <Button Content="拖拽过度动画" Width="90" Height="50" Name="ConShow3" VerticalAlignment="Top" HorizontalAlignment="Left"  Margin="200,30,0,0"/>
+            </Grid>
+        </AdornerDecorator>
+    </Grid>
+</sv:WindowBase>

+ 134 - 0
src/YSAI.Windows.Anime.Samples/MainWindow.xaml.cs

@@ -0,0 +1,134 @@
+using System;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using YSAI.Core.Wpf;
+using YSAI.Core.Wpf.controls.badge;
+using YSAI.Unility.Windows;
+
+namespace YSAI.Windows.Anime.Samples
+{
+    /// <summary>
+    /// Interaction logic for MainWindow.xaml
+    /// </summary>
+    public partial class MainWindow : WindowBase
+    {
+        public MainWindow()
+        {
+            InitializeComponent();
+            //拖动
+            dragControlsAnimate = new DragControlsAnimate(this, Pane, -(double)this.FindResource("TitleHeight"));   //你得定义一个容器传容器对象或者Name
+            dragControlsAnimate.Insert(ConShow1);
+            dragControlsAnimate.Insert(ConShow2);
+            dragControlsAnimate.MessageEvenTrigger += MessageEvenTrigger;
+            dragControlsAnimate.DragEvenTrigger += DragEvenTrigger;
+
+            //拖动过度
+            dragControlsExcessiveAnimate = new DragControlsExcessiveAnimate(this, Pane, (double)this.FindResource("TitleHeight") + 5, 5);
+            dragControlsExcessiveAnimate.Insert(ConShow3); //添加动态拖动效果  ■
+            dragControlsExcessiveAnimate.DragEvenTrigger += DragEvenTrigger_DragControlsExcessiveAnimate;
+            dragControlsExcessiveAnimate.ActionEvenTrigger += ActionEvenTrigger;
+
+            //当皮肤切换触发事件
+            WindowHelper.OnSkinSwitchEvent += WindowHelper_OnSkinSwitchEvent;
+        }
+
+        private void WindowHelper_OnSkinSwitchEvent(object? sender, EventArgs e)
+        {
+            //窗体的样式边框 Margin="10" 所以宽度与高度偏移都得加10
+            //TitleHeight 标题的高度
+            dragControlsAnimate.DynamicUpdateOffset((double)this.FindResource("TitleHeight"), 0);
+
+
+            dragControlsExcessiveAnimate.DynamicUpdateOffset((double)this.FindResource("TitleHeight") + 5, 5);
+        }
+        //------------------------------------------------拖动------------------------------------------------------------
+
+        /// <summary>
+        /// 三合一  
+        /// 单个窗体中只能定义一个布局容器,这个布局容器,不能设置Margin,不能设置固定宽高
+        /// </summary>
+        DragControlsAnimate dragControlsAnimate;
+
+        /// <summary>
+        /// 消息
+        /// </summary>
+        /// <param name="Message">消息</param>
+        /// <param name="element">哪个控件显示的消息</param>
+        public void MessageEvenTrigger(string Message, FrameworkElement element)
+        {
+            Debug.WriteLine($"控件Name:{element.Name}->抛出消息:{Message}");
+        }
+        /// <summary>
+        /// 提醒拖拽事件开始了,请传需要拖动的按钮对象
+        /// </summary>
+        /// <param name="element">在哪个控件上触发了拖拽</param>
+        /// <returns>返回已经创建了新的控件对象  -   是否需要移动   -  是否需要拖拽大小</returns>
+        public (FrameworkElement NewControl, bool IsMove, bool IsDragSize) DragEvenTrigger(FrameworkElement ShowControl)
+        {
+            FrameworkElement NewControl = new FrameworkElement();
+            bool IsMove = false;
+            bool IsDragSize = false;
+            switch (ShowControl.Name)
+            {
+                case "ConShow1":
+                    NewControl = InitControls(0);
+                    IsMove = false;
+                    IsDragSize = false;
+                    break;
+                case "ConShow2":
+                    NewControl = InitControls(1);
+                    IsMove = true;
+                    IsDragSize = true;
+                    break;
+            }
+            return (NewControl, IsMove, IsDragSize);
+        }
+        /// <summary>
+        /// 创建图标
+        /// </summary>
+        /// <param name="dashboardDataMode">图标类型</param>
+        private Label InitControls(int A)
+        {
+            return new Label() { Background = new SolidColorBrush(A == 0 ? Colors.Blue : Colors.AntiqueWhite), Width = 100, Height = 100, Content = "自定义控件" };
+        }
+
+
+        //----------------------------------------------------拖动过度--------------------------------------------------------
+
+
+        DragControlsExcessiveAnimate dragControlsExcessiveAnimate;
+
+        /// <summary>
+        /// 按钮目前的状态  更具得到的状态执行响应的动作
+        /// </summary>
+        /// <param name="state">状态</param>
+        public void ActionEvenTrigger(DragControlsExcessiveAnimate.ButtonState state, Button obj)
+        {
+            if (state.Equals(DragControlsExcessiveAnimate.ButtonState.Up))
+            {
+
+            }
+        }
+        /// <summary>
+        /// 提醒拖拽事件开始了,请传需要拖动的按钮对象
+        /// </summary>
+        /// <param name="element">在哪个控件上触发了拖拽</param>
+        /// <returns>返回已经创建了新的控件对象  -   是否需要拖拽大小</returns>
+        public (FrameworkElement NewControl, bool IsMove, bool IsDragSize) DragEvenTrigger_DragControlsExcessiveAnimate(FrameworkElement ShowControl)
+        {
+            BadgeControl badge = new BadgeControl();
+            badge.Height = 40;
+            badge.Width = 40;
+            badge.IsWaving = true;
+            LinearGradientBrush brush = new LinearGradientBrush();
+            brush.GradientStops = new GradientStopCollection();
+            brush.GradientStops.Add(new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#D1E8FF"), Offset = 0.987654 });
+            brush.GradientStops.Add(new GradientStop() { Color = (Color)ColorConverter.ConvertFromString("#FFFFFF"), Offset = 0.123456 });
+            badge.Background = brush;//渐变色
+            FrameworkElement NewControl = badge;
+            return (NewControl, false, false);
+        }
+    }
+}

+ 22 - 0
src/YSAI.Windows.Anime.Samples/YSAI.Windows.Anime.Samples.csproj

@@ -0,0 +1,22 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net8.0-windows</TargetFramework>
+    <Nullable>enable</Nullable>
+    <UseWPF>true</UseWPF>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <None Remove="image\YSAI.ico" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\YSAI.Core.Wpf\YSAI.Core.Wpf.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Resource Include="image\YSAI.ico" />
+  </ItemGroup>
+
+</Project>

BIN
src/YSAI.Windows.Anime.Samples/image/YSAI.ico


+ 14 - 0
src/YSAI.Windows.Samples/App.xaml

@@ -0,0 +1,14 @@
+<Application x:Class="YSAI.Windows.Samples.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:YSAI.Windows.Samples"
+             StartupUri="MainWindow.xaml">
+    <Application.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <!--加载默认样式-->
+                <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/themes/WindowTemplate_Black.xaml" />
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </Application.Resources>
+</Application>

+ 14 - 0
src/YSAI.Windows.Samples/App.xaml.cs

@@ -0,0 +1,14 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace YSAI.Windows.Samples
+{
+    /// <summary>
+    /// Interaction logic for App.xaml
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+
+}

+ 10 - 0
src/YSAI.Windows.Samples/AssemblyInfo.cs

@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None,            //where theme specific resource dictionaries are located
+                                                //(used if a resource is not found in the page,
+                                                // or application resource dictionaries)
+    ResourceDictionaryLocation.SourceAssembly   //where the generic resource dictionary is located
+                                                //(used if a resource is not found in the page,
+                                                // app, or any theme specific resource dictionaries)
+)]

+ 37 - 0
src/YSAI.Windows.Samples/MainWindow.xaml

@@ -0,0 +1,37 @@
+<sv:WindowBase x:Class="YSAI.Windows.Samples.MainWindow"
+               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+               xmlns:local="clr-namespace:YSAI.Windows.Samples"
+               xmlns:sv="clr-namespace:YSAI.Core.Wpf;assembly=YSAI.Core.Wpf"
+               xmlns:lang="http://wpflocalizeextension.codeplex.com"
+               lang:LocalizeDictionary.DesignCulture="zh"
+               lang:ResxLocalizationProvider.DefaultAssembly="YSAI.Langs"
+               lang:ResxLocalizationProvider.DefaultDictionary="Lang"
+               xmlns:btn="clr-namespace:YSAI.Core.Wpf.controls.button;assembly=YSAI.Core.Wpf"
+               IsLanguage="True"
+               mc:Ignorable="d"
+               Background="{DynamicResource ContentBackgroundPicture}"
+               Title="{lang:Loc HelloWorld}" Height="450" Width="800" Icon="image\YSAI.ico" IsContentBackgroundPicture="True" WindowStartupLocation="CenterScreen">
+    <!--MVVM绑定-->
+    <Window.DataContext>
+        <local:MainWindowViewModel/>
+    </Window.DataContext>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <Label Content="{lang:Loc Hello}" FontSize="30" FontWeight="Bold" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+        <Label Content="{Binding LabelContent}" FontSize="30" FontWeight="Bold" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+        <btn:ButtonControl  Width="100"  FontSize="13" FontWeight="Bold" Grid.Row="2" Command="{Binding Cut}" HorizontalAlignment="Center" VerticalAlignment="Center"  CornerRadius="{DynamicResource WindowCornerRadius}" Background="White"
+                           IsMouseOverBorderBrushColor="{DynamicResource Control.Border.One.Color}"
+                           BorderBrush="{DynamicResource Control.Border.Color}"
+                           IsPressedBorderBrushColor="{DynamicResource Control.Border.Two.Color}"
+                           Foreground="{DynamicResource Font.Content.Foreground}"
+                           Icon="{DynamicResource Lang}"
+                           Content="{lang:Loc Cut}"/>
+    </Grid>
+</sv:WindowBase>

+ 15 - 0
src/YSAI.Windows.Samples/MainWindow.xaml.cs

@@ -0,0 +1,15 @@
+using YSAI.Core.Wpf;
+
+namespace YSAI.Windows.Samples
+{
+    /// <summary>
+    /// Interaction logic for MainWindow.xaml
+    /// </summary>
+    public partial class MainWindow : WindowBase
+    {
+        public MainWindow()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 63 - 0
src/YSAI.Windows.Samples/MainWindowViewModel.cs

@@ -0,0 +1,63 @@
+using CommunityToolkit.Mvvm.Input;
+using System.Windows.Input;
+using YSAI.Core.Wpf;
+using YSAI.Core.Wpf.mvvm;
+using YSAI.Langs;
+namespace YSAI.Windows.Samples
+{
+    public class MainWindowViewModel : NotifyObject
+    {
+        public MainWindowViewModel()
+        {
+            //绑定触发事件
+            LangsHelper.OnLangSwitchEvent += LangsHelper_OnLangSwitchEvent;
+            //设置初始语言
+            LangsHelper.SetLangs(LangsHelper.GetLangs());
+            //当皮肤切换触发事件
+            WindowHelper.OnSkinSwitchEvent += WindowHelper_OnSkinSwitchEvent; ;
+        }
+        /// <summary>
+        /// 当皮肤切换发送通知
+        /// </summary>
+        private void WindowHelper_OnSkinSwitchEvent(object? sender, EventArgs e)
+        {
+
+        }
+        /// <summary>
+        /// 语言切换了发生的通知
+        /// </summary>
+        private void LangsHelper_OnLangSwitchEvent(object? sender, EventArgs e)
+        {
+            LabelContent = LangsHelper.GetValue("World");
+        }
+
+        /// <summary>
+        /// 演示后台更新语言
+        /// </summary>
+        public string LabelContent
+        {
+            get => _labelContent;
+            set => SetProperty(ref _labelContent, value);
+        }
+        private string _labelContent = LangsHelper.GetValue("World");
+
+        /// <summary>
+        /// 执行点击事件
+        /// </summary>
+        public void OnCut()
+        {
+            if (MessageBox.Show("你点击了切换按钮,确认后切换", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Information))
+            {
+                if (LangsHelper.GetLangs() == "zh")
+                {
+                    LangsHelper.SetLangs("en");
+                }
+                else
+                {
+                    LangsHelper.SetLangs("zh");
+                }
+            }
+        }
+        public ICommand Cut { get => new RelayCommand(OnCut); }
+    }
+}

+ 23 - 0
src/YSAI.Windows.Samples/YSAI.Windows.Samples.csproj

@@ -0,0 +1,23 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net8.0-windows</TargetFramework>
+    <Nullable>enable</Nullable>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <UseWPF>true</UseWPF>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <None Remove="image\YSAI.ico" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\YSAI.Core.Wpf\YSAI.Core.Wpf.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Resource Include="image\YSAI.ico" />
+  </ItemGroup>
+
+</Project>

BIN
src/YSAI.Windows.Samples/image/YSAI.ico