gongqiuhong 1 年之前
父節點
當前提交
72277a0249

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


+ 2 - 2
DataSimulation.Forms/DxHelper/MD5Helper.cs

@@ -5,7 +5,7 @@ using System.Security.Cryptography;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace XdCxRhDW.Core
+namespace DxHelper
 {
     public class MD5Helper
     {
@@ -24,6 +24,6 @@ namespace XdCxRhDW.Core
                 newStr += b[i].ToString("X2");  //ToString(param);//传入不同的param可以转换成不同的效果
             }
             return newStr;
-        }     
+        }
     }
 }

+ 1 - 1
DataSimulation.Forms/ExtensionsDev/GridControlEx.cs

@@ -10,6 +10,7 @@ using DevExpress.XtraGrid;
 using DevExpress.XtraGrid.Columns;
 using DevExpress.XtraGrid.Views.Grid;
 using DevExpress.XtraGrid.Views.Tile;
+using DxHelper;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
@@ -23,7 +24,6 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using System.Xml.Linq;
-using XdCxRhDW.Core;
 
 public static class GridControlEx
 {

+ 0 - 1
DataSimulation.Forms/ExtensionsDev/LayoutControlExtension.cs

@@ -9,7 +9,6 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
-using XdCxRhDW.Core;
 
 namespace ExtensionsDev
 {

+ 24 - 4
DataSimulation.Forms/Program.cs

@@ -4,16 +4,36 @@ using DevExpress.UserSkins;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;
 using System.Windows.Forms;
 
 namespace DataSimulation.Forms
 {
     internal static class Program
     {
-        /// <summary>
-        /// The main entry point for the application.
-        /// </summary>
-        [STAThread]
+        static Program()
+        {
+            AppDomain.CurrentDomain.SetData("PRIVATE_BINPATH", "AddIns;");
+            string paths = Environment.GetEnvironmentVariable("PATH");
+            var m = typeof(AppDomainSetup).GetMethod("UpdateContextProperty", BindingFlags.NonPublic | BindingFlags.Static);
+            var funsion = typeof(AppDomain).GetMethod("GetFusionContext", BindingFlags.NonPublic | BindingFlags.Instance);
+            m.Invoke(null, new object[] { funsion.Invoke(AppDomain.CurrentDomain, null), "PRIVATE_BINPATH", "AddIns;" });
+            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
+            {
+                var args = e.ExceptionObject as Exception;
+                Serilog.Log.Error(args, "出现未处理的异常,程序即将退出!");
+                DxHelper.MsgBoxHelper.ShowError("出现未处理的异常,程序即将退出!");
+            };
+            Application.ThreadException += (sender, e) =>
+            {
+                DxHelper.MsgBoxHelper.ShowError($"出现未处理的线程异常!{e.Exception.Message}");
+                Serilog.Log.Error(e.Exception, "出现未处理的线程异常");
+            };
+        }
+            /// <summary>
+            /// The main entry point for the application.
+            /// </summary>
+            [STAThread]
         static void Main()
         {
             Application.EnableVisualStyles();

+ 6 - 5
DataSimulation.Forms/Properties/licenses.licx

@@ -1,7 +1,8 @@
-DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraCharts.Heatmap.HeatmapControl, DevExpress.XtraCharts.v23.2.UI, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraBars.Docking2010.DocumentManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraBars.Docking2010.DocumentManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraMap.MapControl, DevExpress.XtraMap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraCharts.Heatmap.HeatmapControl, DevExpress.XtraCharts.v23.2.UI, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

+ 120 - 9
DataSimulation.Forms/UserControl/CtrlHome.Designer.cs

@@ -28,6 +28,7 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions buttonImageOptions1 = new DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CtrlHome));
             DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions buttonImageOptions2 = new DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions();
@@ -41,6 +42,16 @@
             this.layoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup();
             this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
             this.splitterItem1 = new DevExpress.XtraLayout.SplitterItem();
+            this.svgImageCollection1 = new DevExpress.Utils.SvgImageCollection(this.components);
+            this.barManager = new DevExpress.XtraBars.BarManager(this.components);
+            this.barDockControlTop = new DevExpress.XtraBars.BarDockControl();
+            this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl();
+            this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl();
+            this.barDockControlRight = new DevExpress.XtraBars.BarDockControl();
+            this.bar1 = new DevExpress.XtraBars.Bar();
+            this.bar2 = new DevExpress.XtraBars.Bar();
+            this.bar3 = new DevExpress.XtraBars.Bar();
+            this.popupMenu = new DevExpress.XtraBars.PopupMenu(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
             this.layoutControl1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.mapControl)).BeginInit();
@@ -51,6 +62,9 @@
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.svgImageCollection1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.barManager)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.popupMenu)).BeginInit();
             this.SuspendLayout();
             // 
             // layoutControl1
@@ -58,10 +72,10 @@
             this.layoutControl1.Controls.Add(this.mapControl);
             this.layoutControl1.Controls.Add(this.gridControl);
             this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.layoutControl1.Location = new System.Drawing.Point(0, 0);
+            this.layoutControl1.Location = new System.Drawing.Point(0, 41);
             this.layoutControl1.Name = "layoutControl1";
             this.layoutControl1.Root = this.Root;
-            this.layoutControl1.Size = new System.Drawing.Size(1170, 646);
+            this.layoutControl1.Size = new System.Drawing.Size(1170, 585);
             this.layoutControl1.TabIndex = 0;
             this.layoutControl1.Text = "layoutControl1";
             // 
@@ -69,7 +83,7 @@
             // 
             this.mapControl.Location = new System.Drawing.Point(301, 12);
             this.mapControl.Name = "mapControl";
-            this.mapControl.Size = new System.Drawing.Size(857, 622);
+            this.mapControl.Size = new System.Drawing.Size(857, 561);
             this.mapControl.TabIndex = 5;
             // 
             // gridControl
@@ -77,7 +91,7 @@
             this.gridControl.Location = new System.Drawing.Point(15, 38);
             this.gridControl.MainView = this.gridView;
             this.gridControl.Name = "gridControl";
-            this.gridControl.Size = new System.Drawing.Size(269, 593);
+            this.gridControl.Size = new System.Drawing.Size(269, 532);
             this.gridControl.TabIndex = 4;
             this.gridControl.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
             this.gridView});
@@ -96,7 +110,7 @@
             this.layoutControlGroup,
             this.splitterItem1});
             this.Root.Name = "Root";
-            this.Root.Size = new System.Drawing.Size(1170, 646);
+            this.Root.Size = new System.Drawing.Size(1170, 585);
             this.Root.TextVisible = false;
             // 
             // layoutControlItem2
@@ -104,7 +118,7 @@
             this.layoutControlItem2.Control = this.mapControl;
             this.layoutControlItem2.Location = new System.Drawing.Point(289, 0);
             this.layoutControlItem2.Name = "layoutControlItem2";
-            this.layoutControlItem2.Size = new System.Drawing.Size(861, 626);
+            this.layoutControlItem2.Size = new System.Drawing.Size(861, 565);
             this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem2.TextVisible = false;
             // 
@@ -126,7 +140,7 @@
             this.layoutControlGroup.Location = new System.Drawing.Point(0, 0);
             this.layoutControlGroup.Name = "layoutControlGroup";
             this.layoutControlGroup.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlGroup.Size = new System.Drawing.Size(279, 626);
+            this.layoutControlGroup.Size = new System.Drawing.Size(279, 565);
             this.layoutControlGroup.Text = "任务管理";
             // 
             // layoutControlItem1
@@ -134,7 +148,7 @@
             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.Size = new System.Drawing.Size(273, 536);
             this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem1.TextVisible = false;
             // 
@@ -143,15 +157,98 @@
             this.splitterItem1.AllowHotTrack = true;
             this.splitterItem1.Location = new System.Drawing.Point(279, 0);
             this.splitterItem1.Name = "splitterItem1";
-            this.splitterItem1.Size = new System.Drawing.Size(10, 626);
+            this.splitterItem1.Size = new System.Drawing.Size(10, 565);
+            // 
+            // barManager
+            // 
+            this.barManager.Bars.AddRange(new DevExpress.XtraBars.Bar[] {
+            this.bar1,
+            this.bar2,
+            this.bar3});
+            this.barManager.DockControls.Add(this.barDockControlTop);
+            this.barManager.DockControls.Add(this.barDockControlBottom);
+            this.barManager.DockControls.Add(this.barDockControlLeft);
+            this.barManager.DockControls.Add(this.barDockControlRight);
+            this.barManager.Form = this;
+            this.barManager.MainMenu = this.bar2;
+            this.barManager.StatusBar = this.bar3;
+            // 
+            // barDockControlTop
+            // 
+            this.barDockControlTop.CausesValidation = false;
+            this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top;
+            this.barDockControlTop.Location = new System.Drawing.Point(0, 0);
+            this.barDockControlTop.Manager = this.barManager;
+            this.barDockControlTop.Size = new System.Drawing.Size(1170, 41);
+            // 
+            // barDockControlBottom
+            // 
+            this.barDockControlBottom.CausesValidation = false;
+            this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.barDockControlBottom.Location = new System.Drawing.Point(0, 626);
+            this.barDockControlBottom.Manager = this.barManager;
+            this.barDockControlBottom.Size = new System.Drawing.Size(1170, 20);
+            // 
+            // barDockControlLeft
+            // 
+            this.barDockControlLeft.CausesValidation = false;
+            this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left;
+            this.barDockControlLeft.Location = new System.Drawing.Point(0, 41);
+            this.barDockControlLeft.Manager = this.barManager;
+            this.barDockControlLeft.Size = new System.Drawing.Size(0, 585);
+            // 
+            // barDockControlRight
+            // 
+            this.barDockControlRight.CausesValidation = false;
+            this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right;
+            this.barDockControlRight.Location = new System.Drawing.Point(1170, 41);
+            this.barDockControlRight.Manager = this.barManager;
+            this.barDockControlRight.Size = new System.Drawing.Size(0, 585);
+            // 
+            // bar1
+            // 
+            this.bar1.BarName = "Tools";
+            this.bar1.DockCol = 0;
+            this.bar1.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
+            this.bar1.Text = "Tools";
+            // 
+            // bar2
+            // 
+            this.bar2.BarName = "Main menu";
+            this.bar2.DockCol = 0;
+            this.bar2.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
+            this.bar2.OptionsBar.MultiLine = true;
+            this.bar2.OptionsBar.UseWholeRow = true;
+            this.bar2.Text = "Main menu";
+            // 
+            // bar3
+            // 
+            this.bar3.BarName = "Status bar";
+            this.bar3.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
+            this.bar3.DockCol = 0;
+            this.bar3.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
+            this.bar3.OptionsBar.AllowQuickCustomization = false;
+            this.bar3.OptionsBar.DrawDragBorder = false;
+            this.bar3.OptionsBar.UseWholeRow = true;
+            this.bar3.Text = "Status bar";
+            // 
+            // popupMenu
+            // 
+            this.popupMenu.Manager = this.barManager;
+            this.popupMenu.Name = "popupMenu";
             // 
             // CtrlHome
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.Controls.Add(this.layoutControl1);
+            this.Controls.Add(this.barDockControlLeft);
+            this.Controls.Add(this.barDockControlRight);
+            this.Controls.Add(this.barDockControlBottom);
+            this.Controls.Add(this.barDockControlTop);
             this.Name = "CtrlHome";
             this.Size = new System.Drawing.Size(1170, 646);
+            this.Load += new System.EventHandler(this.CtrlHome_Load);
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
             this.layoutControl1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.mapControl)).EndInit();
@@ -162,7 +259,11 @@
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.svgImageCollection1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.barManager)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.popupMenu)).EndInit();
             this.ResumeLayout(false);
+            this.PerformLayout();
 
         }
 
@@ -177,5 +278,15 @@
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
         private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup;
         private DevExpress.XtraLayout.SplitterItem splitterItem1;
+        private DevExpress.Utils.SvgImageCollection svgImageCollection1;
+        private DevExpress.XtraBars.BarManager barManager;
+        private DevExpress.XtraBars.Bar bar1;
+        private DevExpress.XtraBars.Bar bar2;
+        private DevExpress.XtraBars.Bar bar3;
+        private DevExpress.XtraBars.BarDockControl barDockControlTop;
+        private DevExpress.XtraBars.BarDockControl barDockControlBottom;
+        private DevExpress.XtraBars.BarDockControl barDockControlLeft;
+        private DevExpress.XtraBars.BarDockControl barDockControlRight;
+        private DevExpress.XtraBars.PopupMenu popupMenu;
     }
 }

+ 46 - 1
DataSimulation.Forms/UserControl/CtrlHome.cs

@@ -1,7 +1,12 @@
-using System;
+using DataSimulation.Repostory.EFContext;
+using DataSimulation.Repostory.Model;
+using DevExpress.Utils;
+using DxHelper;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
+using System.Data.Entity;
 using System.Drawing;
 using System.Linq;
 using System.Text;
@@ -15,6 +20,46 @@ namespace DataSimulation.Forms.UserControl
         public CtrlHome()
         {
             InitializeComponent();
+             gridControl.Init<TaskInfo>().UseFilter();
+            mapControl.UseDefalutOptions()
+          .UseClearAll()
+          .UseDistanceLine()
+          .UseMarkDot()
+          .UseExportImg()
+          .UseExportXlsx()
+          .UseExportCsv()
+          .UseDrawRect(rect =>
+          {
+              (double startLon, double startLat, double centerLon, double centerLat, double endLon, double endLat, double lonRange, double latRange) = rect;
+          });
+        }
+
+        private async void CtrlHome_Load(object sender, EventArgs e)
+        {
+            try
+            {
+                List<TaskInfo> list = new List<TaskInfo>();
+                using (SimulationContext db = new SimulationContext())
+                {
+                    var taskList = db.TaskInfos.OrderByDescending(p => p.UpdateTime).ToList();
+                    list.AddRange(taskList);
+                    var runningList = await db.TaskInfos.Where(p => p.TaskState == EnumTaskState.Running).ToListAsync();
+                    foreach (var item in runningList)
+                    {
+                        item.TaskState = EnumTaskState.Stopped;
+                    }
+                    await db.SaveChangesAsync();
+                    gridControl.DataSource=list;
+                    gridView.Columns[nameof(TaskInfo.TaskName)].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near;
+                    this.svgImageCollection1.Add("Stopped", SvgHelper.CreateCycle("#1E8B58"));
+                    this.svgImageCollection1.Add("Running", SvgHelper.CreateCycle("#2E8B57"));
+                }
+            }
+            catch (Exception)
+            {
+
+                throw;
+            }
         }
     }
 }

+ 9 - 0
DataSimulation.Forms/UserControl/CtrlHome.resx

@@ -175,4 +175,13 @@
         MTcuNSwyNy41LDE4LDI3LDE4eiIgY2xhc3M9IlJlZCIgLz4NCiAgPC9nPg0KPC9zdmc+Cw==
 </value>
   </data>
+  <metadata name="svgImageCollection1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+  <metadata name="barManager.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>193, 17</value>
+  </metadata>
+  <metadata name="popupMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>321, 17</value>
+  </metadata>
 </root>

+ 1 - 1
DataSimulation.Repostory/EFContext/SimulationContext.cs

@@ -46,7 +46,7 @@ namespace DataSimulation.Repostory.EFContext
             base.OnModelCreating(modelBuilder);
         }
 
-
+        public DbSet<TaskInfo> TaskInfos { set; get; }
         public DbSet<SatInfo> SatInfos { get; set; }
 
         public DbSet<AntInfo> AntInfos { get; set; }