Browse Source

添加指令代码添加界面

章政 7 years ago
parent
commit
163c136911

+ 5 - 0
UAS_DeviceMonitor/CustomerControl/AutoDataGridControl/AutoDataGridControl.cs

@@ -98,6 +98,11 @@ namespace UAS_DeviceMonitor.CustomerControl.AutoDataGridControl
         }
 
         private void AutoDataGridControl_VisibleChanged(object sender, EventArgs e)
+        {
+            RefreshData();
+        }
+
+        public void RefreshData()
         {
             if (getDataSQL != null)
             {

+ 159 - 0
UAS_DeviceMonitor/Device/Command/FormNewCommand.Designer.cs

@@ -0,0 +1,159 @@
+namespace UAS_DeviceMonitor.Device.Command
+{
+    partial class FormNewCommand
+    {
+        /// <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.AddCommand = new DevExpress.XtraEditors.SimpleButton();
+            this.CodeClientAddress = new DevExpress.XtraEditors.ComboBoxEdit();
+            this.comboBoxEdit2 = new DevExpress.XtraEditors.ComboBoxEdit();
+            this.textEdit1 = new DevExpress.XtraEditors.TextEdit();
+            this.textEdit2 = new DevExpress.XtraEditors.TextEdit();
+            this.CodeClientAddress_label = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
+            ((System.ComponentModel.ISupportInitialize)(this.CodeClientAddress.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit2.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.textEdit2.Properties)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // AddCommand
+            // 
+            this.AddCommand.Location = new System.Drawing.Point(230, 118);
+            this.AddCommand.Name = "AddCommand";
+            this.AddCommand.Size = new System.Drawing.Size(75, 23);
+            this.AddCommand.TabIndex = 0;
+            this.AddCommand.Text = "确认添加";
+            this.AddCommand.Click += new System.EventHandler(this.AddCommand_Click);
+            // 
+            // CodeClientAddress
+            // 
+            this.CodeClientAddress.Location = new System.Drawing.Point(88, 65);
+            this.CodeClientAddress.Name = "CodeClientAddress";
+            this.CodeClientAddress.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.CodeClientAddress.Size = new System.Drawing.Size(50, 20);
+            this.CodeClientAddress.TabIndex = 1;
+            // 
+            // comboBoxEdit2
+            // 
+            this.comboBoxEdit2.Location = new System.Drawing.Point(199, 65);
+            this.comboBoxEdit2.Name = "comboBoxEdit2";
+            this.comboBoxEdit2.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.comboBoxEdit2.Size = new System.Drawing.Size(50, 20);
+            this.comboBoxEdit2.TabIndex = 2;
+            // 
+            // textEdit1
+            // 
+            this.textEdit1.Location = new System.Drawing.Point(307, 65);
+            this.textEdit1.Name = "textEdit1";
+            this.textEdit1.Size = new System.Drawing.Size(60, 20);
+            this.textEdit1.TabIndex = 3;
+            // 
+            // textEdit2
+            // 
+            this.textEdit2.Location = new System.Drawing.Point(437, 65);
+            this.textEdit2.Name = "textEdit2";
+            this.textEdit2.Size = new System.Drawing.Size(60, 20);
+            this.textEdit2.TabIndex = 4;
+            // 
+            // CodeClientAddress_label
+            // 
+            this.CodeClientAddress_label.Location = new System.Drawing.Point(31, 68);
+            this.CodeClientAddress_label.Name = "CodeClientAddress_label";
+            this.CodeClientAddress_label.Size = new System.Drawing.Size(48, 14);
+            this.CodeClientAddress_label.TabIndex = 5;
+            this.CodeClientAddress_label.Text = "从站地址";
+            // 
+            // labelControl2
+            // 
+            this.labelControl2.Location = new System.Drawing.Point(157, 68);
+            this.labelControl2.Name = "labelControl2";
+            this.labelControl2.Size = new System.Drawing.Size(36, 14);
+            this.labelControl2.TabIndex = 6;
+            this.labelControl2.Text = "命令码";
+            // 
+            // labelControl3
+            // 
+            this.labelControl3.Location = new System.Drawing.Point(265, 68);
+            this.labelControl3.Name = "labelControl3";
+            this.labelControl3.Size = new System.Drawing.Size(36, 14);
+            this.labelControl3.TabIndex = 7;
+            this.labelControl3.Text = "地址位";
+            // 
+            // labelControl4
+            // 
+            this.labelControl4.Location = new System.Drawing.Point(383, 68);
+            this.labelControl4.Name = "labelControl4";
+            this.labelControl4.Size = new System.Drawing.Size(48, 14);
+            this.labelControl4.TabIndex = 8;
+            this.labelControl4.Text = "操作位数";
+            // 
+            // FormNewCommand
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(533, 165);
+            this.Controls.Add(this.labelControl4);
+            this.Controls.Add(this.labelControl3);
+            this.Controls.Add(this.labelControl2);
+            this.Controls.Add(this.CodeClientAddress_label);
+            this.Controls.Add(this.textEdit2);
+            this.Controls.Add(this.textEdit1);
+            this.Controls.Add(this.comboBoxEdit2);
+            this.Controls.Add(this.CodeClientAddress);
+            this.Controls.Add(this.AddCommand);
+            this.FormBorderEffect = DevExpress.XtraEditors.FormBorderEffect.None;
+            this.Name = "FormNewCommand";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "新增指令";
+            this.Load += new System.EventHandler(this.FormNewCommand_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.CodeClientAddress.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit2.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.textEdit2.Properties)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private DevExpress.XtraEditors.SimpleButton AddCommand;
+        private DevExpress.XtraEditors.ComboBoxEdit CodeClientAddress;
+        private DevExpress.XtraEditors.ComboBoxEdit comboBoxEdit2;
+        private DevExpress.XtraEditors.TextEdit textEdit1;
+        private DevExpress.XtraEditors.TextEdit textEdit2;
+        private DevExpress.XtraEditors.LabelControl CodeClientAddress_label;
+        private DevExpress.XtraEditors.LabelControl labelControl2;
+        private DevExpress.XtraEditors.LabelControl labelControl3;
+        private DevExpress.XtraEditors.LabelControl labelControl4;
+    }
+}

+ 26 - 0
UAS_DeviceMonitor/Device/Command/FormNewCommand.cs

@@ -0,0 +1,26 @@
+using System;
+using DevExpress.XtraEditors;
+using UAS_DeviceMonitor.Entity;
+
+namespace UAS_DeviceMonitor.Device.Command
+{
+    public partial class FormNewCommand : XtraForm
+    {
+        public FormNewCommand()
+        {
+            InitializeComponent();
+        }
+
+        private void FormNewCommand_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        private void AddCommand_Click(object sender, EventArgs e)
+        {
+            SystemInf.dh.ExecuteSql("insert into devicecommand(dc_id,dc_name,dc_code,dc_command) values (devicecommand_seq.nextval,'','','')", "insert");
+            XtraMessageBox.Show("指令保存成功");
+            Close();
+        }
+    }
+}

+ 120 - 0
UAS_DeviceMonitor/Device/Command/FormNewCommand.resx

@@ -0,0 +1,120 @@
+<?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>
+</root>

+ 20 - 8
UAS_DeviceMonitor/Main.Designer.cs

@@ -1,4 +1,5 @@
-using UAS_DeviceMonitor.CustomerControl.AutoDataGridControl;
+using DevExpress.XtraEditors;
+using UAS_DeviceMonitor.CustomerControl.AutoDataGridControl;
 
 namespace UAS_DeviceMonitor
 {
@@ -58,6 +59,7 @@ namespace UAS_DeviceMonitor
             this.de_address = new DevExpress.XtraGrid.Columns.GridColumn();
             this.de_wccode = new DevExpress.XtraGrid.Columns.GridColumn();
             this.PageCommandSet = new DevExpress.XtraTab.XtraTabPage();
+            this.ButtonNewCommand = new SimpleButton();
             this.ButtonSaveCommand = new UAS_DeviceMonitor.CustomerControl.Button.ButtonAddRow();
             this.GridCommandSetting = new UAS_DeviceMonitor.CustomerControl.AutoDataGridControl.AutoDataGridControl();
             this.GridViewCommandSet = new DevExpress.XtraGrid.Views.Grid.GridView();
@@ -371,6 +373,7 @@ namespace UAS_DeviceMonitor
             // 
             // PageCommandSet
             // 
+            this.PageCommandSet.Controls.Add(this.ButtonNewCommand);
             this.PageCommandSet.Controls.Add(this.ButtonSaveCommand);
             this.PageCommandSet.Controls.Add(this.GridCommandSetting);
             this.PageCommandSet.Name = "PageCommandSet";
@@ -378,6 +381,15 @@ namespace UAS_DeviceMonitor
             this.PageCommandSet.Size = new System.Drawing.Size(1027, 577);
             this.PageCommandSet.Text = "xtraTabPage1";
             // 
+            // ButtonNewCommand
+            // 
+            this.ButtonNewCommand.Location = new System.Drawing.Point(886, 551);
+            this.ButtonNewCommand.Name = "ButtonNewCommand";
+            this.ButtonNewCommand.Size = new System.Drawing.Size(64, 23);
+            this.ButtonNewCommand.TabIndex = 3;
+            this.ButtonNewCommand.Text = "新增";
+            this.ButtonNewCommand.Click += new System.EventHandler(this.ButtonNewCommand_Click);
+            // 
             // ButtonSaveCommand
             // 
             this.ButtonSaveCommand.Grid = null;
@@ -389,8 +401,8 @@ namespace UAS_DeviceMonitor
             // 
             // GridCommandSetting
             // 
-            this.GridCommandSetting.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
+            this.GridCommandSetting.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+            | System.Windows.Forms.AnchorStyles.Left)
             | System.Windows.Forms.AnchorStyles.Right)));
             this.GridCommandSetting.GetDataSQL = null;
             this.GridCommandSetting.ID = null;
@@ -472,8 +484,8 @@ namespace UAS_DeviceMonitor
             // 
             // GridPollingSetting
             // 
-            this.GridPollingSetting.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
+            this.GridPollingSetting.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+            | System.Windows.Forms.AnchorStyles.Left)
             | System.Windows.Forms.AnchorStyles.Right)));
             this.GridPollingSetting.GetDataSQL = null;
             this.GridPollingSetting.ID = null;
@@ -485,7 +497,7 @@ namespace UAS_DeviceMonitor
             this.GridPollingSetting.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
             this.dpc_enableCheckEdit});
             this.GridPollingSetting.RowCount = 0;
-            this.GridPollingSetting.Size = new System.Drawing.Size(1027, 582);
+            this.GridPollingSetting.Size = new System.Drawing.Size(1027, 545);
             this.GridPollingSetting.TabIndex = 0;
             this.GridPollingSetting.TableName = null;
             this.GridPollingSetting.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -685,8 +697,7 @@ namespace UAS_DeviceMonitor
             this.AllowFormGlass = DevExpress.Utils.DefaultBoolean.False;
             this.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128)))));
             this.Appearance.Options.UseForeColor = true;
-            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
             this.ClientSize = new System.Drawing.Size(1033, 711);
             this.Controls.Add(this.MainTabControl);
             this.Controls.Add(this.RibbonNav);
@@ -777,5 +788,6 @@ namespace UAS_DeviceMonitor
         private DevExpress.XtraGrid.Columns.GridColumn dpc_remark;
         private DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit dpc_enableCheckEdit;
         private CustomerControl.Button.ButtonAddRow ButtonSaveCommand;
+        private SimpleButton ButtonNewCommand;
     }
 }

+ 8 - 0
UAS_DeviceMonitor/Main.cs

@@ -5,6 +5,7 @@ using System.Data;
 using System.Text;
 using DevExpress.XtraTab;
 using UAS_DeviceMonitor.Entity;
+using UAS_DeviceMonitor.Device.Command;
 
 namespace UAS_DeviceMonitor
 {
@@ -88,5 +89,12 @@ namespace UAS_DeviceMonitor
             }
             e.Handled = true;
         }
+
+        private void ButtonNewCommand_Click(object sender, EventArgs e)
+        {
+            FormNewCommand fncmd = new FormNewCommand();
+            fncmd.ShowDialog();
+            GridCommandSetting.RefreshData();
+        }
     }
 }

+ 1 - 0
UAS_DeviceMonitor/Program.cs

@@ -59,6 +59,7 @@ namespace UAS_DeviceMonitor
                 //创建记录打印进程的文件
                 FileStream fas = new FileStream(SystemInf.CacheFolder + "lblprocess.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
                 fas.Close();
+                DevExpress.Skins.SkinManager.EnableFormSkins();
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                     Application.Run(new Main());
                 else

+ 9 - 1
UAS_DeviceMonitor/UAS_DeviceMonitor.csproj

@@ -85,6 +85,12 @@
       <DependentUpon>PageControl.cs</DependentUpon>
     </Compile>
     <Compile Include="DataOperate\DataHelper.cs" />
+    <Compile Include="Device\Command\FormNewCommand.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Device\Command\FormNewCommand.Designer.cs">
+      <DependentUpon>FormNewCommand.cs</DependentUpon>
+    </Compile>
     <Compile Include="Entity\SystemInf.cs" />
     <Compile Include="Main.cs">
       <SubType>Form</SubType>
@@ -108,6 +114,9 @@
     <EmbeddedResource Include="CustomerControl\PagingControl\PageControl.resx">
       <DependentUpon>PageControl.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Device\Command\FormNewCommand.resx">
+      <DependentUpon>FormNewCommand.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Main.resx">
       <DependentUpon>Main.cs</DependentUpon>
     </EmbeddedResource>
@@ -143,7 +152,6 @@
     <Content Include="Tool\Oracle.ManagedDataAccess.dll" />
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Device\Command\" />
     <Folder Include="Device\Information\" />
     <Folder Include="Device\Transfer\" />
   </ItemGroup>