wyq 1 year ago
parent
commit
e2507c4314

+ 11 - 8
DataSimulation.Forms/EditForms/TaskEditor.Designer.cs

@@ -29,11 +29,6 @@
         private void InitializeComponent()
         {
             this.components = new System.ComponentModel.Container();
-            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions1 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject2 = new DevExpress.Utils.SerializableAppearanceObject();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject3 = new DevExpress.Utils.SerializableAppearanceObject();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject4 = new DevExpress.Utils.SerializableAppearanceObject();
             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();
@@ -44,6 +39,11 @@
             DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject10 = new DevExpress.Utils.SerializableAppearanceObject();
             DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject11 = new DevExpress.Utils.SerializableAppearanceObject();
             DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject12 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions4 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject13 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject14 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject15 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject16 = new DevExpress.Utils.SerializableAppearanceObject();
             this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
             this.txtHj = new DevExpress.XtraEditors.SearchLookUpEdit();
             this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
@@ -152,6 +152,7 @@
             this.txtHj.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.txtHj.Properties.PopupView = this.gridView1;
+            this.txtHj.Properties.EditValueChanged += new System.EventHandler(this.txtHj_Properties_EditValueChanged);
             this.txtHj.Size = new System.Drawing.Size(291, 20);
             this.txtHj.StyleController = this.layoutControl1;
             this.txtHj.TabIndex = 17;
@@ -161,6 +162,8 @@
             this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
             this.gridView1.Name = "gridView1";
             this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
+            this.gridView1.OptionsSelection.MultiSelect = true;
+            this.gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
             this.gridView1.OptionsView.ShowGroupPanel = false;
             // 
             // mapControl
@@ -196,7 +199,7 @@
             this.txtSpeed.Location = new System.Drawing.Point(12, 467);
             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, editorButtonImageOptions1, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, serializableAppearanceObject2, serializableAppearanceObject3, serializableAppearanceObject4, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
+            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.Size = new System.Drawing.Size(291, 23);
@@ -208,7 +211,7 @@
             this.txtBand.Location = new System.Drawing.Point(12, 423);
             this.txtBand.Name = "txtBand";
             this.txtBand.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
-            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "MHz", -1, false, true, false, editorButtonImageOptions2, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject5, serializableAppearanceObject6, serializableAppearanceObject7, serializableAppearanceObject8, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "MHz", -1, false, true, false, editorButtonImageOptions3, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject9, serializableAppearanceObject10, serializableAppearanceObject11, serializableAppearanceObject12, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
             this.txtBand.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager));
             this.txtBand.Properties.MaskSettings.Set("mask", "f3");
             this.txtBand.Size = new System.Drawing.Size(291, 23);
@@ -220,7 +223,7 @@
             this.txtFreqUp.Location = new System.Drawing.Point(12, 379);
             this.txtFreqUp.Name = "txtFreqUp";
             this.txtFreqUp.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
-            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "MHz", -1, false, true, false, editorButtonImageOptions3, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject9, serializableAppearanceObject10, serializableAppearanceObject11, serializableAppearanceObject12, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "MHz", -1, false, true, false, editorButtonImageOptions4, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject13, serializableAppearanceObject14, serializableAppearanceObject15, serializableAppearanceObject16, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
             this.txtFreqUp.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager));
             this.txtFreqUp.Properties.MaskSettings.Set("mask", "f3");
             this.txtFreqUp.Size = new System.Drawing.Size(291, 23);

+ 12 - 2
DataSimulation.Forms/EditForms/TaskEditor.cs

@@ -39,7 +39,7 @@ namespace DataSimulation.Forms.EditForms
             this.radioSimulationType.Properties.Items.AddRange(radioGroups.ToArray());
             this.radioSimulationType.SelectedIndex = 0;
 
-
+          
         }
 
         public TaskEditor(TaskInfo info)
@@ -78,7 +78,12 @@ namespace DataSimulation.Forms.EditForms
             });
 
             var hjList = await SimulationCache.GetAllAsync();
-            this.txtHj.UseDefault().SetData(hjList, nameof(SimulationInfo.SimulationName)).UseDoubleClickToSelectAll();
+            this.txtHj.UseDefault();
+            // this.txtHj.SetData(hjList, nameof(SimulationInfo.SimulationName));
+            txtHj.Properties.DataSource = hjList;
+            txtHj.Properties.ValueMember = nameof(SimulationInfo.ID);
+            txtHj.Properties.DisplayMember = nameof(SimulationInfo.SimulationName);
+
 
             using (SimulationContext db = new SimulationContext())
             {
@@ -215,5 +220,10 @@ namespace DataSimulation.Forms.EditForms
         {
             validation();
         }
+
+        private void txtHj_Properties_EditValueChanged(object sender, EventArgs e)
+        {
+
+        }
     }
 }

+ 37 - 24
DataSimulation.Forms/UserControl/CtrlHistoryTask.Designer.cs

@@ -43,13 +43,14 @@
             this.txtStartTime = new DevExpress.XtraEditors.DateEdit();
             this.gridHistoryTask = new DevExpress.XtraGrid.GridControl();
             this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
+            this.txtTaskName = new DevExpress.XtraEditors.TextEdit();
             this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
             this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
-            this.txtTaskName = new DevExpress.XtraEditors.TextEdit();
+            this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
             ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
@@ -60,13 +61,14 @@
             ((System.ComponentModel.ISupportInitialize)(this.txtStartTime.Properties.CalendarTimeProperties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridHistoryTask)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtTaskName.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtTaskName.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
             this.SuspendLayout();
             // 
             // barManager1
@@ -144,9 +146,9 @@
             // 
             // btnSearch
             // 
-            this.btnSearch.Location = new System.Drawing.Point(584, 12);
+            this.btnSearch.Location = new System.Drawing.Point(390, 12);
             this.btnSearch.Name = "btnSearch";
-            this.btnSearch.Size = new System.Drawing.Size(51, 22);
+            this.btnSearch.Size = new System.Drawing.Size(31, 22);
             this.btnSearch.StyleController = this.layoutControl1;
             this.btnSearch.TabIndex = 8;
             this.btnSearch.Text = "查询";
@@ -155,28 +157,28 @@
             // txtEndTime
             // 
             this.txtEndTime.EditValue = null;
-            this.txtEndTime.Location = new System.Drawing.Point(456, 12);
+            this.txtEndTime.Location = new System.Drawing.Point(319, 12);
             this.txtEndTime.MenuManager = this.barManager1;
             this.txtEndTime.Name = "txtEndTime";
             this.txtEndTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.txtEndTime.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
-            this.txtEndTime.Size = new System.Drawing.Size(124, 20);
+            this.txtEndTime.Size = new System.Drawing.Size(67, 20);
             this.txtEndTime.StyleController = this.layoutControl1;
             this.txtEndTime.TabIndex = 7;
             // 
             // txtStartTime
             // 
             this.txtStartTime.EditValue = null;
-            this.txtStartTime.Location = new System.Drawing.Point(264, 12);
+            this.txtStartTime.Location = new System.Drawing.Point(191, 12);
             this.txtStartTime.MenuManager = this.barManager1;
             this.txtStartTime.Name = "txtStartTime";
             this.txtStartTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.txtStartTime.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
-            this.txtStartTime.Size = new System.Drawing.Size(128, 20);
+            this.txtStartTime.Size = new System.Drawing.Size(64, 20);
             this.txtStartTime.StyleController = this.layoutControl1;
             this.txtStartTime.TabIndex = 6;
             // 
@@ -196,6 +198,15 @@
             this.gridView1.GridControl = this.gridHistoryTask;
             this.gridView1.Name = "gridView1";
             // 
+            // txtTaskName
+            // 
+            this.txtTaskName.Location = new System.Drawing.Point(72, 12);
+            this.txtTaskName.MenuManager = this.barManager1;
+            this.txtTaskName.Name = "txtTaskName";
+            this.txtTaskName.Size = new System.Drawing.Size(55, 20);
+            this.txtTaskName.StyleController = this.layoutControl1;
+            this.txtTaskName.TabIndex = 4;
+            // 
             // Root
             // 
             this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
@@ -205,7 +216,8 @@
             this.layoutControlItem2,
             this.layoutControlItem3,
             this.layoutControlItem4,
-            this.layoutControlItem5});
+            this.layoutControlItem5,
+            this.emptySpaceItem1});
             this.Root.Name = "Root";
             this.Root.Size = new System.Drawing.Size(647, 422);
             this.Root.TextVisible = false;
@@ -215,7 +227,7 @@
             this.layoutControlItem1.Control = this.txtTaskName;
             this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
             this.layoutControlItem1.Name = "layoutControlItem1";
-            this.layoutControlItem1.Size = new System.Drawing.Size(192, 26);
+            this.layoutControlItem1.Size = new System.Drawing.Size(119, 26);
             this.layoutControlItem1.Text = "任务名";
             this.layoutControlItem1.TextSize = new System.Drawing.Size(48, 14);
             // 
@@ -231,38 +243,37 @@
             // layoutControlItem3
             // 
             this.layoutControlItem3.Control = this.txtStartTime;
-            this.layoutControlItem3.Location = new System.Drawing.Point(192, 0);
+            this.layoutControlItem3.Location = new System.Drawing.Point(119, 0);
             this.layoutControlItem3.Name = "layoutControlItem3";
-            this.layoutControlItem3.Size = new System.Drawing.Size(192, 26);
+            this.layoutControlItem3.Size = new System.Drawing.Size(128, 26);
             this.layoutControlItem3.Text = "开始时间";
             this.layoutControlItem3.TextSize = new System.Drawing.Size(48, 14);
             // 
             // layoutControlItem4
             // 
             this.layoutControlItem4.Control = this.txtEndTime;
-            this.layoutControlItem4.Location = new System.Drawing.Point(384, 0);
+            this.layoutControlItem4.Location = new System.Drawing.Point(247, 0);
             this.layoutControlItem4.Name = "layoutControlItem4";
-            this.layoutControlItem4.Size = new System.Drawing.Size(188, 26);
+            this.layoutControlItem4.Size = new System.Drawing.Size(131, 26);
             this.layoutControlItem4.Text = "结束时间";
             this.layoutControlItem4.TextSize = new System.Drawing.Size(48, 14);
             // 
             // layoutControlItem5
             // 
             this.layoutControlItem5.Control = this.btnSearch;
-            this.layoutControlItem5.Location = new System.Drawing.Point(572, 0);
+            this.layoutControlItem5.Location = new System.Drawing.Point(378, 0);
             this.layoutControlItem5.Name = "layoutControlItem5";
-            this.layoutControlItem5.Size = new System.Drawing.Size(55, 26);
+            this.layoutControlItem5.Size = new System.Drawing.Size(35, 26);
             this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem5.TextVisible = false;
             // 
-            // txtTaskName
+            // emptySpaceItem1
             // 
-            this.txtTaskName.Location = new System.Drawing.Point(72, 12);
-            this.txtTaskName.MenuManager = this.barManager1;
-            this.txtTaskName.Name = "txtTaskName";
-            this.txtTaskName.Size = new System.Drawing.Size(128, 20);
-            this.txtTaskName.StyleController = this.layoutControl1;
-            this.txtTaskName.TabIndex = 4;
+            this.emptySpaceItem1.AllowHotTrack = false;
+            this.emptySpaceItem1.Location = new System.Drawing.Point(413, 0);
+            this.emptySpaceItem1.Name = "emptySpaceItem1";
+            this.emptySpaceItem1.Size = new System.Drawing.Size(214, 26);
+            this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
             // 
             // CtrlHistoryTask
             // 
@@ -286,13 +297,14 @@
             ((System.ComponentModel.ISupportInitialize)(this.txtStartTime.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridHistoryTask)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtTaskName.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtTaskName.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -319,5 +331,6 @@
         private DevExpress.XtraEditors.SimpleButton btnSearch;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5;
         private DevExpress.XtraEditors.TextEdit txtTaskName;
+        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1;
     }
 }

+ 12 - 9
DataSimulation.Forms/UserControl/CtrlHistoryTask.cs

@@ -21,6 +21,7 @@ namespace DataSimulation.Forms.UserControl
     public partial class CtrlHistoryTask : DevExpress.XtraEditors.XtraUserControl
     {
         List<TaskInfo> list = new List<TaskInfo>();
+        List<TaskInfo> listAllHistory = new List<TaskInfo>();
         public CtrlHistoryTask()
         {
             InitializeComponent();
@@ -32,7 +33,8 @@ namespace DataSimulation.Forms.UserControl
                 gridHistoryTask.Init<TaskInfo>().UseSort().UseFilter().UseMultiSelect().UseRowNumber();
                 gridHistoryTask.DataSource = list;
                 var taskListCache = await TaskCache.GetAllAsync();
-                list.AddRange(taskListCache.Where(w=>w.isHistory));
+                listAllHistory = taskListCache.Where(w => w.isHistory).ToList();
+                list.AddRange(listAllHistory);
                 gridView1.RefreshData();
                 txtStartTime.UseDefault();
                 txtEndTime.UseDefault();
@@ -99,22 +101,23 @@ namespace DataSimulation.Forms.UserControl
             }
         }
 
-        private void btnSearch_Click(object sender, EventArgs e)
+        private async void btnSearch_Click(object sender, EventArgs e)
         {
-            var res = new List<TaskInfo>();
+            var res = listAllHistory;
             if (!string.IsNullOrEmpty(txtTaskName.Text))
             {
-                //res = list.Where(w => !w.TaskName.Contains(txtTaskName.Text)).ToList();
-                //list.RemoveRange(w => !w.TaskName.Contains(txtTaskName.Text));
+                res = res.Where(w => w.TaskName.Contains(txtTaskName.Text)).ToList();
             }
-            else if (txtStartTime.DateTime != DateTime.MinValue)
+            if (txtStartTime.DateTime != DateTime.MinValue)
             {
-                list = list.Where(w => w.CreateTime >= txtStartTime.DateTime).ToList();
+                res = res.Where(w => w.CreateTime >= txtStartTime.DateTime).ToList();
             }
-            else if (txtEndTime.DateTime != DateTime.MinValue)
+            if (txtEndTime.DateTime != DateTime.MinValue)
             {
-                list = list.Where(w => w.CreateTime <= txtEndTime.DateTime).ToList();
+                res = res.Where(w => w.CreateTime <= txtEndTime.DateTime).ToList();
             }
+            list.Clear();
+            list.AddRange(res); 
             gridView1.RefreshData();
         }
     }