diff --git a/SunnyUI.Demo/Bin/SunnyUI.Common.dll b/SunnyUI.Demo/Bin/SunnyUI.Common.dll
index 57716290..8bf46663 100644
Binary files a/SunnyUI.Demo/Bin/SunnyUI.Common.dll and b/SunnyUI.Demo/Bin/SunnyUI.Common.dll differ
diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe
index c885c134..91ec7666 100644
Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ
diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll
index af9c52ea..381d5174 100644
Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ
diff --git a/SunnyUI.Demo/Forms/FDialogs.cs b/SunnyUI.Demo/Forms/FDialogs.cs
index 158c7ad6..7d734777 100644
--- a/SunnyUI.Demo/Forms/FDialogs.cs
+++ b/SunnyUI.Demo/Forms/FDialogs.cs
@@ -45,15 +45,15 @@ namespace Sunny.UI.Demo
private void btnStatus2_Click(object sender, EventArgs e)
{
- ShowStatusForm(100, "数据加载中......", 0);
+ this.ShowStatusForm(100, "数据加载中......", 0);
for (int i = 0; i < 88; i++)
{
SystemEx.Delay(50);
- SetStatusFormDescription("数据加载中(" + i + "%)......");
- StatusFormStepIt();
+ this.SetStatusFormDescription("数据加载中(" + i + "%)......");
+ this.SetStatusFormStepIt();
}
- HideStatusForm();
+ this.HideStatusForm();
}
private void btnInfo_Click(object sender, EventArgs e)
@@ -197,18 +197,18 @@ namespace Sunny.UI.Demo
private void uiSymbolButton11_Click(object sender, EventArgs e)
{
- ShowWaitForm("准备开始...");
+ this.ShowWaitForm("准备开始...");
Thread.Sleep(1000);
- SetWaitFormDescription(UILocalize.SystemProcessing + "20%");
+ this.SetWaitFormDescription(UILocalize.SystemProcessing + "20%");
Thread.Sleep(1000);
- SetWaitFormDescription(UILocalize.SystemProcessing + "40%");
+ this.SetWaitFormDescription(UILocalize.SystemProcessing + "40%");
Thread.Sleep(1000);
- SetWaitFormDescription(UILocalize.SystemProcessing + "60%");
+ this.SetWaitFormDescription(UILocalize.SystemProcessing + "60%");
Thread.Sleep(1000);
- SetWaitFormDescription(UILocalize.SystemProcessing + "80%");
+ this.SetWaitFormDescription(UILocalize.SystemProcessing + "80%");
Thread.Sleep(1000);
- SetWaitFormDescription(UILocalize.SystemProcessing + "100%");
- HideWaitForm();
+ this.SetWaitFormDescription(UILocalize.SystemProcessing + "100%");
+ this.HideWaitForm();
}
private void uiSymbolButton13_Click(object sender, EventArgs e)
@@ -222,9 +222,9 @@ namespace Sunny.UI.Demo
private void uiSymbolButton12_Click(object sender, EventArgs e)
{
- ShowProcessForm(200);
+ this.ShowProcessForm(200);
Thread.Sleep(2000);
- HideProcessForm();
+ this.HideProcessForm();
}
}
}
\ No newline at end of file
diff --git a/SunnyUI.Demo/SunnyUI.Demo.csproj b/SunnyUI.Demo/SunnyUI.Demo.csproj
index 18ad70e9..b4a87c51 100644
--- a/SunnyUI.Demo/SunnyUI.Demo.csproj
+++ b/SunnyUI.Demo/SunnyUI.Demo.csproj
@@ -41,11 +41,11 @@
app.manifest
-
- ..\packages\SunnyUI.3.5.0\lib\net472\SunnyUI.dll
+
+ ..\packages\SunnyUI.3.5.1\lib\net472\SunnyUI.dll
-
- ..\packages\SunnyUI.Common.3.5.0\lib\net472\SunnyUI.Common.dll
+
+ ..\packages\SunnyUI.Common.3.5.1\lib\net472\SunnyUI.Common.dll
diff --git a/SunnyUI.Demo/packages.config b/SunnyUI.Demo/packages.config
index 1443793c..5cd99826 100644
--- a/SunnyUI.Demo/packages.config
+++ b/SunnyUI.Demo/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/SunnyUI/Common/UGDI.cs b/SunnyUI/Common/UGDI.cs
index dc40ec9d..1b80e4ec 100644
--- a/SunnyUI/Common/UGDI.cs
+++ b/SunnyUI/Common/UGDI.cs
@@ -60,71 +60,6 @@ namespace Sunny.UI
}
}
- ///
- /// 颜色是否是浅色
- ///
- /// 颜色
- /// 是否是浅色
- public static bool IsLightColor(this Color color)
- {
- return (0.299 * color.R + 0.587 * color.G + 0.114 * color.B) / 255 > 0.5;
- }
-
- ///
- /// 根据背景色判断前景色
- ///
- /// 背景色
- /// 前景色
- public static Color ForeColor(Color backColor)
- {
- return backColor.IsLightColor() ? Color.Black : Color.White;
- }
-
- ///
- /// SizeF转Size
- ///
- /// SizeF
- /// Size
- public static Size Size(this SizeF size)
- {
- return new Size(size.Width.RoundEx(), size.Height.RoundEx());
- }
-
- ///
- /// PointF转Point
- ///
- /// PointF
- /// Point
- public static Point Point(this PointF point)
- {
- return new Point(point.X.RoundEx(), point.Y.RoundEx());
- }
-
- ///
- /// Size增加长宽
- ///
- /// Size
- /// 宽
- /// 长
- /// 结果
- public static Size Add(this Size size, int width, int height)
- {
- return new Size(size.Width + width, size.Height + height);
- }
-
-
- ///
- /// SizeF增加长宽
- ///
- /// SizeF
- /// 宽
- /// 长
- /// 结果
- public static SizeF Add(this SizeF size, float width, float height)
- {
- return new SizeF(size.Width + width, size.Height + height);
- }
-
///
/// 点是否在区域内
///
@@ -543,27 +478,6 @@ namespace Sunny.UI
return g;
}
- ///
- /// Color转HTML
- ///
- /// Color
- /// HTML
- public static string ToHTML(this Color color)
- {
- return ColorTranslator.ToHtml(color);
- }
-
- ///
- /// HTML转Color
- ///
- /// HTML
- /// 透明度
- /// Color
- public static Color ToColor(this string htmlColor, int alpha = 255)
- {
- return Color.FromArgb(alpha > 255 ? 255 : alpha, ColorTranslator.FromHtml(htmlColor));
- }
-
///
/// 颜色是否为空
///
diff --git a/SunnyUI/Common/UIObjectCollection.cs b/SunnyUI/Common/UIObjectCollection.cs
deleted file mode 100644
index db46f4e0..00000000
--- a/SunnyUI/Common/UIObjectCollection.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Sunny.UI
-{
- [Serializable]
- public class UIObjectCollection : IList
- {
- private ArrayList data = new ArrayList();
-
- public event EventHandler CountChange;
-
- public object this[int index]
- {
- get => data[index];
- set => data[index] = value;
- }
-
- public int Count => data.Count;
-
- bool IList.IsReadOnly => false;
-
- bool IList.IsFixedSize => false;
-
- public int Add(object value)
- {
- int count = data.Add(value);
- CountChange?.Invoke(this, new EventArgs());
- return count;
- }
-
- public void AddRange(object[] value)
- {
- if (value == null)
- {
- throw new ArgumentNullException("value is null");
- }
-
- data.AddRange(value);
- CountChange?.Invoke(this, new EventArgs());
- }
-
- public void Clear()
- {
- data.Clear();
- CountChange?.Invoke(this, new EventArgs());
- }
-
- public bool Contains(object value)
- {
- return data.Contains(value);
- }
-
- public void CopyTo(object[] array, int index)
- {
- data.CopyTo(array, index);
- }
-
- public UIObjectEnumerator GetEnumerator()
- {
- return new UIObjectEnumerator(this);
- }
-
- public int IndexOf(object value)
- {
- return data.IndexOf(value);
- }
-
- public void Insert(int index, object value)
- {
- data.Insert(index, value);
- CountChange?.Invoke(this, new EventArgs());
- }
-
- public bool IsReadOnly => false;
-
- public bool IsSynchronized => false;
-
- public void Remove(object value)
- {
- data.Remove(value);
- CountChange?.Invoke(this, new EventArgs());
- }
-
- public void RemoveAt(int index)
- {
- data.RemoveAt(index);
- CountChange?.Invoke(this, new EventArgs());
- }
-
- public object SyncRoot => data.SyncRoot;
-
- object IList.this[int index]
- {
- get => this[index];
- set => this[index] = value;
- }
-
- int IList.Add(object value)
- {
- int count = Add(value);
- CountChange?.Invoke(this, new EventArgs());
- return count;
- }
-
- bool IList.Contains(object value)
- {
- return Contains(value);
- }
-
-
- int IList.IndexOf(object value)
- {
- return IndexOf(value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, value);
- CountChange?.Invoke(this, new EventArgs());
- }
-
- void IList.Remove(object value)
- {
- Remove(value);
- CountChange?.Invoke(this, new EventArgs());
- }
-
- void ICollection.CopyTo(Array array, int index)
- {
- data.CopyTo(array, index);
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return data.GetEnumerator();
- }
- }
-
- ///
- /// [To be supplied.]
- ///
- public class UIObjectEnumerator
- {
- private readonly IEnumerator baseEnumerator;
- private readonly IEnumerable temp;
-
- internal UIObjectEnumerator(UIObjectCollection mappings)
- {
- this.temp = (IEnumerable)(mappings);
- this.baseEnumerator = temp.GetEnumerator();
- }
-
- public object Current => baseEnumerator.Current;
-
- public bool MoveNext()
- {
- return baseEnumerator.MoveNext();
- }
-
- public void Reset()
- {
- baseEnumerator.Reset();
- }
-
- }
-}
diff --git a/SunnyUI/Common/UMapper.cs b/SunnyUI/Common/UMapper.cs
deleted file mode 100644
index d3d111ab..00000000
--- a/SunnyUI/Common/UMapper.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-/******************************************************************************
- * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
- * CopyRight (C) 2012-2023 ShenYongHua(沈永华).
- * QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
- *
- * Blog: https://www.cnblogs.com/yhuse
- * Gitee: https://gitee.com/yhuse/SunnyUI
- * GitHub: https://github.com/yhuse/SunnyUI
- *
- * SunnyUI.dll can be used for free under the GPL-3.0 license.
- * If you use this code, please keep this note.
- * 如果您使用此代码,请保留此说明。
- ******************************************************************************
- * 文件名称: UMapper.cs
- * 文件说明: 轻量级的对象映射框架,可以映射值类型(包括Struct),和以值类型构成的List和数组。
- * 当前版本: V3.1
- * 创建日期: 2021-09-30
- *
- * 2021-09-30: V3.0.7 增加文件说明
-******************************************************************************/
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace Sunny.UI
-{
- ///
- /// 轻量级的对象映射框架
- ///
- public static class Mapper
- {
- private static void Execute(T1 source, T2 dest)
- where T1 : class
- where T2 : class
- {
- if (source == null || dest == null)
- {
- return;
- }
-
- var listSource = source.GetType().GetNeedProperties().ToDictionary(prop => prop.Name);
- var listDest = dest.GetType().GetNeedProperties().ToDictionary(prop => prop.Name);
-
- foreach (var item in listDest)
- {
- if (listSource.NotContainsKey(item.Key)) continue;
-
- var sourceInfo = listSource[item.Key];
- Type sourceType = sourceInfo.PropertyType;
- object sourceValue = sourceInfo.GetValue(source, null);
-
- var destInfo = item.Value;
- Type destType = item.Value.PropertyType;
-
- if (!sourceType.Equals(destType)) continue;
- if (sourceType.IsValueType)
- {
- //Console.WriteLine("ValueType: " + item.Key + ", " + sourceType.FullName);
- destInfo.SetValue(dest, sourceValue, null);
- }
- else
- {
- if (sourceType == typeof(string))
- {
- //Console.WriteLine("String: " + item.Key + ", " + sourceType.FullName);
- destInfo.SetValue(dest, sourceValue, null);
- continue;
- }
-
- if (sourceType.IsList())
- {
- //Console.WriteLine("List: " + item.Key + ", " + sourceType.FullName);
- Type[] sourceTypes = sourceType.GetGenericArguments();
- Type[] destTypes = destType.GetGenericArguments();
- if (sourceTypes.Length != 1) continue;
- if (destTypes.Length != 1) continue;
- if (!sourceTypes[0].Equals(destTypes[0])) continue;
-
- if (sourceValue == null)
- {
- destInfo.SetValue(dest, null, null);
- }
- else
- {
- Type typeDataList = typeof(List<>).MakeGenericType(destTypes[0]);
- MethodInfo AddInfo = typeDataList.GetMethod("Add", BindingFlags.Public | BindingFlags.Instance);
- if (AddInfo == null) continue;
-
- if (sourceTypes[0].IsValueType || sourceTypes[0] == typeof(string))
- {
- object listvalue = typeDataList.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, new object[] { });
- IEnumerable sourceList = sourceValue as IEnumerable;
- foreach (var listItem in sourceList)
- {
- AddInfo.Invoke(listvalue, new[] { listItem });
- }
-
- destInfo.SetValue(dest, listvalue, null);
- }
- else
- {
- //暂时不考虑
- }
- }
-
- continue;
- }
-
- if (sourceType.IsArray)
- {
- //Console.WriteLine("Array: " + item.Key + ", " + sourceType.FullName);
- if (sourceValue == null)
- {
- destInfo.SetValue(dest, null, null);
- }
- else
- {
- ICollection sourceList = sourceValue as ICollection;
- Type type = sourceType.GetElementType();
- var array = Array.CreateInstance(type, sourceList.Count);
-
- int index = 0;
- foreach (var listItem in sourceList)
- {
- array.SetValue(listItem, index++);
- }
-
- destInfo.SetValue(dest, array, null);
- }
-
- continue;
- }
-
- if (sourceType.IsDictionary())
- {
-
- continue;
- }
-
- //类没有无参构造函数的话,创建有问题
- //if (sourceType.IsClass)
- //{
- // if (sourceValue == null)
- // {
- // destInfo.SetValue(dest, null, null);
- // }
- // else
- // {
- // object obj = Activator.CreateInstance(sourceType, null);
- // obj.MapperFrom(sourceValue);
- // destInfo.SetValue(dest, obj, null);
- // }
- //
- // continue;
- //}
- }
- }
- }
-
- ///
- /// T1映射到T2
- ///
- /// T1
- /// T2
- /// 源
- /// 目标
- public static void MapperTo(this T1 source, T2 dest)
- where T1 : class
- where T2 : class
- {
- Execute(source, dest);
- }
-
- ///
- /// T1从T2映射
- ///
- /// T1
- /// T2
- /// 源
- /// 目标
- public static void MapperFrom(this T1 dest, T2 source)
- where T1 : class
- where T2 : class
- {
- Execute(source, dest);
- }
-
- ///
- /// 获取数组的类类型
- ///
- /// 类型
- /// 类类型
- public static Type GetArrayElementType(this Type t)
- {
- if (!t.IsArray) return null;
- string name = t.FullName.Replace("[]", string.Empty);
- return t.Assembly.GetType(name);
- }
- }
-}
diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj
index 5f1f92d0..018e9162 100644
--- a/SunnyUI/SunnyUI.csproj
+++ b/SunnyUI/SunnyUI.csproj
@@ -9,7 +9,7 @@
SunnyUI.Net 是基于.Net Framework 4.0~4.8、.Net6、.Net7 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。
CopyRight © SunnyUI.Net 2012-2023
GPL-3.0-only
- 3.5.0.0
+ 3.5.1.0
ShenYonghua
SunnyUI.Net
SunnyUI
@@ -20,7 +20,7 @@
False
D:\MyDocuments\Key\SunnyUI.pfx
False
- False
+ True
False
README.md
@@ -79,7 +79,7 @@
-
+