Browse Source

样品台编辑器修改编辑中的新建为另存

cxs 1 year ago
parent
commit
81699b6433

+ 1 - 1
Bin/x64/Debug/Resources/XMLData/AppResource_EN.xml

@@ -1102,7 +1102,7 @@
    <Name>DlgStageMgr</Name>
    <Name>DlgStageMgr</Name>
     <Controls>
     <Controls>
       <Control name="button_edit" text="Edit" />
       <Control name="button_edit" text="Edit" />
-      <Control name="button_New" text="New" />
+      <Control name="button_New" text="SaveAs" />
     </Controls>
     </Controls>
  </Form>
  </Form>
  <Form>
  <Form>

+ 1 - 1
Bin/x64/Debug/Resources/XMLData/AppResource_ZH.xml

@@ -958,7 +958,7 @@
    <Name>DlgStageMgr</Name>
    <Name>DlgStageMgr</Name>
     <Controls>
     <Controls>
       <Control name="button_edit" text="编辑" />
       <Control name="button_edit" text="编辑" />
-      <Control name="button_New" text="新建" />
+      <Control name="button_New" text="另存" />
     </Controls>
     </Controls>
  </Form>
  </Form>
   <!-- OTSIncAMeasureApp -->
   <!-- OTSIncAMeasureApp -->

+ 4 - 5
OTSIncAMeasureApp/7-OTSProgMgrInfo/Stage/DlgStageEdit.Designer.cs

@@ -107,6 +107,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             this.tStageName.Name = "tStageName";
             this.tStageName.Name = "tStageName";
             this.tStageName.Size = new System.Drawing.Size(444, 21);
             this.tStageName.Size = new System.Drawing.Size(444, 21);
             this.tStageName.TabIndex = 4;
             this.tStageName.TabIndex = 4;
+            this.tStageName.TextChanged += new System.EventHandler(this.tStageName_TextChanged);
             // 
             // 
             // label2
             // label2
             // 
             // 
@@ -492,7 +493,6 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             // 
             // 
             // button_Ok
             // button_Ok
             // 
             // 
-            this.button_Ok.Enabled = false;
             this.button_Ok.Location = new System.Drawing.Point(1065, 586);
             this.button_Ok.Location = new System.Drawing.Point(1065, 586);
             this.button_Ok.Margin = new System.Windows.Forms.Padding(2);
             this.button_Ok.Margin = new System.Windows.Forms.Padding(2);
             this.button_Ok.Name = "button_Ok";
             this.button_Ok.Name = "button_Ok";
@@ -539,13 +539,12 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             // 
             // 
             // btn_new
             // btn_new
             // 
             // 
-            this.btn_new.Enabled = false;
-            this.btn_new.Location = new System.Drawing.Point(1003, 586);
+            this.btn_new.Location = new System.Drawing.Point(985, 586);
             this.btn_new.Margin = new System.Windows.Forms.Padding(2);
             this.btn_new.Margin = new System.Windows.Forms.Padding(2);
             this.btn_new.Name = "btn_new";
             this.btn_new.Name = "btn_new";
-            this.btn_new.Size = new System.Drawing.Size(58, 30);
+            this.btn_new.Size = new System.Drawing.Size(76, 30);
             this.btn_new.TabIndex = 25;
             this.btn_new.TabIndex = 25;
-            this.btn_new.Text = "新建";
+            this.btn_new.Text = "另存";
             this.btn_new.UseVisualStyleBackColor = true;
             this.btn_new.UseVisualStyleBackColor = true;
             this.btn_new.Click += new System.EventHandler(this.btn_new_Click);
             this.btn_new.Click += new System.EventHandler(this.btn_new_Click);
             // 
             // 

+ 29 - 15
OTSIncAMeasureApp/7-OTSProgMgrInfo/Stage/DlgStageEdit.cs

@@ -70,10 +70,13 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             {
             {
                 LoadStageData(Stage);
                 LoadStageData(Stage);
             }
             }
+            else
+            {
+                btn_new.Visible = false;
+            }
             SetHelp();
             SetHelp();
 
 
             StageNames.Remove(tStageName.Text);
             StageNames.Remove(tStageName.Text);
-            StageN = tStageName.Text;
         }
         }
         void SetHelp()
         void SetHelp()
         {
         {
@@ -232,20 +235,20 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
 
 
         bool CheckAndSetStage()
         bool CheckAndSetStage()
         { 
         { 
-            if(StageNames.Contains(tStageName.Text))
+            if(StageNames.Contains(StageN))
             {
             {
                 MessageBox.Show("Already exist " + tStageName.Text.Trim() + "!", "Error");
                 MessageBox.Show("Already exist " + tStageName.Text.Trim() + "!", "Error");
                 return false;
                 return false;
             }
             }
             if (!CheckParams())
             if (!CheckParams())
             {
             {
-                this.button_Ok.Enabled = false;
+                //this.button_Ok.Enabled = false;
                 MessageBox.Show("Please check Params!");
                 MessageBox.Show("Please check Params!");
                 return false;
                 return false;
             }
             }
             if (tBoundaryWide.Text == "1" || tBoundaryHeight.Text == "1" || tStandardsampleWide.Text == "1" || tStandardsampleHeight.Text == "1")
             if (tBoundaryWide.Text == "1" || tBoundaryHeight.Text == "1" || tStandardsampleWide.Text == "1" || tStandardsampleHeight.Text == "1")
             {
             {
-                this.button_Ok.Enabled = false;
+                //this.button_Ok.Enabled = false;
                 MessageBox.Show("The length value cannot be 1!");
                 MessageBox.Show("The length value cannot be 1!");
                 return false;
                 return false;
             }
             }
@@ -255,7 +258,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
                 {
                 {
                     if (dataGridView_Holes.Rows[i].Cells[j].Value.ToString() == "1")
                     if (dataGridView_Holes.Rows[i].Cells[j].Value.ToString() == "1")
                     {
                     {
-                        this.button_Ok.Enabled = false;
+                        //this.button_Ok.Enabled = false;
                         MessageBox.Show("The length value cannot be 1!");
                         MessageBox.Show("The length value cannot be 1!");
                         return false;
                         return false;
                     }
                     }
@@ -268,7 +271,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             a_pCSEMStageData = m_DefaultParam.GetStageDataParam();
             a_pCSEMStageData = m_DefaultParam.GetStageDataParam();
 
 
             Stage = new CStage();
             Stage = new CStage();
-            Stage.SetName(tStageName.Text);
+            Stage.SetName(StageN);
             // boundary
             // boundary
             string strValue = "";
             string strValue = "";
             if(radioButton_BoundaryCircle.Checked)
             if(radioButton_BoundaryCircle.Checked)
@@ -685,17 +688,28 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
 
 
         private void btn_new_Click(object sender, EventArgs e)
         private void btn_new_Click(object sender, EventArgs e)
         {
         {
-            if(StageN.Trim()== tStageName.Text.Trim())
+            StageNameSaveAs stageNameSaveAs = new StageNameSaveAs();
+            DialogResult dialogResult = stageNameSaveAs.ShowDialog();
+            if (dialogResult == DialogResult.OK)
             {
             {
-                MessageBox.Show("Already exist " + tStageName.Text.Trim() + "!", "Error");
-                return;
-            }
-            if (!CheckAndSetStage())
-            {
-                return;
+                if (tStageName.Text == stageNameSaveAs.StageNamewhichSaveAs)
+                {
+                    MessageBox.Show("Already exist " + tStageName.Text.Trim() + "!", "Error");
+                    return;
+                }
+                StageN = stageNameSaveAs.StageNamewhichSaveAs;
+                if (!CheckAndSetStage())
+                {
+                    return;
+                }
+                this.DialogResult = DialogResult.No;
+                this.Close();
             }
             }
-            this.DialogResult = DialogResult.No;
-            this.Close();
+        }
+
+        private void tStageName_TextChanged(object sender, EventArgs e)
+        {
+            StageN = tStageName.Text;
         }
         }
     }
     }
 }
 }

+ 1 - 0
OTSIncAMeasureApp/7-OTSProgMgrInfo/Stage/DlgStageRename.Designer.cs

@@ -74,6 +74,7 @@
             this.MinimizeBox = false;
             this.MinimizeBox = false;
             this.MinimumSize = new System.Drawing.Size(457, 106);
             this.MinimumSize = new System.Drawing.Size(457, 106);
             this.Name = "DlgStageRename";
             this.Name = "DlgStageRename";
+            this.ShowIcon = false;
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "样品台重命名";
             this.Text = "样品台重命名";
             this.Load += new System.EventHandler(this.DlgStageRename_Load);
             this.Load += new System.EventHandler(this.DlgStageRename_Load);

+ 78 - 0
OTSIncAMeasureApp/7-OTSProgMgrInfo/Stage/StageNameSaveAs.Designer.cs

@@ -0,0 +1,78 @@
+
+namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
+{
+    partial class StageNameSaveAs
+    {
+        /// <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.textBox1 = new System.Windows.Forms.TextBox();
+            this.button1 = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(27, 12);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(210, 21);
+            this.textBox1.TabIndex = 0;
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(256, 12);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(60, 21);
+            this.button1.TabIndex = 1;
+            this.button1.Text = "OK";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // StageNameSaveAs
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+            this.ClientSize = new System.Drawing.Size(329, 43);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.textBox1);
+            this.MaximizeBox = false;
+            this.MinimizeBox = false;
+            this.Name = "StageNameSaveAs";
+            this.ShowIcon = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "请输入样品台名称(另存)";
+            this.Load += new System.EventHandler(this.StageNameSaveAs_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.Button button1;
+    }
+}

+ 37 - 0
OTSIncAMeasureApp/7-OTSProgMgrInfo/Stage/StageNameSaveAs.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
+{
+    public partial class StageNameSaveAs : Form
+    {
+        public StageNameSaveAs()
+        {
+            InitializeComponent();
+        }
+
+        private void StageNameSaveAs_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        public string StageNamewhichSaveAs
+        {
+            get;
+            set;
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            StageNamewhichSaveAs = textBox1.Text;
+            this.DialogResult = DialogResult.OK;
+        }
+    }
+}

+ 120 - 0
OTSIncAMeasureApp/7-OTSProgMgrInfo/Stage/StageNameSaveAs.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>

+ 9 - 0
OTSIncAMeasureApp/OTSIncAMeasureApp.csproj

@@ -423,6 +423,12 @@
       <DependentUpon>DlgStageRename.cs</DependentUpon>
       <DependentUpon>DlgStageRename.cs</DependentUpon>
     </Compile>
     </Compile>
     <Compile Include="7-OTSProgMgrInfo\Stage\StageDisplayHelp.cs" />
     <Compile Include="7-OTSProgMgrInfo\Stage\StageDisplayHelp.cs" />
+    <Compile Include="7-OTSProgMgrInfo\Stage\StageNameSaveAs.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="7-OTSProgMgrInfo\Stage\StageNameSaveAs.Designer.cs">
+      <DependentUpon>StageNameSaveAs.cs</DependentUpon>
+    </Compile>
     <Compile Include="CRegistration.cs" />
     <Compile Include="CRegistration.cs" />
     <Compile Include="BaseFunctionTest.cs">
     <Compile Include="BaseFunctionTest.cs">
       <SubType>Form</SubType>
       <SubType>Form</SubType>
@@ -648,6 +654,9 @@
     <EmbeddedResource Include="7-OTSProgMgrInfo\Stage\DlgStageRename.resx">
     <EmbeddedResource Include="7-OTSProgMgrInfo\Stage\DlgStageRename.resx">
       <DependentUpon>DlgStageRename.cs</DependentUpon>
       <DependentUpon>DlgStageRename.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>
+    <EmbeddedResource Include="7-OTSProgMgrInfo\Stage\StageNameSaveAs.resx">
+      <DependentUpon>StageNameSaveAs.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="About.resx">
     <EmbeddedResource Include="About.resx">
       <DependentUpon>About.cs</DependentUpon>
       <DependentUpon>About.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>