Browse Source

修改状态列

章政 7 years ago
parent
commit
3d195319f7

+ 37 - 13
UAS_DeviceMonitor/Main.Designer.cs

@@ -33,7 +33,6 @@ namespace UAS_DeviceMonitor
         /// </summary>
         private void InitializeComponent()
         {
-            this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
             this.RibbonNav = new DevExpress.XtraBars.Ribbon.RibbonControl();
             this.ButtonDeviceList = new DevExpress.XtraBars.BarButtonItem();
@@ -98,8 +97,9 @@ namespace UAS_DeviceMonitor
             this.dpc_enable = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dpc_status = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dpc_remark = new DevExpress.XtraGrid.Columns.GridColumn();
-            this.PollSettingStatusColumn = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.POLLSETTINGSTATUSCOLUMN = new DevExpress.XtraGrid.Columns.GridColumn();
             this.PollSettingItemColorEdit = new DevExpress.XtraEditors.Repository.RepositoryItemColorEdit();
+            this.PollSettingItemColorPickEdit = new DevExpress.XtraEditors.Repository.RepositoryItemColorPickEdit();
             this.PagePolling = new DevExpress.XtraTab.XtraTabPage();
             this.ButtonAddPolling = new UAS_DeviceMonitor.CustomerControl.Button.ButtonAddRow();
             this.ButtonDeletePolling = new UAS_DeviceMonitor.CustomerControl.Button.ButtonDeleteRow();
@@ -112,7 +112,6 @@ namespace UAS_DeviceMonitor
             this.pl_type = new DevExpress.XtraGrid.Columns.GridColumn();
             this.pl_dccode = new DevExpress.XtraGrid.Columns.GridColumn();
             this.pl_remark = new DevExpress.XtraGrid.Columns.GridColumn();
-            this.PollingTimer = new System.Windows.Forms.Timer(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).BeginInit();
             this.MainTabControl.SuspendLayout();
@@ -130,6 +129,7 @@ namespace UAS_DeviceMonitor
             ((System.ComponentModel.ISupportInitialize)(this.dpc_enableCheckEdit)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.PollingSetItemLookUpEdit)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.PollSettingItemColorEdit)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.PollSettingItemColorPickEdit)).BeginInit();
             this.PagePolling.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.GridPolling)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewPolling)).BeginInit();
@@ -644,7 +644,8 @@ namespace UAS_DeviceMonitor
             this.GridPollingSetting.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
             this.dpc_enableCheckEdit,
             this.PollingSetItemLookUpEdit,
-            this.PollSettingItemColorEdit});
+            this.PollSettingItemColorEdit,
+            this.PollSettingItemColorPickEdit});
             this.GridPollingSetting.RowCount = 0;
             this.GridPollingSetting.Size = new System.Drawing.Size(1027, 544);
             this.GridPollingSetting.TabIndex = 0;
@@ -666,7 +667,7 @@ namespace UAS_DeviceMonitor
             this.dpc_enable,
             this.dpc_status,
             this.dpc_remark,
-            this.PollSettingStatusColumn});
+            this.POLLSETTINGSTATUSCOLUMN});
             this.GridViewPollSetting.GridControl = this.GridPollingSetting;
             this.GridViewPollSetting.IndicatorWidth = 30;
             this.GridViewPollSetting.Name = "GridViewPollSetting";
@@ -681,6 +682,7 @@ namespace UAS_DeviceMonitor
             this.GRIDVIEWPOLLSETTINGCHOOSE.Name = "GRIDVIEWPOLLSETTINGCHOOSE";
             this.GRIDVIEWPOLLSETTINGCHOOSE.Visible = true;
             this.GRIDVIEWPOLLSETTINGCHOOSE.VisibleIndex = 0;
+            this.GRIDVIEWPOLLSETTINGCHOOSE.Width = 90;
             // 
             // dpc_enableCheckEdit
             // 
@@ -705,6 +707,7 @@ namespace UAS_DeviceMonitor
             this.dpc_decode.Name = "dpc_decode";
             this.dpc_decode.Visible = true;
             this.dpc_decode.VisibleIndex = 1;
+            this.dpc_decode.Width = 90;
             // 
             // dpc_plcode
             // 
@@ -713,6 +716,7 @@ namespace UAS_DeviceMonitor
             this.dpc_plcode.Name = "dpc_plcode";
             this.dpc_plcode.Visible = true;
             this.dpc_plcode.VisibleIndex = 2;
+            this.dpc_plcode.Width = 90;
             // 
             // dpc_plname
             // 
@@ -721,6 +725,7 @@ namespace UAS_DeviceMonitor
             this.dpc_plname.Name = "dpc_plname";
             this.dpc_plname.Visible = true;
             this.dpc_plname.VisibleIndex = 3;
+            this.dpc_plname.Width = 90;
             // 
             // dpc_interval
             // 
@@ -729,6 +734,7 @@ namespace UAS_DeviceMonitor
             this.dpc_interval.Name = "dpc_interval";
             this.dpc_interval.Visible = true;
             this.dpc_interval.VisibleIndex = 4;
+            this.dpc_interval.Width = 90;
             // 
             // dpc_dccode
             // 
@@ -738,6 +744,7 @@ namespace UAS_DeviceMonitor
             this.dpc_dccode.Name = "dpc_dccode";
             this.dpc_dccode.Visible = true;
             this.dpc_dccode.VisibleIndex = 5;
+            this.dpc_dccode.Width = 90;
             // 
             // PollingSetItemLookUpEdit
             // 
@@ -756,6 +763,7 @@ namespace UAS_DeviceMonitor
             this.dpc_function.Name = "dpc_function";
             this.dpc_function.Visible = true;
             this.dpc_function.VisibleIndex = 6;
+            this.dpc_function.Width = 90;
             // 
             // dpc_enable
             // 
@@ -765,6 +773,7 @@ namespace UAS_DeviceMonitor
             this.dpc_enable.Name = "dpc_enable";
             this.dpc_enable.Visible = true;
             this.dpc_enable.VisibleIndex = 7;
+            this.dpc_enable.Width = 90;
             // 
             // dpc_status
             // 
@@ -773,6 +782,7 @@ namespace UAS_DeviceMonitor
             this.dpc_status.Name = "dpc_status";
             this.dpc_status.Visible = true;
             this.dpc_status.VisibleIndex = 8;
+            this.dpc_status.Width = 90;
             // 
             // dpc_remark
             // 
@@ -781,14 +791,17 @@ namespace UAS_DeviceMonitor
             this.dpc_remark.Name = "dpc_remark";
             this.dpc_remark.Visible = true;
             this.dpc_remark.VisibleIndex = 9;
+            this.dpc_remark.Width = 87;
             // 
-            // PollSettingStatusColumn
+            // POLLSETTINGSTATUSCOLUMN
             // 
-            this.PollSettingStatusColumn.Caption = "运行状态";
-            this.PollSettingStatusColumn.FieldName = "PollSettingStatusColumn";
-            this.PollSettingStatusColumn.Name = "PollSettingStatusColumn";
-            this.PollSettingStatusColumn.Visible = true;
-            this.PollSettingStatusColumn.VisibleIndex = 10;
+            this.POLLSETTINGSTATUSCOLUMN.Caption = "运行状态";
+            this.POLLSETTINGSTATUSCOLUMN.ColumnEdit = this.PollSettingItemColorEdit;
+            this.POLLSETTINGSTATUSCOLUMN.FieldName = "POLLSETTINGSTATUSCOLUMN";
+            this.POLLSETTINGSTATUSCOLUMN.Name = "POLLSETTINGSTATUSCOLUMN";
+            this.POLLSETTINGSTATUSCOLUMN.Visible = true;
+            this.POLLSETTINGSTATUSCOLUMN.VisibleIndex = 10;
+            this.POLLSETTINGSTATUSCOLUMN.Width = 98;
             // 
             // PollSettingItemColorEdit
             // 
@@ -799,7 +812,17 @@ namespace UAS_DeviceMonitor
             this.PollSettingItemColorEdit.AutoHeight = false;
             this.PollSettingItemColorEdit.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.PollSettingItemColorEdit.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom;
             this.PollSettingItemColorEdit.Name = "PollSettingItemColorEdit";
+            this.PollSettingItemColorEdit.ReadOnly = true;
+            // 
+            // PollSettingItemColorPickEdit
+            // 
+            this.PollSettingItemColorPickEdit.AutoHeight = false;
+            this.PollSettingItemColorPickEdit.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.PollSettingItemColorPickEdit.Name = "PollSettingItemColorPickEdit";
+            this.PollSettingItemColorPickEdit.ReadOnly = true;
             // 
             // PagePolling
             // 
@@ -955,6 +978,7 @@ namespace UAS_DeviceMonitor
             ((System.ComponentModel.ISupportInitialize)(this.dpc_enableCheckEdit)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.PollingSetItemLookUpEdit)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.PollSettingItemColorEdit)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.PollSettingItemColorPickEdit)).EndInit();
             this.PagePolling.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.GridPolling)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewPolling)).EndInit();
@@ -1039,9 +1063,9 @@ namespace UAS_DeviceMonitor
         private CustomerControl.Button.ButtonAddRow ButtonNewCommandSet;
         private CustomerControl.Button.ButtonSaveGrid ButtonSaveCommandSet;
         private DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit PollingSetItemLookUpEdit;
-        private System.Windows.Forms.Timer PollingTimer;
         private DevExpress.XtraGrid.Columns.GridColumn GRIDVIEWPOLLSETTINGCHOOSE;
-        private DevExpress.XtraGrid.Columns.GridColumn PollSettingStatusColumn;
         private DevExpress.XtraEditors.Repository.RepositoryItemColorEdit PollSettingItemColorEdit;
+        private DevExpress.XtraEditors.Repository.RepositoryItemColorPickEdit PollSettingItemColorPickEdit;
+        private DevExpress.XtraGrid.Columns.GridColumn POLLSETTINGSTATUSCOLUMN;
     }
 }

+ 10 - 5
UAS_DeviceMonitor/Main.cs

@@ -9,6 +9,8 @@ using UAS_DeviceMonitor.PublicMethod;
 using DevExpress.XtraGrid.Views.Grid;
 using System.Collections.Generic;
 using DevExpress.XtraEditors;
+using System.Drawing;
+using DevExpress.XtraEditors.Controls;
 
 namespace UAS_DeviceMonitor
 {
@@ -39,7 +41,7 @@ namespace UAS_DeviceMonitor
             ButtonSavePolling.Grid = GridPolling;
             ButtonAddPolling.Grid = GridPolling;
             //轮询配置界面
-            GridPollingSetting.GetDataSQL = "SELECT 0 GRIDVIEWPOLLSETTINGCHOOSE,'11' POLLSETTINGSTATUSCOLUMN,DPC_ID,DPC_DECODE ,DPC_PLCODE ,DPC_PLNAME ,DPC_INTERVAL ,DPC_DCCODE ,DPC_FUNCTION , DPC_ENABLE,DPC_STATUS ,DPC_REMARK FROM DEVICEPOLLINGCONFIG";
+            GridPollingSetting.GetDataSQL = "SELECT 0 GRIDVIEWPOLLSETTINGCHOOSE,'' POLLSETTINGSTATUSCOLUMN,DPC_ID,DPC_DECODE ,DPC_PLCODE ,DPC_PLNAME ,DPC_INTERVAL ,DPC_DCCODE ,DPC_FUNCTION , DPC_ENABLE,DPC_STATUS ,DPC_REMARK FROM DEVICEPOLLINGCONFIG";
             GridPollingSetting.ID = "DPC_ID";
             GridPollingSetting.TableName = "DEVICEPOLLINGCONFIG";
             GridPollingSetting.InsertSQL = "insert into DEVICEPOLLINGCONFIG(DPC_ID,DPC_DECODE ,DPC_PLCODE ,DPC_PLNAME ,DPC_INTERVAL ,DPC_DCCODE ,DPC_FUNCTION , DPC_ENABLE,DPC_STATUS ,DPC_REMARK) values(DEVICEPOLLINGCONFIG_seq.nextval,:DPC_DECODE ,:DPC_PLCODE ,:DPC_PLNAME ,:DPC_INTERVAL ,:DPC_DCCODE ,:DPC_FUNCTION , :DPC_ENABLE,:DPC_STATUS ,:DPC_REMARK)";
@@ -181,7 +183,10 @@ namespace UAS_DeviceMonitor
                 pl.Enable = GridViewPollSetting.GetRowCellValue(i, "DPC_ENABLE").ToString() != "0";
                 pl.Code = GridViewPollSetting.GetRowCellValue(i, "DPC_PLCODE").ToString();
                 if (pl.Enable)
+                {
                     pt.AddTask(RunTask, pl);
+                    GridViewPollSetting.SetRowCellValue(i, "POLLSETTINGSTATUSCOLUMN", "green");
+                }
             }
         }
 
@@ -231,6 +236,8 @@ namespace UAS_DeviceMonitor
             {
                 item.Value.Stop();
             }
+            for (int i = 0; i < GridPollingSetting.RowCount; i++)
+                GridViewPollSetting.SetRowCellValue(i, "POLLSETTINGSTATUSCOLUMN", "White");
             Ptime.Clear();
         }
 
@@ -239,7 +246,6 @@ namespace UAS_DeviceMonitor
             GridViewPollSetting.SetRowCellValue(e.RowHandle, e.Column, e.Value);
             if (e.Column.Name.ToUpper() == "DPC_ENABLE")
             {
-
                 if (GridViewPollSetting.GetRowCellValue(e.RowHandle, "DPC_ENABLE").ToString() == "0")
                 {
                     int id = int.Parse(GridViewPollSetting.GetRowCellValue(e.RowHandle, "DPC_ID").ToString());
@@ -247,6 +253,7 @@ namespace UAS_DeviceMonitor
                     {
                         Ptime[id].Stop();
                         Ptime.Remove(id);
+                        GridViewPollSetting.SetRowCellValue(e.RowHandle, "POLLSETTINGSTATUSCOLUMN", "White");
                     }
                 }
                 else
@@ -259,11 +266,9 @@ namespace UAS_DeviceMonitor
                     pl.Code = GridViewPollSetting.GetRowCellValue(e.RowHandle, "DPC_PLCODE").ToString();
                     if (pl.Enable)
                         pt.AddTask(RunTask, pl);
-
-                    //GridViewPollSetting.SetRowCellValue(e.RowHandle, "PollSettingStatusColumn", Color.Green);
+                    GridViewPollSetting.SetRowCellValue(e.RowHandle, "POLLSETTINGSTATUSCOLUMN", "Green");
                 }
             }
-            Console.WriteLine(GridViewPollSetting.GetRowCellValue(e.RowHandle, e.Column));
         }
 
         /// <summary>

+ 0 - 3
UAS_DeviceMonitor/Main.resx

@@ -453,9 +453,6 @@
         geLKUTtl+f8gY//Axjn6F8f+AXtHGV3GT+qTmOL/wFqMAAAAAElFTkSuQmCC
 </value>
   </data>
-  <metadata name="PollingTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         AAABAAEAQEAAAAEAIAAoQgAAFgAAACgAAABAAAAAgAAAAAEAIAAAAAAAAEAAABMLAAATCwAAAAAAAAAA

+ 2 - 0
UAS_DeviceMonitor/UAS_DeviceMonitor.csproj

@@ -175,6 +175,8 @@
     <None Include="Resources\U_Letter_72px_1121581_easyicon.net.png" />
     <None Include="Resources\netstatus_tx_64px_18991_easyicon.net.png" />
     <None Include="Resources\U_Letter_64px_1121581_easyicon.net.ico" />
+    <None Include="Resources\close_24px_1069872_easyicon.net.png" />
+    <None Include="Resources\check_16px_1137507_easyicon.net.png" />
     <Content Include="Tool\Oracle.ManagedDataAccess.dll" />
   </ItemGroup>
   <ItemGroup>