From 6ade04c8f6e703a2b9c0d79478a5068f5a0c6327 Mon Sep 17 00:00:00 2001 From: wells.liu <wells.liu@broconcentric.com> Date: 星期五, 10 七月 2020 12:55:23 +0800 Subject: [PATCH] 新产品 配置窗口 --- src/Bro.UI.Config/ProductionCodeEditForm.designer.cs | 105 +++++++++++++++++++++ src/Bro.UI.Config/MenuForms/FrmConfig.cs | 20 ++- src/Bro.UI.Config/ProductionCodeEditForm.resx | 120 ++++++++++++++++++++++++ src/Bro.UI.Config/ProductionCodeEditForm.cs | 30 ++++++ src/Bro.UI.Config/Bro.UI.Config.csproj | 9 + 5 files changed, 277 insertions(+), 7 deletions(-) diff --git a/src/Bro.UI.Config/Bro.UI.Config.csproj b/src/Bro.UI.Config/Bro.UI.Config.csproj index 62a47fe..9945d2e 100644 --- a/src/Bro.UI.Config/Bro.UI.Config.csproj +++ b/src/Bro.UI.Config/Bro.UI.Config.csproj @@ -132,6 +132,12 @@ </Reference> </ItemGroup> <ItemGroup> + <Compile Include="ProductionCodeEditForm.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="ProductionCodeEditForm.designer.cs"> + <DependentUpon>ProductionCodeEditForm.cs</DependentUpon> + </Compile> <Compile Include="AdvancedPwdFrm.cs"> <SubType>Form</SubType> </Compile> @@ -195,6 +201,9 @@ <Compile Include="MenuForms\ViewNode.cs" /> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <EmbeddedResource Include="ProductionCodeEditForm.resx"> + <DependentUpon>ProductionCodeEditForm.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="AdvancedPwdFrm.resx"> <DependentUpon>AdvancedPwdFrm.cs</DependentUpon> </EmbeddedResource> diff --git a/src/Bro.UI.Config/MenuForms/FrmConfig.cs b/src/Bro.UI.Config/MenuForms/FrmConfig.cs index b58f66c..053494c 100644 --- a/src/Bro.UI.Config/MenuForms/FrmConfig.cs +++ b/src/Bro.UI.Config/MenuForms/FrmConfig.cs @@ -53,15 +53,21 @@ private void buttonCreateConfig_Click(object sender, EventArgs e) { - string pCode = Interaction.InputBox("璇疯緭鍏ヤ骇鍝佺紪鐮�", "浜у搧缂栫爜", "", 0, 0); - if (string.IsNullOrWhiteSpace(pCode)) + ProductionCodeEditForm productionCodeEditForm = new ProductionCodeEditForm(); + if (productionCodeEditForm.ShowDialog(this) == DialogResult.OK) { - MessageBox.Show("璇疯緭鍏ヤ骇鍝佺紪鐮侊紒"); - return; + string pCode = productionCodeEditForm.PCode; + productionCodeEditForm.Dispose(); + if (string.IsNullOrWhiteSpace(pCode)) + { + MessageBox.Show("璇疯緭鍏ヤ骇鍝佺紪鐮侊紒"); + return; + } + Process.CreateNewConfig(propGrid.SelectedObject as IProcessConfig, pCode); + MessageBox.Show("鍒涘缓鏂伴厤缃畬鎴�"); + PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.UpdateProductionCodes.ToString(), null, null); + } - Process.CreateNewConfig(propGrid.SelectedObject as IProcessConfig, pCode); - MessageBox.Show("鍒涘缓鏂伴厤缃畬鎴�"); - PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.UpdateProductionCodes.ToString(), null, null); } } } diff --git a/src/Bro.UI.Config/ProductionCodeEditForm.cs b/src/Bro.UI.Config/ProductionCodeEditForm.cs new file mode 100644 index 0000000..5dc3030 --- /dev/null +++ b/src/Bro.UI.Config/ProductionCodeEditForm.cs @@ -0,0 +1,30 @@ +锘縰sing System; +using System.Configuration; +using System.Windows.Forms; + +namespace Bro.UI.Config +{ + public partial class ProductionCodeEditForm : Form + { + + public string PCode { get; set; } + + public ProductionCodeEditForm() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + this.Close(); + } + + private void button2_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.OK; + PCode = txtPCode.Text; + this.Close(); + } + } +} diff --git a/src/Bro.UI.Config/ProductionCodeEditForm.designer.cs b/src/Bro.UI.Config/ProductionCodeEditForm.designer.cs new file mode 100644 index 0000000..ff8ef84 --- /dev/null +++ b/src/Bro.UI.Config/ProductionCodeEditForm.designer.cs @@ -0,0 +1,105 @@ +锘縩amespace Bro.UI.Config +{ + partial class ProductionCodeEditForm + { + /// <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.txtPCode = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // txtPCode + // + this.txtPCode.Font = new System.Drawing.Font("瀹嬩綋", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtPCode.Location = new System.Drawing.Point(126, 28); + this.txtPCode.Name = "txtPCode"; + this.txtPCode.Size = new System.Drawing.Size(236, 23); + this.txtPCode.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("瀹嬩綋", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(9, 31); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(82, 14); + this.label1.TabIndex = 1; + this.label1.Text = "浜у搧缂栫爜锛�"; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnCancel.Location = new System.Drawing.Point(208, 63); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 2; + this.btnCancel.Text = "鍙栨秷"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.button1_Click); + // + // btnOK + // + this.btnOK.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnOK.Location = new System.Drawing.Point(289, 63); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 2; + this.btnOK.Text = "纭畾"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.button2_Click); + // + // ProductionCodeEditForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(388, 98); + this.ControlBox = false; + this.Controls.Add(this.btnOK); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.label1); + this.Controls.Add(this.txtPCode); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "ProductionCodeEditForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "浜у搧缂栫爜"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txtPCode; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnOK; + } +} \ No newline at end of file diff --git a/src/Bro.UI.Config/ProductionCodeEditForm.resx b/src/Bro.UI.Config/ProductionCodeEditForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/src/Bro.UI.Config/ProductionCodeEditForm.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> \ No newline at end of file -- Gitblit v1.8.0