From 578014f827b6871833cbfa6e781e05d1f9397995 Mon Sep 17 00:00:00 2001
From: wells.liu <wells.liu@broconcentric.com>
Date: 星期四, 02 七月 2020 14:57:07 +0800
Subject: [PATCH] 保存新配置

---
 src/Bro.Device.GTSCard/GTSCardDriver.cs                                      |    4 
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.Designer.cs |   42 +++++-----
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs          |   30 ++++++
 src/Bro.UI.Config/MenuForms/FrmConfig.cs                                     |   13 +++
 src/Bro.UI.Config/MenuForms/FrmConfig.resx                                   |    2 
 src/Bro.Common.Model/Helper/SettingHelper.cs                                 |   47 +++++++++--
 src/Bro.Process/ProcessControl.cs                                            |   25 ++++++
 src/Bro.UI.Device.Winform/Bro.UI.Device.Winform.csproj                       |   14 ++-
 src/Bro.UI.Config/Bro.UI.Config.csproj                                       |    1 
 src/Bro.UI.Config/MenuForms/FrmConfig.Designer.cs                            |   23 +++--
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.resx        |    0 
 11 files changed, 150 insertions(+), 51 deletions(-)

diff --git a/src/Bro.Common.Model/Helper/SettingHelper.cs b/src/Bro.Common.Model/Helper/SettingHelper.cs
index 8bfefd6..59ffa67 100644
--- a/src/Bro.Common.Model/Helper/SettingHelper.cs
+++ b/src/Bro.Common.Model/Helper/SettingHelper.cs
@@ -21,16 +21,13 @@
         {
             get
             {
-                if (data == null)
+                string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SETTINGFILE);
+                if (File.Exists(configPath))
                 {
-                    string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SETTINGFILE);
-                    if (File.Exists(configPath))
+                    using (StreamReader reader = new StreamReader(configPath, System.Text.Encoding.UTF8))
                     {
-                        using (StreamReader reader = new StreamReader(configPath, System.Text.Encoding.UTF8))
-                        {
-                            string dataStr = reader.ReadToEnd();
-                            data = JsonConvert.DeserializeObject<JObject>(dataStr);
-                        }
+                        string dataStr = reader.ReadToEnd();
+                        data = JsonConvert.DeserializeObject<JObject>(dataStr);
                     }
                 }
 
@@ -66,6 +63,28 @@
             return codes;
         }
 
+        public static List<string> AddNewProductionCode(string code)
+        {
+            List<string> codes = GetProcessCodes();
+            if (!codes.Contains(code))
+            {
+                codes.Add(code);
+            }
+            if (Data != null && Data.ContainsKey(PROPERTY_PRODUCTIONCODES))
+            {
+                Data[PROPERTY_PRODUCTIONCODES] = new JArray(codes);
+                string newDataStr = JsonConvert.SerializeObject(Data, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto });
+                using (StreamWriter writer = new StreamWriter(GetSettingFilePath(), false, System.Text.Encoding.UTF8))
+                {
+                    writer.Write(newDataStr);
+                    writer.Flush();
+                    writer.Close();
+                }
+            }
+
+            return GetProcessCodes();
+        }
+
         public static string GetConfigFilePath()
         {
             string path = "";
@@ -78,6 +97,18 @@
             return path;
         }
 
+        public static string GetSettingFilePath()
+        {
+            string path = "";
+
+            if (Data != null && Data.ContainsKey(SETTINGFILE))
+            {
+                path = Data.Value<string>(SETTINGFILE);
+            }
+
+            return path;
+        }
+
         public static string GetProgramDescription()
         {
             string desc = "浼偗妫嚜鍔ㄥ寲鎶�鏈湁闄愬叕鍙�";
diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs
index 58e27c7..5a562fe 100644
--- a/src/Bro.Device.GTSCard/GTSCardDriver.cs
+++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -735,8 +735,8 @@
                         sw.Start();
                         if (MonitorValues.Count == newValues.Count)
                         {
-                            var tempNew = new List<IOItem>(newValues);//clone
-                            var tempOld = new List<IOItem>(MonitorValues);
+                            var tempNew = newValues.DeepSerializeClone();//clone
+                            var tempOld = MonitorValues.DeepSerializeClone();
                             MonitorCheckAndInvoke(tempNew, tempOld);
                         }
                         MonitorValues = new List<IOItem>(newValues);
diff --git a/src/Bro.Process/ProcessControl.cs b/src/Bro.Process/ProcessControl.cs
index 35c3af7..ece460d 100644
--- a/src/Bro.Process/ProcessControl.cs
+++ b/src/Bro.Process/ProcessControl.cs
@@ -342,6 +342,31 @@
             }
         }
 
+        public void CreateNewConfig(IProcessConfig config, string newProductionCode)
+        {
+            try
+            {
+                if (config == null)
+                    throw new ProcessException("淇濆瓨鐨勯厤缃俊鎭笉鑳戒负绌�");
+                ProductionCode = newProductionCode;
+                //鐢熸垚config.json
+                string newConfig = JsonConvert.SerializeObject(config, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All });
+                using (StreamWriter writer = new StreamWriter(_configPath, false, System.Text.Encoding.UTF8))
+                {
+                    writer.Write(newConfig);
+                    writer.Flush();
+                    writer.Close();
+                }
+
+                //娣诲姞鍒癝etting.json
+                SettingHelper.AddNewProductionCode(ProductionCode);
+            }
+            catch (Exception ex)
+            {
+                throw new ProcessException(ex.Message, null);
+            }
+        }
+
         private void SaveBackupConfig()
         {
             string backPath = Path.GetDirectoryName(_configPath);
diff --git a/src/Bro.UI.Config/Bro.UI.Config.csproj b/src/Bro.UI.Config/Bro.UI.Config.csproj
index d465720..62a47fe 100644
--- a/src/Bro.UI.Config/Bro.UI.Config.csproj
+++ b/src/Bro.UI.Config/Bro.UI.Config.csproj
@@ -104,6 +104,7 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\libs\halcon12\halcondotnet.dll</HintPath>
     </Reference>
+    <Reference Include="Microsoft.VisualBasic" />
     <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
diff --git a/src/Bro.UI.Config/MenuForms/FrmConfig.Designer.cs b/src/Bro.UI.Config/MenuForms/FrmConfig.Designer.cs
index bb84267..433249a 100644
--- a/src/Bro.UI.Config/MenuForms/FrmConfig.Designer.cs
+++ b/src/Bro.UI.Config/MenuForms/FrmConfig.Designer.cs
@@ -34,7 +34,7 @@
             this.btnSave = new System.Windows.Forms.Button();
             this.imgList = new System.Windows.Forms.ImageList(this.components);
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
-            this.button1 = new System.Windows.Forms.Button();
+            this.buttonCreateConfig = new System.Windows.Forms.Button();
             this.tableLayoutPanel1.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -81,7 +81,7 @@
             this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
             this.tableLayoutPanel1.Controls.Add(this.propGrid, 0, 1);
             this.tableLayoutPanel1.Controls.Add(this.btnSave, 2, 0);
-            this.tableLayoutPanel1.Controls.Add(this.button1, 0, 0);
+            this.tableLayoutPanel1.Controls.Add(this.buttonCreateConfig, 0, 0);
             this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
             this.tableLayoutPanel1.Name = "tableLayoutPanel1";
@@ -91,15 +91,16 @@
             this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 487);
             this.tableLayoutPanel1.TabIndex = 2;
             // 
-            // button1
+            // buttonCreateConfig
             // 
-            this.button1.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button1.Location = new System.Drawing.Point(3, 3);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(175, 35);
-            this.button1.TabIndex = 2;
-            this.button1.Text = "浠庡綋鍓嶉厤缃淳鐢熸柊浜у搧";
-            this.button1.UseVisualStyleBackColor = true;
+            this.buttonCreateConfig.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.buttonCreateConfig.Location = new System.Drawing.Point(3, 3);
+            this.buttonCreateConfig.Name = "buttonCreateConfig";
+            this.buttonCreateConfig.Size = new System.Drawing.Size(175, 35);
+            this.buttonCreateConfig.TabIndex = 2;
+            this.buttonCreateConfig.Text = "浠庡綋鍓嶉厤缃淳鐢熸柊浜у搧";
+            this.buttonCreateConfig.UseVisualStyleBackColor = true;
+            this.buttonCreateConfig.Click += new System.EventHandler(this.buttonCreateConfig_Click);
             // 
             // FrmConfig
             // 
@@ -120,6 +121,6 @@
         private System.Windows.Forms.Button btnSave;
         private System.Windows.Forms.ImageList imgList;
         private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
-        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button buttonCreateConfig;
     }
 }
\ No newline at end of file
diff --git a/src/Bro.UI.Config/MenuForms/FrmConfig.cs b/src/Bro.UI.Config/MenuForms/FrmConfig.cs
index 82f3be1..a216390 100644
--- a/src/Bro.UI.Config/MenuForms/FrmConfig.cs
+++ b/src/Bro.UI.Config/MenuForms/FrmConfig.cs
@@ -1,6 +1,8 @@
 锘縰sing Bro.Common.Interface;
 using Bro.UI.Model.Winform;
 using System;
+using Microsoft.VisualBasic;
+using System.Windows.Forms;
 
 namespace Bro.UI.Config.MenuForms
 {
@@ -46,5 +48,16 @@
             Process.SaveProcessConfig(propGrid.SelectedObject as IProcessConfig);
             LogAsync(DateTime.Now, "閰嶇疆淇濆瓨瀹屾垚");
         }
+
+        private void buttonCreateConfig_Click(object sender, EventArgs e)
+        {
+            string pCode = Interaction.InputBox("璇疯緭鍏ヤ骇鍝佺紪鐮�", "浜у搧缂栫爜", "", 100, 100);
+            if (string.IsNullOrWhiteSpace(pCode))
+            {
+                MessageBox.Show("璇疯緭鍏ヤ骇鍝佺紪鐮侊紒");
+                return;
+            }
+
+        }
     }
 }
diff --git a/src/Bro.UI.Config/MenuForms/FrmConfig.resx b/src/Bro.UI.Config/MenuForms/FrmConfig.resx
index 0cdf229..b7854da 100644
--- a/src/Bro.UI.Config/MenuForms/FrmConfig.resx
+++ b/src/Bro.UI.Config/MenuForms/FrmConfig.resx
@@ -125,7 +125,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACY
-        CAAAAk1TRnQBSQFMAwEBAAEwAQABMAEAARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
+        CAAAAk1TRnQBSQFMAwEBAAE4AQABOAEAARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
         AWADAAEYAwABAQEAAQgGAAEJGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
         AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
         AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm
diff --git a/src/Bro.UI.Device.Winform/Bro.UI.Device.Winform.csproj b/src/Bro.UI.Device.Winform/Bro.UI.Device.Winform.csproj
index 0931e4a..8f76288 100644
--- a/src/Bro.UI.Device.Winform/Bro.UI.Device.Winform.csproj
+++ b/src/Bro.UI.Device.Winform/Bro.UI.Device.Winform.csproj
@@ -89,11 +89,11 @@
     <Compile Include="CtrlCameraRunBase.Designer.cs">
       <DependentUpon>CtrlCameraRunBase.cs</DependentUpon>
     </Compile>
-    <Compile Include="MotionCard\CtrlMotionCardOperation.cs">
+    <Compile Include="MotionCard\CtrlMotionCardOperationBase.cs">
       <SubType>UserControl</SubType>
     </Compile>
-    <Compile Include="MotionCard\CtrlMotionCardOperation.Designer.cs">
-      <DependentUpon>CtrlMotionCardOperation.cs</DependentUpon>
+    <Compile Include="MotionCard\CtrlMotionCardOperationBase.Designer.cs">
+      <DependentUpon>CtrlMotionCardOperationBase.cs</DependentUpon>
     </Compile>
     <Compile Include="CtrlPLCRunBase.cs">
       <SubType>UserControl</SubType>
@@ -118,8 +118,8 @@
     <EmbeddedResource Include="CtrlCameraRunBase.resx">
       <DependentUpon>CtrlCameraRunBase.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="MotionCard\CtrlMotionCardOperation.resx">
-      <DependentUpon>CtrlMotionCardOperation.cs</DependentUpon>
+    <EmbeddedResource Include="MotionCard\CtrlMotionCardOperationBase.resx">
+      <DependentUpon>CtrlMotionCardOperationBase.cs</DependentUpon>
     </EmbeddedResource>
     <EmbeddedResource Include="CtrlPLCRunBase.resx">
       <DependentUpon>CtrlPLCRunBase.cs</DependentUpon>
@@ -141,6 +141,10 @@
       <Project>{1A3CBFE7-3F78-42C3-95C5-10360450DBEA}</Project>
       <Name>Bro.Common.Model</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Bro.Device.GTSCard\Bro.Device.GTSCard.csproj">
+      <Project>{B536003E-70BA-4701-B8FD-BAFA303AB4E2}</Project>
+      <Name>Bro.Device.GTSCard</Name>
+    </ProjectReference>
     <ProjectReference Include="..\Bro.UI.Model.Winform\Bro.UI.Model.Winform.csproj">
       <Project>{741f6491-57c7-479a-b391-09bba9fba9dc}</Project>
       <Name>Bro.UI.Model.Winform</Name>
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.Designer.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.Designer.cs
similarity index 96%
rename from src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.Designer.cs
rename to src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.Designer.cs
index a7875c8..e61e4f4 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.Designer.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.Designer.cs
@@ -1,6 +1,6 @@
 锘縩amespace Bro.UI.Device.Winform
 {
-    partial class CtrlMotionCardOperation
+    partial class CtrlMotionCardOperationBase
     {
         /// <summary> 
         /// 蹇呴渶鐨勮璁″櫒鍙橀噺銆�
@@ -28,14 +28,14 @@
         /// </summary>
         private void InitializeComponent()
         {
-            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CtrlMotionCardOperation));
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CtrlMotionCardOperationBase));
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
             this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
             this.groupBox2 = new System.Windows.Forms.GroupBox();
             this.listBoxMsg = new System.Windows.Forms.ListBox();
             this.groupBoxPara = new System.Windows.Forms.GroupBox();
             this.propGrid = new System.Windows.Forms.PropertyGrid();
-            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.groupBoxMoveModel = new System.Windows.Forms.GroupBox();
             this.radioGoHome = new System.Windows.Forms.RadioButton();
             this.radioJog = new System.Windows.Forms.RadioButton();
             this.radioP2P = new System.Windows.Forms.RadioButton();
@@ -86,7 +86,7 @@
             this.tableLayoutPanel2.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBoxPara.SuspendLayout();
-            this.groupBox1.SuspendLayout();
+            this.groupBoxMoveModel.SuspendLayout();
             this.groupBoxCommBtn.SuspendLayout();
             this.tableLayoutPanel3.SuspendLayout();
             this.groupBox5.SuspendLayout();
@@ -114,7 +114,7 @@
             this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
             this.tableLayoutPanel2.Controls.Add(this.groupBox2, 0, 3);
             this.tableLayoutPanel2.Controls.Add(this.groupBoxPara, 0, 2);
-            this.tableLayoutPanel2.Controls.Add(this.groupBox1, 0, 1);
+            this.tableLayoutPanel2.Controls.Add(this.groupBoxMoveModel, 0, 1);
             this.tableLayoutPanel2.Controls.Add(this.groupBoxCommBtn, 0, 0);
             this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
@@ -169,18 +169,18 @@
             this.propGrid.Size = new System.Drawing.Size(374, 438);
             this.propGrid.TabIndex = 1;
             // 
-            // groupBox1
+            // groupBoxMoveModel
             // 
-            this.groupBox1.Controls.Add(this.radioGoHome);
-            this.groupBox1.Controls.Add(this.radioJog);
-            this.groupBox1.Controls.Add(this.radioP2P);
-            this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.groupBox1.Location = new System.Drawing.Point(3, 93);
-            this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(380, 44);
-            this.groupBox1.TabIndex = 5;
-            this.groupBox1.TabStop = false;
-            this.groupBox1.Text = "杩愬姩绫诲瀷";
+            this.groupBoxMoveModel.Controls.Add(this.radioGoHome);
+            this.groupBoxMoveModel.Controls.Add(this.radioJog);
+            this.groupBoxMoveModel.Controls.Add(this.radioP2P);
+            this.groupBoxMoveModel.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.groupBoxMoveModel.Location = new System.Drawing.Point(3, 93);
+            this.groupBoxMoveModel.Name = "groupBoxMoveModel";
+            this.groupBoxMoveModel.Size = new System.Drawing.Size(380, 44);
+            this.groupBoxMoveModel.TabIndex = 5;
+            this.groupBoxMoveModel.TabStop = false;
+            this.groupBoxMoveModel.Text = "杩愬姩绫诲瀷";
             // 
             // radioGoHome
             // 
@@ -666,19 +666,19 @@
             this.flowLayoutPanelRunStatus.Size = new System.Drawing.Size(578, 422);
             this.flowLayoutPanelRunStatus.TabIndex = 8;
             // 
-            // CtrlMotionCardRunBase
+            // CtrlMotionCardOperation
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.Controls.Add(this.tableLayoutPanel1);
-            this.Name = "CtrlMotionCardRunBase";
+            this.Name = "CtrlMotionCardOperation";
             this.Size = new System.Drawing.Size(982, 720);
             this.tableLayoutPanel1.ResumeLayout(false);
             this.tableLayoutPanel2.ResumeLayout(false);
             this.groupBox2.ResumeLayout(false);
             this.groupBoxPara.ResumeLayout(false);
-            this.groupBox1.ResumeLayout(false);
-            this.groupBox1.PerformLayout();
+            this.groupBoxMoveModel.ResumeLayout(false);
+            this.groupBoxMoveModel.PerformLayout();
             this.groupBoxCommBtn.ResumeLayout(false);
             this.groupBoxCommBtn.PerformLayout();
             this.tableLayoutPanel3.ResumeLayout(false);
@@ -694,7 +694,7 @@
         private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
         private System.Windows.Forms.GroupBox groupBoxCommBtn;
         private System.Windows.Forms.GroupBox groupBoxPara;
-        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.GroupBox groupBoxMoveModel;
         private System.Windows.Forms.Button buttonClearStatus;
         private System.Windows.Forms.Button buttonEmergencyStop;
         private System.Windows.Forms.Button buttonServoEnable;
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs
similarity index 64%
rename from src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.cs
rename to src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs
index 248d18f..2d90199 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs
@@ -1,5 +1,6 @@
 锘縰sing Bro.Common.Helper;
 using Bro.Common.Interface;
+using Bro.Device.GTSCard;
 using System;
 using System.Collections.Generic;
 using System.Data;
@@ -8,14 +9,23 @@
 
 namespace Bro.UI.Device.Winform
 {
-    public partial class CtrlMotionCardOperation : UserControl, IProcessObserver, ILogOutput
+    public partial class CtrlMotionCardOperationBase : UserControl, IRunCtrl
     {
-        public CtrlMotionCardOperation()
+        public CtrlMotionCardOperationBase()
         {
             InitializeComponent();
+            GTSCardOperationConfig = new GTSCardOperationConfig();
         }
 
-        List<string> _avaiableMethods { get; set; } = new List<string>();
+        public IDevice Device { get; set; }
+
+        //protected CameraBase Camera
+        //{
+        //    get => Device as CameraBase;
+        //}
+
+        GTSCardOperationConfig GTSCardOperationConfig = null;
+        MovingOption movingConfig = null;
 
         private IProcess process = null;
         public IProcess Process
@@ -63,7 +73,21 @@
 
         private void RadioButton_CheckedChanged(object sender, EventArgs e)
         {
+            //鍔犺浇瀵瑰簲杩愬姩鐨� movingConfig
+            if (radioP2P.Checked)
+            {
+                movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal);
+            }
+            else if (radioJog.Checked)
+            {
+                movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog);
+            }
+            else if (radioGoHome.Checked)
+            {
+                movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri);
+            }
 
+            propGrid.SelectedObject = movingConfig;
         }
 
         private void buttonClearStatus_Click(object sender, EventArgs e)
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.resx b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.resx
similarity index 100%
rename from src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.resx
rename to src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.resx

--
Gitblit v1.8.0