gongqiuhong 1 年之前
父節點
當前提交
74fb71b77b

二進制
.vs/DataSimulation/v17/.suo


+ 164 - 0
DataSimulation.Forms/Basic/ColorHelper.cs

@@ -0,0 +1,164 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+public static class ColorHelper
+{
+    private static readonly Dictionary<string, Color> _colorCache = new Dictionary<string, Color>();//颜色缓存
+    private static readonly Dictionary<string, string> _htmlColorCache = new Dictionary<string, string>();//颜色缓存
+
+    /// <summary>
+    /// 判断color是否为HtmlColor(HtmlColor格式如#A1B2C3)
+    /// </summary>
+    /// <param name="color"></param>
+    /// <returns></returns>
+    public static bool IsHtmlColor(string color)
+    {
+        if (!color.StartsWith("#")) return false;
+        if (color.Length != 7) return false;
+        string r = color.Substring(1, 2);
+        string g = color.Substring(3, 2);
+        string b = color.Substring(5, 2);
+        bool r1 = byte.TryParse(r, System.Globalization.NumberStyles.HexNumber, null, out _);
+        bool r2 = byte.TryParse(g, System.Globalization.NumberStyles.HexNumber, null, out _);
+        bool r3 = byte.TryParse(b, System.Globalization.NumberStyles.HexNumber, null, out _);
+        return r1 & r2 & r3;
+    }
+    /// <summary>
+    /// 根据key得到一种易识别的颜色,相同的key会得到相同的颜色(若要使多个key得到的颜色具有高对比度,请先调用GenerateColor)
+    /// </summary>
+    /// <param name="key"></param>
+    /// <returns></returns>
+    public static Color GetColor(string key)
+    {
+        if (key == null) key = "";
+        if (_colorCache.ContainsKey(key))
+            return _colorCache[key];
+        Random random = new Random(key.GetHashCode());
+        var H = random.Next(0, 360);//色调
+        var S = random.NextDouble();//饱和度
+        var L = random.NextDouble();//亮度
+
+        S = 0.7 + S * 0.2; // [0.7 - 0.9] 排除过灰颜色
+        L = 0.4 + L * 0.4; // [0.4 - 0.8] 排除过亮过暗色
+
+        byte r, g, b;
+        if (S == 0)
+        {
+            r = g = b = (byte)(L * 255);
+        }
+        else
+        {
+            double v1, v2;
+            double hue = H / 360d;
+            v2 = (L < 0.5) ? (L * (1 + S)) : ((L + S) - (L * S));
+            v1 = 2 * L - v2;
+            r = (byte)(255 * HueToRGB(v1, v2, hue + (1.0f / 3)));
+            g = (byte)(255 * HueToRGB(v1, v2, hue));
+            b = (byte)(255 * HueToRGB(v1, v2, hue - (1.0f / 3)));
+        }
+        var color = Color.FromArgb(r, g, b);
+        var rgbhtml = ColorTranslator.ToHtml(color);
+
+        if (!_colorCache.ContainsKey(key))
+            _colorCache.Add(key, color);
+
+        if (!_htmlColorCache.ContainsKey(key))
+            _htmlColorCache.Add(key, rgbhtml);
+        return color;
+    }
+
+    /// <summary>
+    /// 根据key得到一种易识别的颜色,相同的key会得到相同的颜色(若要使多个key得到的颜色具有高对比度,请先调用GenerateColor)
+    /// </summary>
+    /// <param name="key"></param>
+    /// <returns></returns>
+    public static string GetHtmlColor(string key)
+    {
+        if (key == null) key = "";
+        if (_htmlColorCache.ContainsKey(key))
+            return _htmlColorCache[key];
+        string rgbhtml = ColorTranslator.ToHtml(GetColor(key));
+        return rgbhtml;
+    }
+
+    /// <summary>
+    /// 提前生成多个易识别且不相近的颜色,生成后通过GetColor或CetHtmlColor获取
+    /// </summary>
+    /// <param name="keys">所有颜色对应的key,个数超过360时效果不佳</param>
+    /// <returns></returns>
+    public static void GenerateColor(IEnumerable<string> keys)
+    {
+        _colorCache.Clear();
+        _htmlColorCache.Clear();
+        keys = keys.Distinct();
+        int idx = 0;
+        List<(int H, double S, double L)> list = new List<(int H, double S, double L)>();
+        int count = keys.Count();
+        int value = 360 / count;
+        if (value == 0) value = 1;
+        foreach (var key in keys)
+        {
+            Random random = new Random(key.GetHashCode());
+            int H = random.Next(idx * value, (idx + 1) * value);//色调
+            H %= 360;
+            double S = random.NextDouble();//饱和度
+            double L = random.NextDouble();//亮度
+            S = 0.7 + S * 0.2; // [0.7 - 0.9] 排除过灰颜色
+            L = 0.4 + L * 0.4; // [0.4 - 0.8] 排除过亮过暗色
+            byte r, g, b;
+            if (S == 0)
+            {
+                r = g = b = (byte)(L * 255);
+            }
+            else
+            {
+                double v1, v2;
+                double hue = H / 360d;
+                v2 = (L < 0.5) ? (L * (1 + S)) : ((L + S) - (L * S));
+                v1 = 2 * L - v2;
+                r = (byte)(255 * HueToRGB(v1, v2, hue + (1.0f / 3)));
+                g = (byte)(255 * HueToRGB(v1, v2, hue));
+                b = (byte)(255 * HueToRGB(v1, v2, hue - (1.0f / 3)));
+            }
+            list.Add((H, S, L));
+            var color = Color.FromArgb(r, g, b);
+            var rgbhtml = ColorTranslator.ToHtml(color);
+            if (!_colorCache.ContainsKey(key))
+                _colorCache.Add(key, color);
+            else
+                _colorCache[key] = color;
+
+            if (!_htmlColorCache.ContainsKey(key))
+                _htmlColorCache.Add(key, rgbhtml);
+            else
+                _htmlColorCache[key] = rgbhtml;
+            idx++;
+        }
+    }
+
+
+    private static double HueToRGB(double v1, double v2, double vH)
+    {
+        if (vH < 0)
+            vH += 1;
+
+        if (vH > 1)
+            vH -= 1;
+
+        if ((6 * vH) < 1)
+            return (v1 + (v2 - v1) * 6 * vH);
+
+        if ((2 * vH) < 1)
+            return v2;
+
+        if ((3 * vH) < 2)
+            return (v1 + (v2 - v1) * ((2.0f / 3) - vH) * 6);
+
+        return v1;
+    }
+
+}

+ 97 - 0
DataSimulation.Forms/Basic/DebounceDispatcher.cs

@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+/// <summary>
+/// 这个类提供了防抖和节流的功能
+/// </summary>
+public class DebounceDispatcher
+{
+    System.Timers.Timer _timerDbc;
+    System.Timers.Timer _timerTrt;
+
+    /// <summary>
+    /// 防抖,延迟timesMs后执行。 在此期间如果再次调用,则重新计时
+    /// </summary>
+    /// <param name="timeMs">间隔(毫秒)</param>
+    /// <param name="action">回调函数</param>
+    /// <param name="invoker">同步对象,一般为Control控件。 如不需同步可传null</param>
+    public void Debounce(int timeMs, Action action, ISynchronizeInvoke invoker = null)
+    {
+        lock (this)
+        {
+            if (_timerDbc == null)
+            {
+                _timerDbc = new System.Timers.Timer(timeMs);
+                _timerDbc.AutoReset = false;
+                _timerDbc.Elapsed += (o, e) =>
+                {
+                    _timerDbc.Stop();
+                    _timerDbc.Close();
+                    _timerDbc = null;
+                    InvokeAction(action, invoker);
+                };
+            }
+            _timerDbc.Stop();
+            _timerDbc.Start();
+        }
+    }
+
+
+    /// <summary>
+    /// 节流,即刻执行,执行之后,在timeMs内再次调用无效
+    /// </summary>
+    /// <param name="timeMs">不应期,这段时间内调用无效</param>
+    /// <param name="action">回调函数</param>
+    /// <param name="invoker">同步对象,一般为控件。 如不需同步可传null</param>
+    public void Throttle(int timeMs, Action action, ISynchronizeInvoke invoker = null)
+    {
+        System.Threading.Monitor.Enter(this);
+        bool needExit = true;
+        try
+        {
+            if (_timerTrt == null)
+            {
+                _timerTrt = new System.Timers.Timer(timeMs);
+                _timerTrt.AutoReset = false;
+                _timerTrt.Elapsed += (o, e) =>
+                {
+                    _timerTrt.Stop();
+                    _timerTrt.Close();
+                    _timerTrt = null;
+                };
+                _timerTrt.Start();
+                System.Threading.Monitor.Exit(this);
+                needExit = false;
+                InvokeAction(action, invoker);//这个过程不能锁
+            }
+        }
+        finally
+        {
+            if (needExit)
+                System.Threading.Monitor.Exit(this);
+        }
+    }
+
+    private static void InvokeAction(Action action, ISynchronizeInvoke invoker)
+    {
+        if (invoker == null)
+        {
+            action();
+        }
+        else
+        {
+            if (invoker.InvokeRequired)
+            {
+                invoker.Invoke(action, null);
+            }
+            else
+            {
+                action();
+            }
+        }
+    }
+}

+ 14 - 0
DataSimulation.Forms/DataSimulation.Forms.csproj

@@ -39,6 +39,7 @@
     <Reference Include="DevExpress.Charts.v23.2.Core, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.Data.Desktop.v23.2" />
     <Reference Include="DevExpress.Data.v23.2" />
+    <Reference Include="DevExpress.Dialogs.v23.2.Core, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.Map.v23.2.Core, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.Utils.v23.2" />
     <Reference Include="DevExpress.Sparkline.v23.2.Core" />
@@ -47,6 +48,7 @@
     <Reference Include="DevExpress.XtraCharts.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.XtraCharts.v23.2.UI, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
     <Reference Include="DevExpress.XtraCharts.v23.2.Wizard, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.XtraDialogs.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
     <Reference Include="DevExpress.XtraEditors.v23.2" />
     <Reference Include="DevExpress.Printing.v23.2.Core" />
     <Reference Include="DevExpress.Drawing.v23.2" />
@@ -54,6 +56,7 @@
     <Reference Include="DevExpress.XtraLayout.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
     <Reference Include="DevExpress.XtraMap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
     <Reference Include="DevExpress.XtraPrinting.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.XtraTreeList.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
     </Reference>
@@ -86,6 +89,11 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Basic\ColorHelper.cs" />
+    <Compile Include="Basic\DebounceDispatcher.cs" />
+    <Compile Include="DxHelper\MD5Helper.cs" />
+    <Compile Include="DxHelper\SvgHelper.cs" />
+    <Compile Include="DxHelper\WaitHelper.cs" />
     <Compile Include="ExtensionsDev\BaseEditExtension.cs" />
     <Compile Include="ExtensionsDev\ChooseFileExtension.cs" />
     <Compile Include="ExtensionsDev\DateEditExtension.cs" />
@@ -137,6 +145,12 @@
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
     </Compile>
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\DataSimulation.Repostory\DataSimulation.Repostory.csproj">
+      <Project>{61d871de-8837-49a9-b141-c03a690a53af}</Project>
+      <Name>DataSimulation.Repostory</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>

+ 29 - 0
DataSimulation.Forms/DxHelper/MD5Helper.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDW.Core
+{
+    public class MD5Helper
+    {
+        public static string StrToMD5(string str)
+        {
+            MD5 md5 = MD5.Create();
+
+            byte[] c = System.Text.Encoding.Default.GetBytes(str);
+
+            byte[] b = md5.ComputeHash(c);//用来计算指定数组的hash值
+
+            //将每一个字节数组中的元素都tostring,在转成16进制
+            string newStr = null;
+            for (int i = 0; i < b.Length; i++)
+            {
+                newStr += b[i].ToString("X2");  //ToString(param);//传入不同的param可以转换成不同的效果
+            }
+            return newStr;
+        }     
+    }
+}

文件差異過大導致無法顯示
+ 236 - 0
DataSimulation.Forms/DxHelper/SvgHelper.cs


+ 495 - 0
DataSimulation.Forms/DxHelper/WaitHelper.cs

@@ -0,0 +1,495 @@
+using DevExpress.Utils.Drawing;
+using DevExpress.Utils.Extensions;
+using DevExpress.XtraSplashScreen;
+using DevExpress.XtraWaitForm;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace DxHelper
+{
+    /// <summary>
+    /// 等待窗体帮助类,包含WaitForm、OverlayForm、
+    /// </summary>
+    public static class WaitHelper
+    {
+        #region private field
+        private static IOverlaySplashScreenHandle _handle;
+        private static OverlayTextPainter _overlayLabel = new OverlayTextPainterEx();
+        private static List<string> _tips = new List<string>();
+        private static Random _random = new Random();
+        private static DateTime _updateTime;
+        #endregion
+
+        #region public function
+        /// <summary>
+        /// 显示等待窗体
+        /// </summary>
+        /// <param name="title">标题</param>
+        /// <param name="caption">文本</param>
+        /// <param name="owner">等待窗体的父窗体,默认值为激活的主程序窗体</param>
+        public static void ShowWaitForm(string title, string caption, Form owner = null)
+        {
+            SplashScreenManager.ShowForm(owner, typeof(MyWaitForm), true, true, false);
+            SplashScreenManager.Default.SetWaitFormCaption(title);//标题
+            SplashScreenManager.Default.SetWaitFormDescription(caption);//描述    
+        }
+
+        /// <summary>
+        /// 显示等待窗体(文本固定为请稍后和加载中...)
+        /// </summary>
+        /// <param name="owner">等待窗体的父窗体,默认值为激活的主程序窗体</param>
+        public static void ShowWaitForm(Form owner = null)
+        {
+            SplashScreenManager.ShowForm(owner, typeof(MyWaitForm), true, true, false);
+            SplashScreenManager.Default.SetWaitFormCaption("请稍后");//标题 
+            SplashScreenManager.Default.SetWaitFormDescription("加载中...");//描述
+
+        }
+
+        /// <summary>
+        /// 关闭等待窗体和程序启动画面窗体
+        /// </summary>
+        public static void CloseForm()
+        {
+            SplashScreenManager.CloseForm(false, 0, null);
+        }
+
+        /// <summary>
+        /// 在某个control上显示半透明遮罩层
+        /// </summary>
+        /// <param name="owner">遮罩层覆盖的Control</param>
+        public static void ShowOverlayForm(Control owner)
+        {
+            int opacity = 180;
+            if (SystemInformation.TerminalServerSession)
+                opacity = 255; //远程桌面(RDP)下禁用opacity,否则网络可能会卡断
+            if (owner == null || !owner.Visible) return;
+            _overlayLabel.Font = new Font(owner.Font.FontFamily, 18);
+            _overlayLabel.Text = null;
+            _handle = SplashScreenManager.ShowOverlayForm(owner, opacity: opacity, fadeIn: false, fadeOut: false, customPainter: new OverlayWindowCompositePainter(_overlayLabel));
+        }
+
+        /// <summary>
+        /// 更新遮罩层上的文本
+        /// </summary>
+        /// <param name="text"></param>
+        public static void UpdateOverlyText(string text)
+        {
+            _overlayLabel.Text = text;
+        }
+
+        /// <summary>
+        /// 关闭上一次显示的半透明遮罩层
+        /// </summary>
+        public static void CloseOverlayForm()
+        {
+            if (_handle == null) return;
+            if (!string.IsNullOrWhiteSpace(_overlayLabel.Text))
+            {
+                Task.Run(() =>
+                {
+                    Thread.Sleep(1000);
+
+                    SplashScreenManager.CloseOverlayForm(_handle);
+
+                });
+            }
+            else
+                SplashScreenManager.CloseOverlayForm(_handle);
+        }
+        /// <summary>
+        /// 显示程序启动画面
+        /// </summary>
+        public static void ShowSplashScreen(string title, string company)
+        {
+            SplashScreenManager.ShowForm(typeof(MySplashScreen)); //调用
+            SplashScreenManager.Default?.SendCommand(SplashScreenCommand.UpdateTitle, title);
+            SplashScreenManager.Default?.SendCommand(SplashScreenCommand.UpdateCompany, company);
+            _updateTime = DateTime.Now;
+            Task.Run(() =>
+            {
+                var tips = _tips.Skip(0).ToList();
+                while (true)
+                {
+                    while ((DateTime.Now - _updateTime).TotalMilliseconds < 2000)
+                    {
+                        Thread.Sleep(100);
+                    }
+                    var tipsIdx = _random.Next(0, tips.Count);
+                    var res = UpdateSplashMessage(_tips[tipsIdx]);
+                    if (!res) break;
+                    tips.RemoveAt(tipsIdx);
+                    if (!tips.Any()) break;
+                }
+            });
+        }
+
+        /// <summary>
+        /// 更新启动画面窗体的文本消息
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns>如果启动窗体已关闭返回false,否则返回true</returns>
+        public static bool UpdateSplashMessage(string msg)
+        {
+            _updateTime = DateTime.Now;
+            if (SplashScreenManager.Default == null || !SplashScreenManager.Default.IsSplashFormVisible) return false;
+            SplashScreenManager.Default?.SendCommand(SplashScreenCommand.UpdateMessage, msg);
+            return true;
+        }
+
+        public static void SetSplashTips(IEnumerable<string> tips)
+        {
+
+            _tips.Clear();
+            _tips.AddRange(tips);
+        }
+        public static void SetSplashTips(string tipsFile)
+        {
+            _tips.Clear();
+            if (File.Exists(tipsFile))
+                _tips.AddRange(File.ReadAllLines(tipsFile));
+        }
+        #endregion
+
+        #region internal class
+        class OverlayTextPainterEx : OverlayTextPainter
+        {
+            protected override Rectangle CalcTextBounds(OverlayLayeredWindowObjectInfoArgs drawArgs)
+            {
+                Size textSz = CalcTextSize(drawArgs);
+                return textSz.AlignWith(drawArgs.Bounds).WithY(drawArgs.ImageBounds.GetCenterPoint().Y - textSz.Height / 2);
+            }
+        }
+        partial class MyWaitForm : WaitForm
+        {
+            private Form owner;
+            public MyWaitForm()
+            {
+                InitializeComponent();
+                this.progressPanel1.AutoHeight = true;
+                this.StartPosition = FormStartPosition.CenterParent;
+            }
+
+            #region Overrides
+
+            public override void SetCaption(string caption)
+            {
+                base.SetCaption(caption);
+                this.progressPanel1.Caption = caption;
+            }
+            public override void SetDescription(string description)
+            {
+                base.SetDescription(description);
+                this.progressPanel1.Description = description;
+            }
+            public override void ProcessCommand(Enum cmd, object arg)
+            {
+                base.ProcessCommand(cmd, arg);
+            }
+
+            #endregion
+
+            public enum WaitFormCommand
+            {
+            }
+            public void ShowWaitForm(Form owner, string description, string caption)
+            {
+                SplashScreenManager.ShowForm(owner, typeof(WaitHelper), true, true, false);
+                SplashScreenManager.Default.SetWaitFormDescription(description);//描述
+                SplashScreenManager.Default.SetWaitFormCaption(caption);//标题    
+            }
+
+
+            public void ShowWaitForm(Form owner)
+            {
+                this.owner = owner;
+                SplashScreenManager.ShowForm(owner, typeof(WaitHelper), true, true, false);
+            }
+
+            public void CloseWaitForm()
+            {
+                SplashScreenManager.CloseForm(false, 0, owner);
+            }
+
+        }
+        partial class MyWaitForm
+        {
+            /// <summary>
+            /// Required designer variable.
+            /// </summary>
+            private System.ComponentModel.IContainer components = null;
+
+            /// <summary>
+            /// Clean up any resources being used.
+            /// </summary>
+            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+            protected override void Dispose(bool disposing)
+            {
+                if (disposing && (components != null))
+                {
+                    components.Dispose();
+                }
+                base.Dispose(disposing);
+            }
+
+            #region Windows Form Designer generated code
+
+            /// <summary>
+            /// Required method for Designer support - do not modify
+            /// the contents of this method with the code editor.
+            /// </summary>
+            private void InitializeComponent()
+            {
+                this.progressPanel1 = new DevExpress.XtraWaitForm.ProgressPanel();
+                this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+                this.tableLayoutPanel1.SuspendLayout();
+                this.SuspendLayout();
+                // 
+                // progressPanel1
+                // 
+                this.progressPanel1.Appearance.BackColor = System.Drawing.Color.Transparent;
+                this.progressPanel1.Appearance.Options.UseBackColor = true;
+                this.progressPanel1.AppearanceCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
+                this.progressPanel1.AppearanceCaption.Options.UseFont = true;
+                this.progressPanel1.AppearanceDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
+                this.progressPanel1.AppearanceDescription.Options.UseFont = true;
+                this.progressPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+                this.progressPanel1.ImageHorzOffset = 20;
+                this.progressPanel1.Location = new System.Drawing.Point(0, 17);
+                this.progressPanel1.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
+                this.progressPanel1.Name = "progressPanel1";
+                this.progressPanel1.Size = new System.Drawing.Size(246, 39);
+                this.progressPanel1.TabIndex = 0;
+                this.progressPanel1.Text = "progressPanel1";
+                // 
+                // tableLayoutPanel1
+                // 
+                this.tableLayoutPanel1.AutoSize = true;
+                this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+                this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
+                this.tableLayoutPanel1.ColumnCount = 1;
+                this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+                this.tableLayoutPanel1.Controls.Add(this.progressPanel1, 0, 0);
+                this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+                this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
+                this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+                this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(0, 14, 0, 14);
+                this.tableLayoutPanel1.RowCount = 1;
+                this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+                this.tableLayoutPanel1.Size = new System.Drawing.Size(246, 73);
+                this.tableLayoutPanel1.TabIndex = 1;
+                // 
+                // Form1
+                // 
+                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+                this.AutoSize = true;
+                this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+                this.ClientSize = new System.Drawing.Size(246, 73);
+                this.Controls.Add(this.tableLayoutPanel1);
+                this.DoubleBuffered = true;
+                this.Name = "Form1";
+                this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
+                this.Text = "Form1";
+                this.tableLayoutPanel1.ResumeLayout(false);
+                this.ResumeLayout(false);
+                this.PerformLayout();
+            }
+
+            #endregion
+
+            private DevExpress.XtraWaitForm.ProgressPanel progressPanel1;
+            private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+        }
+
+        partial class MySplashScreen : SplashScreen
+        {
+            public MySplashScreen()
+            {
+                InitializeComponent();
+                this.labMsg.Text = "";
+                peImage.Properties.Appearance.Font = new Font(peImage.Properties.Appearance.Font.FontFamily, 16);
+                peImage.Properties.NullText = "某系统";
+                this.labelCopyright.Text = $"Copyright © {DateTime.Now.Year} 总参第五十七研究所";
+            }
+            #region Overrides
+
+            public override void ProcessCommand(Enum cmd, object arg)
+            {
+                var command = (SplashScreenCommand)cmd;
+                base.ProcessCommand(cmd, arg);
+                if (command == SplashScreenCommand.UpdateMessage)
+                {
+                    this.labMsg.Text = arg.ToString();
+                }
+                else if (command == SplashScreenCommand.UpdateTitle)
+                {
+                    peImage.Properties.NullText = arg?.ToString();
+                }
+                else if (command == SplashScreenCommand.UpdateCompany && arg != null && !string.IsNullOrWhiteSpace(arg.ToString()))
+                {
+                    this.labelCopyright.Text = $"Copyright © {DateTime.Now.Year} {arg}";
+                }
+                else if (command == SplashScreenCommand.UpdateCompany && (arg == null || string.IsNullOrWhiteSpace(arg.ToString())))
+                {
+                    this.labelCopyright.Visible = false;
+                }
+            }
+
+            #endregion
+
+
+        }
+        enum SplashScreenCommand
+        {
+            UpdateMessage,
+            UpdateTitle,
+            UpdateCompany
+        }
+        partial class MySplashScreen
+        {
+            /// <summary>
+            /// Required designer variable.
+            /// </summary>
+            private System.ComponentModel.IContainer components = null;
+
+            /// <summary>
+            /// Clean up any resources being used.
+            /// </summary>
+            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+            protected override void Dispose(bool disposing)
+            {
+                if (disposing && (components != null))
+                {
+                    components.Dispose();
+                }
+                base.Dispose(disposing);
+            }
+
+            #region Windows Form Designer generated code
+
+            /// <summary>
+            /// Required method for Designer support - do not modify
+            /// the contents of this method with the code editor.
+            /// </summary>
+            private void InitializeComponent()
+            {
+                this.progressBarControl = new DevExpress.XtraEditors.MarqueeProgressBarControl();
+                this.labelCopyright = new DevExpress.XtraEditors.LabelControl();
+                this.labMsg = new DevExpress.XtraEditors.LabelControl();
+                this.peImage = new DevExpress.XtraEditors.PictureEdit();
+                this.tablePanel1 = new DevExpress.Utils.Layout.TablePanel();
+                ((System.ComponentModel.ISupportInitialize)(this.progressBarControl.Properties)).BeginInit();
+                ((System.ComponentModel.ISupportInitialize)(this.peImage.Properties)).BeginInit();
+                ((System.ComponentModel.ISupportInitialize)(this.tablePanel1)).BeginInit();
+                this.tablePanel1.SuspendLayout();
+                this.SuspendLayout();
+                // 
+                // progressBarControl
+                // 
+                this.progressBarControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                | System.Windows.Forms.AnchorStyles.Right)));
+                this.progressBarControl.EditValue = 0;
+                this.progressBarControl.Location = new System.Drawing.Point(24, 230);
+                this.progressBarControl.Name = "progressBarControl";
+                this.progressBarControl.Size = new System.Drawing.Size(402, 11);
+                this.progressBarControl.TabIndex = 5;
+                // 
+                // labelCopyright
+                // 
+                this.labelCopyright.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
+                this.tablePanel1.SetColumn(this.labelCopyright, 1);
+                this.labelCopyright.Location = new System.Drawing.Point(191, 8);
+                this.labelCopyright.Name = "labelCopyright";
+                this.tablePanel1.SetRow(this.labelCopyright, 0);
+                this.labelCopyright.Size = new System.Drawing.Size(66, 20);
+                this.labelCopyright.TabIndex = 6;
+                this.labelCopyright.Text = "Copyright";
+                // 
+                // labMsg
+                // 
+                this.labMsg.Location = new System.Drawing.Point(24, 198);
+                this.labMsg.Margin = new System.Windows.Forms.Padding(3, 3, 3, 1);
+                this.labMsg.Name = "labMsg";
+                this.labMsg.Size = new System.Drawing.Size(62, 20);
+                this.labMsg.TabIndex = 7;
+                this.labMsg.Text = "Starting...";
+                // 
+                // peImage
+                // 
+                this.peImage.Dock = System.Windows.Forms.DockStyle.Top;
+                this.peImage.Location = new System.Drawing.Point(1, 1);
+                this.peImage.Name = "peImage";
+                this.peImage.Properties.AllowFocused = false;
+                this.peImage.Properties.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
+                this.peImage.Properties.Appearance.Options.UseBackColor = true;
+                this.peImage.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
+                this.peImage.Properties.NullText = "系统名称";
+                this.peImage.Properties.ShowEditMenuItem = DevExpress.Utils.DefaultBoolean.False;
+                this.peImage.Properties.ShowMenu = false;
+                this.peImage.Size = new System.Drawing.Size(448, 185);
+                this.peImage.TabIndex = 9;
+                // 
+                // tablePanel1
+                // 
+                this.tablePanel1.Appearance.BackColor = System.Drawing.Color.Transparent;
+                this.tablePanel1.Appearance.Options.UseBackColor = true;
+                this.tablePanel1.Columns.AddRange(new DevExpress.Utils.Layout.TablePanelColumn[] {
+            new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 1F),
+            new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.AutoSize, 0F),
+            new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 1F)});
+                this.tablePanel1.Controls.Add(this.labelCopyright);
+                this.tablePanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
+                this.tablePanel1.Location = new System.Drawing.Point(1, 250);
+                this.tablePanel1.Name = "tablePanel1";
+                this.tablePanel1.Padding = new System.Windows.Forms.Padding(1);
+                this.tablePanel1.Rows.AddRange(new DevExpress.Utils.Layout.TablePanelRow[] {
+            new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 1F)});
+                this.tablePanel1.Size = new System.Drawing.Size(448, 37);
+                this.tablePanel1.TabIndex = 10;
+                this.tablePanel1.UseSkinIndents = true;
+                // 
+                // SplashScreen1
+                // 
+                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+                this.ClientSize = new System.Drawing.Size(450, 288);
+                this.Controls.Add(this.tablePanel1);
+                this.Controls.Add(this.peImage);
+                this.Controls.Add(this.labMsg);
+                this.Controls.Add(this.progressBarControl);
+                this.Name = "SplashScreen1";
+                this.Padding = new System.Windows.Forms.Padding(1);
+                this.Text = "SplashScreen1";
+                ((System.ComponentModel.ISupportInitialize)(this.progressBarControl.Properties)).EndInit();
+                ((System.ComponentModel.ISupportInitialize)(this.peImage.Properties)).EndInit();
+                ((System.ComponentModel.ISupportInitialize)(this.tablePanel1)).EndInit();
+                this.tablePanel1.ResumeLayout(false);
+                this.tablePanel1.PerformLayout();
+                this.ResumeLayout(false);
+                this.PerformLayout();
+
+            }
+
+            #endregion
+
+            private DevExpress.XtraEditors.MarqueeProgressBarControl progressBarControl;
+            private DevExpress.XtraEditors.LabelControl labelCopyright;
+            private DevExpress.XtraEditors.LabelControl labMsg;
+            private DevExpress.XtraEditors.PictureEdit peImage;
+            private DevExpress.Utils.Layout.TablePanel tablePanel1;
+        }
+        #endregion
+    }
+
+
+}

+ 3 - 1
DataSimulation.Forms/ExtensionsDev/MapControlEx.cs

@@ -1,4 +1,5 @@
-using DevExpress.Export.Xl;
+using DataSimulation.Repostory;
+using DevExpress.Export.Xl;
 using DevExpress.Map;
 using DevExpress.Map.Native;
 using DevExpress.Utils;
@@ -10,6 +11,7 @@ using DevExpress.XtraGrid.Views.Grid;
 using DevExpress.XtraMap;
 using DevExpress.XtraMap.ItemEditor;
 using DevExpress.XtraPrinting;
+using DxHelper;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;

+ 1 - 0
DataSimulation.Forms/MainForm.Designer.cs

@@ -80,6 +80,7 @@
             this.btnTask.Id = 1;
             this.btnTask.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnTask.ImageOptions.SvgImage")));
             this.btnTask.Name = "btnTask";
+            this.btnTask.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.btn_ItemClick);
             // 
             // btnXl
             // 

+ 33 - 33
DataSimulation.Forms/UserControl/CtrlHome.Designer.cs

@@ -33,23 +33,23 @@
             DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions buttonImageOptions2 = new DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions();
             DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions buttonImageOptions3 = new DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions();
             this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
-            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
+            this.mapControl = new DevExpress.XtraMap.MapControl();
             this.gridControl = new DevExpress.XtraGrid.GridControl();
             this.gridView = new DevExpress.XtraGrid.Views.Grid.GridView();
-            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
-            this.mapControl = new DevExpress.XtraMap.MapControl();
+            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
             this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup();
+            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
             this.splitterItem1 = new DevExpress.XtraLayout.SplitterItem();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
             this.layoutControl1.SuspendLayout();
-            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.mapControl)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridControl)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridView)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.mapControl)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).BeginInit();
             this.SuspendLayout();
             // 
@@ -65,17 +65,12 @@
             this.layoutControl1.TabIndex = 0;
             this.layoutControl1.Text = "layoutControl1";
             // 
-            // Root
+            // mapControl
             // 
-            this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
-            this.Root.GroupBordersVisible = false;
-            this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
-            this.layoutControlItem2,
-            this.layoutControlGroup,
-            this.splitterItem1});
-            this.Root.Name = "Root";
-            this.Root.Size = new System.Drawing.Size(1170, 646);
-            this.Root.TextVisible = false;
+            this.mapControl.Location = new System.Drawing.Point(301, 12);
+            this.mapControl.Name = "mapControl";
+            this.mapControl.Size = new System.Drawing.Size(857, 622);
+            this.mapControl.TabIndex = 5;
             // 
             // gridControl
             // 
@@ -92,21 +87,17 @@
             this.gridView.GridControl = this.gridControl;
             this.gridView.Name = "gridView";
             // 
-            // layoutControlItem1
-            // 
-            this.layoutControlItem1.Control = this.gridControl;
-            this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
-            this.layoutControlItem1.Name = "layoutControlItem1";
-            this.layoutControlItem1.Size = new System.Drawing.Size(273, 597);
-            this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
-            this.layoutControlItem1.TextVisible = false;
-            // 
-            // mapControl
+            // Root
             // 
-            this.mapControl.Location = new System.Drawing.Point(301, 12);
-            this.mapControl.Name = "mapControl";
-            this.mapControl.Size = new System.Drawing.Size(857, 622);
-            this.mapControl.TabIndex = 5;
+            this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
+            this.Root.GroupBordersVisible = false;
+            this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
+            this.layoutControlItem2,
+            this.layoutControlGroup,
+            this.splitterItem1});
+            this.Root.Name = "Root";
+            this.Root.Size = new System.Drawing.Size(1170, 646);
+            this.Root.TextVisible = false;
             // 
             // layoutControlItem2
             // 
@@ -138,6 +129,15 @@
             this.layoutControlGroup.Size = new System.Drawing.Size(279, 626);
             this.layoutControlGroup.Text = "任务管理";
             // 
+            // layoutControlItem1
+            // 
+            this.layoutControlItem1.Control = this.gridControl;
+            this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
+            this.layoutControlItem1.Name = "layoutControlItem1";
+            this.layoutControlItem1.Size = new System.Drawing.Size(273, 597);
+            this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem1.TextVisible = false;
+            // 
             // splitterItem1
             // 
             this.splitterItem1.AllowHotTrack = true;
@@ -154,13 +154,13 @@
             this.Size = new System.Drawing.Size(1170, 646);
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
             this.layoutControl1.ResumeLayout(false);
-            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.mapControl)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridControl)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridView)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.mapControl)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).EndInit();
             this.ResumeLayout(false);
 

+ 1 - 1
DataSimulation.Repostory/DataSimulation.Repostory.csproj.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
-    <ProjectView>ShowAllFiles</ProjectView>
+    <ProjectView>ProjectFiles</ProjectView>
   </PropertyGroup>
 </Project>

+ 6 - 0
DataSimulation.sln

@@ -5,6 +5,8 @@ VisualStudioVersion = 17.8.34330.188
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataSimulation.Forms", "DataSimulation.Forms\DataSimulation.Forms.csproj", "{3622EDFF-8AA9-4324-896A-4ED1CBE3D0A1}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataSimulation.Repostory", "DataSimulation.Repostory\DataSimulation.Repostory.csproj", "{61D871DE-8837-49A9-B141-C03A690A53AF}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
 		{3622EDFF-8AA9-4324-896A-4ED1CBE3D0A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{3622EDFF-8AA9-4324-896A-4ED1CBE3D0A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{3622EDFF-8AA9-4324-896A-4ED1CBE3D0A1}.Release|Any CPU.Build.0 = Release|Any CPU
+		{61D871DE-8837-49A9-B141-C03A690A53AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{61D871DE-8837-49A9-B141-C03A690A53AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{61D871DE-8837-49A9-B141-C03A690A53AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{61D871DE-8837-49A9-B141-C03A690A53AF}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

部分文件因文件數量過多而無法顯示