gongqiuhong 1 жил өмнө
parent
commit
f69e284fe4

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

@@ -153,6 +153,12 @@
     <Compile Include="EditForms\SatEditor.Designer.cs">
       <DependentUpon>SatEditor.cs</DependentUpon>
     </Compile>
+    <Compile Include="EditForms\FlightEditor.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="EditForms\FlightEditor.Designer.cs">
+      <DependentUpon>FlightEditor.cs</DependentUpon>
+    </Compile>
     <Compile Include="EditForms\TaskEditor.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -183,6 +189,12 @@
     <Compile Include="UserControl\CtrlHistoryTask.Designer.cs">
       <DependentUpon>CtrlHistoryTask.cs</DependentUpon>
     </Compile>
+    <Compile Include="UserControl\CtrlFlight.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="UserControl\CtrlFlight.Designer.cs">
+      <DependentUpon>CtrlFlight.cs</DependentUpon>
+    </Compile>
     <Compile Include="UserControl\CtrlRef.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -222,6 +234,9 @@
     <EmbeddedResource Include="EditForms\SatEditor.resx">
       <DependentUpon>SatEditor.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="EditForms\FlightEditor.resx">
+      <DependentUpon>FlightEditor.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="EditForms\TaskEditor.resx">
       <DependentUpon>TaskEditor.cs</DependentUpon>
     </EmbeddedResource>
@@ -241,6 +256,9 @@
     <EmbeddedResource Include="UserControl\CtrlHistoryTask.resx">
       <DependentUpon>CtrlHistoryTask.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="UserControl\CtrlFlight.resx">
+      <DependentUpon>CtrlFlight.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="UserControl\CtrlRef.resx">
       <DependentUpon>CtrlRef.cs</DependentUpon>
     </EmbeddedResource>

+ 276 - 0
DataSimulation.Forms/EditForms/FlightEditor.Designer.cs

@@ -0,0 +1,276 @@
+namespace DataSimulation.Forms.EditForms
+{
+    partial class FlightEditor
+    {
+        /// <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.components = new System.ComponentModel.Container();
+            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions2 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject5 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject6 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject7 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject8 = new DevExpress.Utils.SerializableAppearanceObject();
+            this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
+            this.mapControl = new DevExpress.XtraMap.MapControl();
+            this.btnSave = new DevExpress.XtraEditors.SimpleButton();
+            this.txtSpeed = new DevExpress.XtraEditors.ButtonEdit();
+            this.txtFlightName = new DevExpress.XtraEditors.TextEdit();
+            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
+            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem13 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem10 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.splitterItem1 = new DevExpress.XtraLayout.SplitterItem();
+            this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
+            this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem();
+            this.layoutControlItem12 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.dxErrorProvider = new DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider(this.components);
+            this.btnDraw = new DevExpress.XtraEditors.SimpleButton();
+            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
+            this.layoutControl1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.mapControl)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtSpeed.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtFlightName.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem10)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem12)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.dxErrorProvider)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // layoutControl1
+            // 
+            this.layoutControl1.Controls.Add(this.btnDraw);
+            this.layoutControl1.Controls.Add(this.mapControl);
+            this.layoutControl1.Controls.Add(this.btnSave);
+            this.layoutControl1.Controls.Add(this.txtSpeed);
+            this.layoutControl1.Controls.Add(this.txtFlightName);
+            this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.layoutControl1.Location = new System.Drawing.Point(0, 0);
+            this.layoutControl1.Name = "layoutControl1";
+            this.layoutControl1.Root = this.Root;
+            this.layoutControl1.Size = new System.Drawing.Size(1189, 509);
+            this.layoutControl1.TabIndex = 0;
+            this.layoutControl1.Text = "layoutControl1";
+            // 
+            // mapControl
+            // 
+            this.mapControl.Location = new System.Drawing.Point(304, 12);
+            this.mapControl.Name = "mapControl";
+            this.mapControl.Size = new System.Drawing.Size(873, 485);
+            this.mapControl.TabIndex = 16;
+            // 
+            // btnSave
+            // 
+            this.btnSave.Location = new System.Drawing.Point(218, 475);
+            this.btnSave.Name = "btnSave";
+            this.btnSave.Size = new System.Drawing.Size(72, 22);
+            this.btnSave.StyleController = this.layoutControl1;
+            this.btnSave.TabIndex = 15;
+            this.btnSave.Text = "保存";
+            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+            // 
+            // txtSpeed
+            // 
+            this.txtSpeed.Location = new System.Drawing.Point(12, 70);
+            this.txtSpeed.Name = "txtSpeed";
+            this.txtSpeed.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "m/s", -1, false, true, false, editorButtonImageOptions2, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject5, serializableAppearanceObject6, serializableAppearanceObject7, serializableAppearanceObject8, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
+            this.txtSpeed.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager));
+            this.txtSpeed.Properties.MaskSettings.Set("mask", "f3");
+            this.txtSpeed.Properties.MaxLength = 10;
+            this.txtSpeed.Size = new System.Drawing.Size(278, 23);
+            this.txtSpeed.StyleController = this.layoutControl1;
+            this.txtSpeed.TabIndex = 13;
+            // 
+            // txtFlightName
+            // 
+            this.txtFlightName.Location = new System.Drawing.Point(12, 29);
+            this.txtFlightName.Name = "txtFlightName";
+            this.txtFlightName.Properties.MaxLength = 12;
+            this.txtFlightName.Size = new System.Drawing.Size(278, 20);
+            this.txtFlightName.StyleController = this.layoutControl1;
+            this.txtFlightName.TabIndex = 4;
+            // 
+            // Root
+            // 
+            this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
+            this.Root.GroupBordersVisible = false;
+            this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
+            this.layoutControlItem1,
+            this.layoutControlItem13,
+            this.layoutControlItem10,
+            this.splitterItem1,
+            this.emptySpaceItem1,
+            this.emptySpaceItem2,
+            this.layoutControlItem12,
+            this.layoutControlItem2});
+            this.Root.Name = "Root";
+            this.Root.Size = new System.Drawing.Size(1189, 509);
+            this.Root.TextVisible = false;
+            // 
+            // layoutControlItem1
+            // 
+            this.layoutControlItem1.Control = this.txtFlightName;
+            this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
+            this.layoutControlItem1.Name = "layoutControlItem1";
+            this.layoutControlItem1.Size = new System.Drawing.Size(282, 41);
+            this.layoutControlItem1.Text = "航迹名称";
+            this.layoutControlItem1.TextLocation = DevExpress.Utils.Locations.Top;
+            this.layoutControlItem1.TextSize = new System.Drawing.Size(48, 14);
+            // 
+            // layoutControlItem13
+            // 
+            this.layoutControlItem13.Control = this.mapControl;
+            this.layoutControlItem13.Location = new System.Drawing.Point(292, 0);
+            this.layoutControlItem13.Name = "layoutControlItem13";
+            this.layoutControlItem13.Size = new System.Drawing.Size(877, 489);
+            this.layoutControlItem13.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem13.TextVisible = false;
+            // 
+            // layoutControlItem10
+            // 
+            this.layoutControlItem10.Control = this.txtSpeed;
+            this.layoutControlItem10.Location = new System.Drawing.Point(0, 41);
+            this.layoutControlItem10.Name = "layoutControlItem10";
+            this.layoutControlItem10.Size = new System.Drawing.Size(282, 44);
+            this.layoutControlItem10.Text = "速度";
+            this.layoutControlItem10.TextLocation = DevExpress.Utils.Locations.Top;
+            this.layoutControlItem10.TextSize = new System.Drawing.Size(48, 14);
+            // 
+            // splitterItem1
+            // 
+            this.splitterItem1.AllowHotTrack = true;
+            this.splitterItem1.Location = new System.Drawing.Point(282, 0);
+            this.splitterItem1.Name = "splitterItem1";
+            this.splitterItem1.Size = new System.Drawing.Size(10, 489);
+            // 
+            // emptySpaceItem1
+            // 
+            this.emptySpaceItem1.AllowHotTrack = false;
+            this.emptySpaceItem1.Location = new System.Drawing.Point(0, 463);
+            this.emptySpaceItem1.Name = "emptySpaceItem1";
+            this.emptySpaceItem1.Size = new System.Drawing.Size(142, 26);
+            this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
+            // 
+            // emptySpaceItem2
+            // 
+            this.emptySpaceItem2.AllowHotTrack = false;
+            this.emptySpaceItem2.Location = new System.Drawing.Point(0, 85);
+            this.emptySpaceItem2.Name = "emptySpaceItem2";
+            this.emptySpaceItem2.Size = new System.Drawing.Size(282, 378);
+            this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0);
+            // 
+            // layoutControlItem12
+            // 
+            this.layoutControlItem12.Control = this.btnSave;
+            this.layoutControlItem12.Location = new System.Drawing.Point(206, 463);
+            this.layoutControlItem12.MaxSize = new System.Drawing.Size(76, 26);
+            this.layoutControlItem12.MinSize = new System.Drawing.Size(76, 26);
+            this.layoutControlItem12.Name = "layoutControlItem12";
+            this.layoutControlItem12.Size = new System.Drawing.Size(76, 26);
+            this.layoutControlItem12.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem12.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem12.TextVisible = false;
+            // 
+            // dxErrorProvider
+            // 
+            this.dxErrorProvider.ContainerControl = this;
+            // 
+            // btnDraw
+            // 
+            this.btnDraw.Location = new System.Drawing.Point(154, 475);
+            this.btnDraw.Name = "btnDraw";
+            this.btnDraw.Size = new System.Drawing.Size(60, 22);
+            this.btnDraw.StyleController = this.layoutControl1;
+            this.btnDraw.TabIndex = 17;
+            this.btnDraw.Text = "绘制航迹";
+            this.btnDraw.Click += new System.EventHandler(this.btnFlight_Click);
+            // 
+            // layoutControlItem2
+            // 
+            this.layoutControlItem2.Control = this.btnDraw;
+            this.layoutControlItem2.Location = new System.Drawing.Point(142, 463);
+            this.layoutControlItem2.Name = "layoutControlItem2";
+            this.layoutControlItem2.Size = new System.Drawing.Size(64, 26);
+            this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem2.TextVisible = false;
+            // 
+            // FlightEditor
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1189, 509);
+            this.Controls.Add(this.layoutControl1);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+            this.Name = "FlightEditor";
+            this.Text = "FlightEditor";
+            this.Load += new System.EventHandler(this.Editor_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
+            this.layoutControl1.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.mapControl)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtSpeed.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtFlightName.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem10)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem12)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.dxErrorProvider)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private DevExpress.XtraLayout.LayoutControl layoutControl1;
+        private DevExpress.XtraLayout.LayoutControlGroup Root;
+        private DevExpress.XtraEditors.TextEdit txtFlightName;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
+        private DevExpress.XtraEditors.ButtonEdit txtSpeed;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem10;
+        private DevExpress.XtraEditors.SimpleButton btnSave;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem12;
+        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2;
+        private DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider dxErrorProvider;
+        private DevExpress.XtraMap.MapControl mapControl;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem13;
+        private DevExpress.XtraLayout.SplitterItem splitterItem1;
+        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1;
+        private DevExpress.XtraEditors.SimpleButton btnDraw;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
+    }
+}

+ 178 - 0
DataSimulation.Forms/EditForms/FlightEditor.cs

@@ -0,0 +1,178 @@
+using DataSimulation.Repostory;
+using DataSimulation.Repostory.EFContext;
+using DataSimulation.Repostory.Model;
+using DevExpress.Utils.About;
+using DevExpress.XtraEditors.Controls;
+using DevExpress.XtraEditors.DXErrorProvider;
+using DxHelper;
+using ExtensionsDev;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Migrations;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace DataSimulation.Forms.EditForms
+{
+    public partial class FlightEditor : DevExpress.XtraEditors.XtraForm
+    {
+        public SimulationInfo info;
+        private List<SimulationInfo> simulationInfos;
+        public FlightEditor(List<SimulationInfo> simulationInfos)
+        {
+            InitializeComponent();
+            this.Text = "添加航迹";
+            info = new SimulationInfo();
+            this.simulationInfos = simulationInfos;
+            this.StartPosition = FormStartPosition.CenterParent;
+        }
+
+        public FlightEditor(List<SimulationInfo> simulationInfos,SimulationInfo info)
+          : this(simulationInfos)
+        {
+            this.Text = "编辑航迹";
+            this.info = info;
+        }
+
+        private void Editor_Load(object sender, EventArgs e)
+        {
+            mapControl.UseDefalutOptions()
+            .UseClearAll()
+            .UseDistanceLine()
+            .UseMarkDot()
+            .UseExportImg()
+            .UseExportXlsx()
+            .UseExportCsv()
+            .SetMapLayerType(null);
+            txtFlightName.EditValueChanged += TxtFlightName_EditValueChanged;
+            txtSpeed.EditValueChanged += TxtSpeed_EditValueChanged;
+
+
+        }
+
+        private void TxtSpeed_EditValueChanged(object sender, EventArgs e)
+        {
+            double speed;
+            if (!double.TryParse(txtSpeed.Text, out speed))
+            {
+                dxErrorProvider.SetError(txtSpeed, "请设置正确的航迹速度(Km/s)");
+                return;
+            }
+            if (speed <= 0)
+            {
+                dxErrorProvider.SetError(txtSpeed, "航迹速度范围不能小于等于0Km/s");
+                return;
+            }
+            dxErrorProvider.SetError(txtSpeed, string.Empty);
+            
+        }
+
+        private void TxtFlightName_EditValueChanged(object sender, EventArgs e)
+        {
+            string Name = txtFlightName.Text.Trim();
+            if (string.IsNullOrEmpty(Name))
+            {
+                dxErrorProvider.SetError(txtFlightName, "请设置航迹名称");
+                return;
+            }
+            if (simulationInfos.Any(m => m.SimulationName == Name))
+            {
+                dxErrorProvider.SetError(txtFlightName, $"航迹[{Name}]已存在");
+                return;
+            }
+            dxErrorProvider.SetError(txtFlightName, string.Empty);
+        }
+
+        private bool Validators()
+        {
+            dxErrorProvider.ClearErrors();
+            string Name = txtFlightName.Text.Trim();
+            if (string.IsNullOrEmpty(Name))
+            {
+                dxErrorProvider.SetError(txtFlightName, "请设置航迹名称");
+                return false;
+            }
+            if (simulationInfos.Any(m => m.SimulationName == Name))
+            {
+                dxErrorProvider.SetError(txtFlightName, $"航迹[{Name}]已存在");
+                return false;
+            }
+            double speed;
+            if (!double.TryParse(txtSpeed.Text, out speed))
+            {
+                dxErrorProvider.SetError(txtSpeed, "请设置正确的航迹速度(Km/s)");
+                return false;
+            }
+            if (speed <= 0)
+            {
+                dxErrorProvider.SetError(txtSpeed, "航迹速度范围不能小于等于0Km/s");
+                return false;
+            }
+            return true;
+        }
+        private async void btnSave_Click(object sender, EventArgs e)
+        {
+            if (!Validators())
+            {
+                return;
+            }
+            try
+            {
+
+                var fligths = mapControl.GetFlightLine<FlightInfo>();
+                var fligth = fligths.First();
+                SimulationInfo simulationInfo = new SimulationInfo();
+                simulationInfo.SimulationName = fligth.FlightName;
+                simulationInfo.SimulationSpeed = fligth.Speed;
+                using (SimulationPartContext db = SimulationPartContext.GetContext(simulationInfo.CreateTime))
+                {
+                    var sinfo = db.SimulationInfos.Add(simulationInfo);
+
+                    await db.SaveChangesAsync();
+                    var points = fligth.flights.Select(f => new SimulationPonit()
+                    {
+                        SimulationId = sinfo.ID,
+                        SimulationLon = f.FlightLon,
+                        SimulationLat = f.FlightLat,
+                    });
+
+                    db.SimulationPonits.AddRange(points);
+                    await db.SaveChangesAsync();
+                }
+                this.DialogResult = DialogResult.OK;
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, $"{this.Text}异常");
+                DxHelper.MsgBoxHelper.ShowError($"{this.Text}异常");
+            }
+
+        }
+
+        private void btnFlight_Click(object sender, EventArgs e)
+        {
+            if (!Validators())
+            {
+                return;
+            }
+            try
+            {
+                string Name = txtFlightName.Text.Trim();
+                double speed = Convert.ToDouble(txtSpeed.Text);
+                mapControl.DrawFlightLine(Name, speed);
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, $"绘制航迹异常");
+                DxHelper.MsgBoxHelper.ShowError($"绘制航迹异常");
+            }
+
+        }
+    }
+}

+ 123 - 0
DataSimulation.Forms/EditForms/FlightEditor.resx

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="dxErrorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>

+ 63 - 2
DataSimulation.Forms/ExtensionsDev/MapControlEx.cs

@@ -895,6 +895,64 @@ public static class MapControlEx
         innerData.barM.EndInit();
         return ctrl;
     }
+
+    public static MapControl DrawFlightLine(this MapControl ctrl, string fligthName, double speed)
+    {
+
+        var innerData = ctrl.Tag as InnerData;
+        var items = innerData.mMapStorage.Items.ToArray();
+        foreach (var item in items)
+        {
+            if (item.Tag != null && item.Tag.ToString().Contains("DrawDistanceLine"))
+                innerData.mMapStorage.Items.Remove(item);
+        }
+        if (innerData.distinctPath != null)
+        {
+            innerData.distinctPath.Points.Clear();
+        }
+        var filghtInfo = new FlightInfo(fligthName, speed);
+        innerData._flightCache.Add(filghtInfo.FlightName, filghtInfo);
+
+        string filghtName = $"DrawFlightLine{fligthName}";
+        ctrl.MapEditor.SetEditMode();
+        innerData.flightpath = new MapSpline()
+        {
+            Stroke = Color.FromArgb(127, 255, 0, 199),
+            StrokeWidth = 2,
+            CanResize = true,
+            CanEdit = true,
+            CanRotate = true,
+            IsHitTestVisible = false,
+            CanMove = true,
+            Tag = filghtName
+
+        };
+        innerData.mMapStorage.Items.Add(innerData.flightpath);
+        innerData.hoverPoint = new MapDot() { CanResize = false, CanMove = false, Tag = filghtName, Size = 8 };
+        innerData.hoverPoint.Fill = ColorHelper.GetColor(innerData.hoverPoint.Tag.ToString());
+        innerData.mMapStorage.Items.Add(innerData.hoverPoint);
+        //提示框
+        SuperToolTip superToolTip = new SuperToolTip();
+        ToolTipItem textItem = new ToolTipItem() { Text = "单击添加航迹点,双击结束绘制航迹" };
+        superToolTip.Items.Add(textItem);
+        ToolTipControllerShowEventArgs arg = new ToolTipControllerShowEventArgs();
+        arg.ShowBeak = true;
+        arg.SuperTip = superToolTip;
+        innerData.hoverTip = arg;
+        ctrl.MouseClick += AddFlightPoint;
+        ctrl.MouseLeave += MapControl_MouseLeave;
+        ctrl.MouseEnter += MapControl_MouseEnter;
+        ctrl.MouseMove += MovingDistinct;
+        ctrl.DoubleClick += (sender1, e1) =>
+        {
+            ctrl.MouseClick -= AddFlightPoint;
+            ctrl.MouseLeave -= MapControl_MouseLeave;
+            ctrl.MouseEnter -= MapControl_MouseEnter;
+            ctrl.MouseMove -= MovingDistinct;
+        };
+
+        return ctrl;
+    }
     /// <summary>
     /// 获取航迹
     /// </summary>
@@ -927,7 +985,10 @@ public static class MapControlEx
         innerData.hoverPoint.Fill = ColorHelper.GetColor(innerData.hoverPoint.Tag.ToString());
         innerData.mMapStorage.Items.Add(innerData.hoverPoint);
         innerData.flightpath.Points.Add(innerData.hoverPoint.Location);
-        innerData._flightCache[Name].flights.Add(new FlightData(lon, lat));
+        if (!innerData._flightCache[Name].flights.Any(m => m.FlightLon == lon && m.FlightLat == lat))
+        {
+            innerData._flightCache[Name].flights.Add(new FlightData(lon, lat));
+        }
     }
 
     public static void SetFlightLine<T>(this MapControl ctrl, IEnumerable<T> items, bool clearDrawLayer = true) where T : FlightInfo, new()
@@ -980,7 +1041,7 @@ public static class MapControlEx
               flight.flights.ForEach((finfo) =>
                 {
                     var location = new GeoPoint(finfo.FlightLat, finfo.FlightLon);
-                   
+
                     var hoverPointj = new MapDot()
                     {
                         CanResize = false,

+ 1 - 0
DataSimulation.Forms/MainForm.cs

@@ -28,6 +28,7 @@ namespace DataSimulation.Forms
             ctrlTypes.Add("卫星管理", typeof(CtrlSat));
             ctrlTypes.Add("天线管理", typeof(CtrlAnt));
             ctrlTypes.Add("参考站管理", typeof(CtrlRef));
+            ctrlTypes.Add("航迹管理", typeof(CtrlFlight));
             btn_ItemClick(null, null);
         }
         private void btn_ItemClick(object sender, ItemClickEventArgs e)

+ 181 - 0
DataSimulation.Forms/UserControl/CtrlFlight.Designer.cs

@@ -0,0 +1,181 @@
+namespace DataSimulation.Forms.UserControl
+{
+    partial class CtrlFlight
+    {
+        /// <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 Component 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.components = new System.ComponentModel.Container();
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CtrlFlight));
+            this.gridFlight = new DevExpress.XtraGrid.GridControl();
+            this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
+            this.barManager1 = 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.btnAdd = new DevExpress.XtraBars.BarButtonItem();
+            this.btnDel = new DevExpress.XtraBars.BarButtonItem();
+            this.btnEdit = new DevExpress.XtraBars.BarButtonItem();
+            this.popupMenu1 = new DevExpress.XtraBars.PopupMenu(this.components);
+            ((System.ComponentModel.ISupportInitialize)(this.gridFlight)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // gridFlight
+            // 
+            this.gridFlight.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.gridFlight.Location = new System.Drawing.Point(0, 0);
+            this.gridFlight.MainView = this.gridView1;
+            this.gridFlight.Name = "gridFlight";
+            this.gridFlight.Size = new System.Drawing.Size(647, 422);
+            this.gridFlight.TabIndex = 0;
+            this.gridFlight.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
+            this.gridView1});
+            // 
+            // gridView1
+            // 
+            this.gridView1.GridControl = this.gridFlight;
+            this.gridView1.Name = "gridView1";
+            this.gridView1.PopupMenuShowing += new DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventHandler(this.gridView1_PopupMenuShowing);
+            this.gridView1.CustomDrawEmptyForeground += new DevExpress.XtraGrid.Views.Base.CustomDrawEventHandler(this.gridView1_CustomDrawEmptyForeground);
+            // 
+            // barManager1
+            // 
+            this.barManager1.DockControls.Add(this.barDockControlTop);
+            this.barManager1.DockControls.Add(this.barDockControlBottom);
+            this.barManager1.DockControls.Add(this.barDockControlLeft);
+            this.barManager1.DockControls.Add(this.barDockControlRight);
+            this.barManager1.Form = this;
+            this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
+            this.btnAdd,
+            this.btnDel,
+            this.btnEdit});
+            this.barManager1.MaxItemId = 3;
+            // 
+            // 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.barManager1;
+            this.barDockControlTop.Size = new System.Drawing.Size(647, 0);
+            // 
+            // barDockControlBottom
+            // 
+            this.barDockControlBottom.CausesValidation = false;
+            this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.barDockControlBottom.Location = new System.Drawing.Point(0, 422);
+            this.barDockControlBottom.Manager = this.barManager1;
+            this.barDockControlBottom.Size = new System.Drawing.Size(647, 0);
+            // 
+            // barDockControlLeft
+            // 
+            this.barDockControlLeft.CausesValidation = false;
+            this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left;
+            this.barDockControlLeft.Location = new System.Drawing.Point(0, 0);
+            this.barDockControlLeft.Manager = this.barManager1;
+            this.barDockControlLeft.Size = new System.Drawing.Size(0, 422);
+            // 
+            // barDockControlRight
+            // 
+            this.barDockControlRight.CausesValidation = false;
+            this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right;
+            this.barDockControlRight.Location = new System.Drawing.Point(647, 0);
+            this.barDockControlRight.Manager = this.barManager1;
+            this.barDockControlRight.Size = new System.Drawing.Size(0, 422);
+            // 
+            // btnAdd
+            // 
+            this.btnAdd.Caption = "添加";
+            this.btnAdd.Id = 0;
+            this.btnAdd.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnAdd.ImageOptions.SvgImage")));
+            this.btnAdd.Name = "btnAdd";
+            this.btnAdd.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.btnAdd_ItemClick);
+            // 
+            // btnDel
+            // 
+            this.btnDel.Caption = "删除";
+            this.btnDel.Id = 1;
+            this.btnDel.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnDel.ImageOptions.SvgImage")));
+            this.btnDel.Name = "btnDel";
+            this.btnDel.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.btnDel_ItemClick);
+            // 
+            // btnEdit
+            // 
+            this.btnEdit.Caption = "编辑";
+            this.btnEdit.Id = 2;
+            this.btnEdit.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnEdit.ImageOptions.SvgImage")));
+            this.btnEdit.Name = "btnEdit";
+            this.btnEdit.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.btnEdit_ItemClick);
+            // 
+            // popupMenu1
+            // 
+            this.popupMenu1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {
+            new DevExpress.XtraBars.LinkPersistInfo(this.btnAdd),
+            new DevExpress.XtraBars.LinkPersistInfo(this.btnEdit),
+            new DevExpress.XtraBars.LinkPersistInfo(this.btnDel)});
+            this.popupMenu1.Manager = this.barManager1;
+            this.popupMenu1.Name = "popupMenu1";
+            // 
+            // CtrlFlight
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.gridFlight);
+            this.Controls.Add(this.barDockControlLeft);
+            this.Controls.Add(this.barDockControlRight);
+            this.Controls.Add(this.barDockControlBottom);
+            this.Controls.Add(this.barDockControlTop);
+            this.Name = "CtrlFlight";
+            this.Size = new System.Drawing.Size(647, 422);
+            this.Load += new System.EventHandler(this.CtrlLoad);
+            ((System.ComponentModel.ISupportInitialize)(this.gridFlight)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private DevExpress.XtraGrid.GridControl gridFlight;
+        private DevExpress.XtraGrid.Views.Grid.GridView gridView1;
+        private DevExpress.XtraBars.BarManager barManager1;
+        private DevExpress.XtraBars.BarDockControl barDockControlTop;
+        private DevExpress.XtraBars.BarDockControl barDockControlBottom;
+        private DevExpress.XtraBars.BarDockControl barDockControlLeft;
+        private DevExpress.XtraBars.BarDockControl barDockControlRight;
+        private DevExpress.XtraBars.BarButtonItem btnAdd;
+        private DevExpress.XtraBars.BarButtonItem btnDel;
+        private DevExpress.XtraBars.PopupMenu popupMenu1;
+        private DevExpress.XtraBars.BarButtonItem btnEdit;
+    }
+}

+ 149 - 0
DataSimulation.Forms/UserControl/CtrlFlight.cs

@@ -0,0 +1,149 @@
+using DataSimulation.Repostory.Model;
+using DevExpress.Utils.Html;
+using DevExpress.XtraEditors;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Entity;
+using System.Drawing;
+using System.Linq;
+using System.Windows.Forms;
+using DataSimulation.Repostory.EFContext;
+using DataSimulation.Forms.EditForms;
+using DataSimulation.Repostory;
+using System.Collections;
+using System.Threading.Tasks;
+
+namespace DataSimulation.Forms.UserControl
+{
+    public partial class CtrlFlight : DevExpress.XtraEditors.XtraUserControl
+    {
+        List<SimulationInfo> list = new List<SimulationInfo>();
+        public CtrlFlight()
+        {
+            InitializeComponent();
+        }
+        private async void CtrlLoad(object sender, EventArgs e)
+        {
+            try
+            {
+                gridFlight.Init<SimulationInfo>().UseSort().UseFilter().UseMultiSelect().UseRowNumber();
+                gridFlight.DataSource = list;
+                var simulationCache = await SimulationCache.GetAllAsync();
+                list.AddRange(simulationCache);
+                gridView1.RefreshData();
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, "查询航迹信息异常");
+                DxHelper.MsgBoxHelper.ShowError("查询航迹信息异常");
+            }
+        }
+        private void gridView1_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e)
+        {
+            if (gridView1.GetSelectedRows().Any())
+            {
+                btnDel.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
+                btnEdit.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
+            }
+            else
+            {
+                btnDel.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
+                btnEdit.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
+            }
+            popupMenu1.ShowPopup(MousePosition);
+        }
+
+        private void btnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            try
+            {
+                FlightEditor frm = new FlightEditor(list);
+                if (frm.ShowDialog() != DialogResult.OK) return;
+                var addItem = frm.info;
+                list.Add(addItem);
+                gridView1.RefreshData();
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, "添加航迹信息异常");
+                DxHelper.MsgBoxHelper.ShowError("添加航迹信息异常");
+            }
+        }
+        private void btnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            try
+            {
+                //var editItem = gridView1.GetFocusedRow() as RefInfo;
+                //RefEditor frm = new RefEditor(editItem);
+                //if (frm.ShowDialog() != DialogResult.OK) return;
+                //gridView1.RefreshData();
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, "编辑航迹信息异常");
+                DxHelper.MsgBoxHelper.ShowError("编辑航迹信息异常");
+            }
+        }
+        private async void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            try
+            {
+                if (XtraMessageBox.Show("确认删除选择的航迹信息?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
+                {
+                    return;
+                }
+                // this.btnImp.Enabled = false;
+                await Task.Run(async () =>
+                {
+                    var ids = gridView1.GetSelectedRows();
+                    List<SimulationInfo> list = new List<SimulationInfo>();
+                    foreach (var idx in ids)
+                    {
+                        var item = gridView1.GetRow(idx) as SimulationInfo;
+                        list.Add(item);
+                    }
+                    var groupData = list.GroupBy(p => p.CreateTime.ToString("yyyyMMdd"));
+                    foreach (var item in groupData)
+                    {
+                        var dayIds = item.Select(p => p.ID).ToList();
+                        using (SimulationPartContext db = SimulationPartContext.GetContext(item.First().CreateTime))
+                        {
+                            var delItems = await db.SimulationInfos.Where(p => dayIds.Contains(p.ID)).ToListAsync();
+                            db.SimulationInfos.RemoveRange(delItems);
+                            await db.SaveChangesAsync();
+                        }
+
+                    }
+
+                });
+                gridView1.DeleteSelectedRows();
+
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, "删除选中的航迹异常");
+                DxHelper.MsgBoxHelper.ShowError("删除选中的航迹异常");
+            }
+            finally
+            {
+                //this.btnImp.Enabled = true;
+            }
+        }
+        private void gridView1_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
+        {
+            if (gridView1.RowCount == 0)
+            {
+                string txt = "右键添加航迹";
+                var s = e.Appearance.CalcTextSize(e.Cache, txt, e.Bounds.Width).ToSize();
+                var x = (e.Bounds.Width - s.Width) / 2;
+                var y = (e.Bounds.Height - s.Height) / 2;
+                e.Appearance.ForeColor = Color.Gray;
+                e.Appearance.DrawString(e.Cache, txt, new Rectangle(x, y, s.Width, s.Height));
+            }
+        }
+
+
+    }
+}

+ 188 - 0
DataSimulation.Forms/UserControl/CtrlFlight.resx

@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="barManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+  <assembly alias="DevExpress.Data.v23.2" name="DevExpress.Data.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+  <data name="btnAdd.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v23.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIzLjIsIFZlcnNpb249MjMuMi4z
+        LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
+        dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAKcCAAAC77u/
+        PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
+        IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
+        MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
+        Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg
+        MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KCS5Z
+        ZWxsb3d7ZmlsbDojRkZCMTE1O30KCS5CbGFja3tmaWxsOiM3MjcyNzI7fQoJLkdyZWVue2ZpbGw6IzAz
+        OUMyMzt9CgkuUmVke2ZpbGw6I0QxMUMxQzt9Cgkuc3Qwe29wYWNpdHk6MC43NTt9Cgkuc3Qxe29wYWNp
+        dHk6MC41O30KPC9zdHlsZT4NCiAgPGcgaWQ9IkFkZCI+DQogICAgPHBhdGggZD0iTTI3LDE0aC05VjVj
+        MC0wLjUtMC41LTEtMS0xaC0yYy0wLjUsMC0xLDAuNS0xLDF2OUg1Yy0wLjUsMC0xLDAuNS0xLDF2MmMw
+        LDAuNSwwLjUsMSwxLDFoOXY5ICAgYzAsMC41LDAuNSwxLDEsMWgyYzAuNSwwLDEtMC41LDEtMXYtOWg5
+        YzAuNSwwLDEtMC41LDEtMXYtMkMyOCwxNC41LDI3LjUsMTQsMjcsMTR6IiBjbGFzcz0iR3JlZW4iIC8+
+        DQogIDwvZz4NCjwvc3ZnPgs=
+</value>
+  </data>
+  <data name="btnDel.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v23.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIzLjIsIFZlcnNpb249MjMuMi4z
+        LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
+        dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAD4DAAAC77u/
+        PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
+        IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
+        MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
+        Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg
+        MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsYWNre2ZpbGw6IzczNzM3NDt9Cgku
+        WWVsbG93e2ZpbGw6I0ZDQjAxQjt9CgkuR3JlZW57ZmlsbDojMTI5QzQ5O30KCS5CbHVle2ZpbGw6IzM4
+        N0NCNzt9CgkuUmVke2ZpbGw6I0QwMjEyNzt9CgkuV2hpdGV7ZmlsbDojRkZGRkZGO30KCS5zdDB7b3Bh
+        Y2l0eTowLjU7fQoJLnN0MXtvcGFjaXR5OjAuNzU7fQoJLnN0MntvcGFjaXR5OjAuMjU7fQoJLnN0M3tk
+        aXNwbGF5Om5vbmU7ZmlsbDojNzM3Mzc0O30KPC9zdHlsZT4NCiAgPHBhdGggZD0iTTE4LjgsMTZsOC45
+        LTguOWMwLjQtMC40LDAuNC0xLDAtMS40bC0xLjQtMS40Yy0wLjQtMC40LTEtMC40LTEuNCwwTDE2LDEz
+        LjJMNy4xLDQuM2MtMC40LTAuNC0xLTAuNC0xLjQsMCAgTDQuMyw1LjdjLTAuNCwwLjQtMC40LDEsMCwx
+        LjRsOC45LDguOWwtOC45LDguOWMtMC40LDAuNC0wLjQsMSwwLDEuNGwxLjQsMS40YzAuNCwwLjQsMSww
+        LjQsMS40LDBsOC45LTguOWw4LjksOC45ICBjMC40LDAuNCwxLDAuNCwxLjQsMGwxLjQtMS40YzAuNC0w
+        LjQsMC40LTEsMC0xLjRMMTguOCwxNnoiIGNsYXNzPSJSZWQiIC8+DQo8L3N2Zz4L
+</value>
+  </data>
+  <data name="btnEdit.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v23.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIzLjIsIFZlcnNpb249MjMuMi4z
+        LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
+        dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAB0DAAAC77u/
+        PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
+        IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
+        MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
+        Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg
+        MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KCS5Z
+        ZWxsb3d7ZmlsbDojRkZCMTE1O30KCS5CbGFja3tmaWxsOiM3MjcyNzI7fQoJLkdyZWVue2ZpbGw6IzAz
+        OUMyMzt9CgkuUmVke2ZpbGw6I0QxMUMxQzt9Cgkuc3Qwe29wYWNpdHk6MC43NTt9Cgkuc3Qxe29wYWNp
+        dHk6MC41O30KPC9zdHlsZT4NCiAgPGcgaWQ9IkVkaXQiPg0KICAgIDxwYXRoIGQ9Ik0yNy42LDguMmwt
+        My44LTMuOGMtMC41LTAuNS0xLjQtMC41LTEuOSwwbC0yLjUsMi41bDUuOCw1LjhsMi41LTIuNUMyOC4x
+        LDkuNiwyOC4xLDguOCwyNy42LDguMnoiIGNsYXNzPSJCbHVlIiAvPg0KICAgIDxwb2x5Z29uIHBvaW50
+        cz0iNCwyOCA5LjgsMjggNCwyMi4yICAiIGNsYXNzPSJCbHVlIiAvPg0KICAgIDxyZWN0IHg9IjUuOCIg
+        eT0iMTMuNCIgd2lkdGg9IjE3LjYiIGhlaWdodD0iOC4yIiBjbGFzcz0iQmx1ZSIgdHJhbnNmb3JtPSJt
+        YXRyaXgoMC43MDcsIC0wLjcwNzIsIDAuNzA3MiwgMC43MDcsIC04LjA3MjEsIDE1LjQwNDgpIiAvPg0K
+        ICA8L2c+DQo8L3N2Zz4L
+</value>
+  </data>
+  <metadata name="popupMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>152, 17</value>
+  </metadata>
+</root>

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

@@ -97,7 +97,7 @@
     <Compile Include="Model\XlInfo.cs" />
     <Compile Include="PosData.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="SimulationInfoCache.cs" />
+    <Compile Include="SimulationCache.cs" />
     <Compile Include="TaskCache.cs" />
     <Compile Include="XlCache.cs" />
   </ItemGroup>

+ 1 - 1
DataSimulation.Repostory/Model/SimulationInfo.cs

@@ -16,7 +16,7 @@ namespace DataSimulation.Repostory.Model
     public class SimulationInfo : BaseModel<long>
     {
         [Display(Name = "仿真名称")]
-        public double SimulationName { get; set; }
+        public string SimulationName { get; set; }
 
         [Display(Name = "仿真速度(Km/s)")]
         public double SimulationSpeed { get; set; }

+ 50 - 0
DataSimulation.Repostory/SimulationCache.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using DataSimulation.Repostory.EFContext;
+using DataSimulation.Repostory.Model;
+
+namespace DataSimulation.Repostory
+{
+    public static class SimulationCache
+    {
+        /// <summary>
+        /// 获取数据库所有航迹
+        /// </summary>
+        /// <returns></returns>
+        public static async Task<List<SimulationInfo>> GetAllAsync()
+        {
+            try
+            {
+                List<SimulationInfo> list = new List<SimulationInfo>();
+                var dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DbPart");
+                if (!Directory.Exists(dir)) return list;
+                var yearDirs = Directory.EnumerateDirectories(dir).OrderByDescending(p => Convert.ToInt32(new DirectoryInfo(p).Name));//年目录,倒叙排列
+                foreach (var yearDir in yearDirs)
+                {
+                    //每一天的db文件,倒序排列
+                    var dayFiles = Directory.EnumerateFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, yearDir), "*.db").OrderByDescending(p => Convert.ToInt32(new DirectoryInfo(p).Name.Substring(0, 4)));
+                    foreach (var dayFile in dayFiles)
+                    {
+                        using (SimulationPartContext db = SimulationPartContext.GetContext(dayFile))
+                        {
+                            list.AddRange(await db.SimulationInfos.ToListAsync());
+                        }
+                    }
+                }
+                return list;
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, "加载仿真航迹信息异常");
+                return null;
+            }
+        }
+
+
+    }
+}