ParamSetingDialog.cs 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065
  1. using PaintDotNet.Base.CommTool;
  2. using PaintDotNet.Base.SettingModel;
  3. using StageController;
  4. using StageController.M3H;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.IO;
  11. using System.IO.Ports;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading;
  15. using System.Threading.Tasks;
  16. using System.Windows.Forms;
  17. namespace PaintDotNet.Hardware
  18. {
  19. public delegate void SetHandler(LoadingStageModel loadingStageModel);
  20. public class ParamSetingDialog : PdnBaseForm, IStageEvent
  21. {
  22. public event SetHandler Setted;
  23. // int i = 1;
  24. LoadingStageModel loadingStageModel = null;
  25. List<LoadingStageModel.Item> lists = new List<LoadingStageModel.Item>();
  26. TableLayoutPanel table = new TableLayoutPanel();
  27. private int m_speedCheckedCnt = 0;
  28. //声明组件
  29. private System.Windows.Forms.GroupBox groupBox1;
  30. private System.Windows.Forms.GroupBox groupBox2;
  31. private System.Windows.Forms.GroupBox groupBox3;
  32. private System.Windows.Forms.GroupBox groupBox4;
  33. private System.Windows.Forms.GroupBox groupBox5;
  34. private System.Windows.Forms.Button btnClose;
  35. private System.Windows.Forms.Button btnSave;
  36. private System.Windows.Forms.GroupBox groupBox6;
  37. private System.Windows.Forms.TextBox tbxspeed;
  38. private System.Windows.Forms.Label label1;
  39. private System.Windows.Forms.Label label3;
  40. private System.Windows.Forms.TextBox tbzspeed;
  41. private System.Windows.Forms.Label label2;
  42. private System.Windows.Forms.TextBox tbyspeed;
  43. private System.Windows.Forms.Label label5;
  44. private System.Windows.Forms.Label label4;
  45. private System.Windows.Forms.TextBox tbtripx;
  46. private System.Windows.Forms.Label label8;
  47. private System.Windows.Forms.Label label9;
  48. private System.Windows.Forms.TextBox tbnav;
  49. private System.Windows.Forms.Label label6;
  50. private System.Windows.Forms.Label label7;
  51. private System.Windows.Forms.TextBox tbtripy;
  52. private System.Windows.Forms.Label label11;
  53. private System.Windows.Forms.Label label14;
  54. private System.Windows.Forms.TextBox tboecheck;
  55. private System.Windows.Forms.Label label13;
  56. private System.Windows.Forms.TextBox tbbps;
  57. private System.Windows.Forms.Label label12;
  58. private System.Windows.Forms.Button btnGetVersion;
  59. private System.Windows.Forms.Label lblVersion;
  60. private System.Windows.Forms.Label label15;
  61. private System.Windows.Forms.TextBox tbz;
  62. private System.Windows.Forms.Label label19;
  63. private System.Windows.Forms.TextBox tbxy;
  64. private System.Windows.Forms.Label label18;
  65. private System.Windows.Forms.Label label17;
  66. private System.Windows.Forms.Button btnadd;
  67. private System.Windows.Forms.Label label20;
  68. private System.Windows.Forms.ComboBox cmbPort;
  69. private DataGridView dgvSpeed;
  70. private DataGridViewCheckBoxColumn isShow;
  71. private DataGridViewTextBoxColumn name;
  72. private DataGridViewTextBoxColumn lSpeed;
  73. private DataGridViewTextBoxColumn zSpeed;
  74. private DataGridViewButtonColumn btnDel;
  75. private System.Windows.Forms.Panel panel1;
  76. private Form parentForm;
  77. private Label label10;
  78. private Label label16;
  79. private AxisController m_axisController;
  80. public ParamSetingDialog(Form form)
  81. {
  82. parentForm = form;
  83. InitializeComponent();
  84. InitializeLanguageText();
  85. loadingStageModel = Startup.instance.loadingStageModel;
  86. lists = loadingStageModel.items;
  87. int bpsvalue = this.loadingStageModel.BaseSetBps;
  88. string port = this.loadingStageModel.BaseSetPort;
  89. string oddevencheckvalue = this.loadingStageModel.BaseSetOddEvenCheck;
  90. string navvalue = this.loadingStageModel.TripNavWin;
  91. string tripxvalue = this.loadingStageModel.TripX;
  92. string tripyvalue = this.loadingStageModel.TripY;
  93. string stepxvalue = this.loadingStageModel.SteppingX;
  94. string stepyvalue = this.loadingStageModel.SteppingY;
  95. string stepzvalue = this.loadingStageModel.SteppingZ;
  96. //设备值存储
  97. this.tbbps.Text = bpsvalue.ToString();
  98. this.tboecheck.Text = oddevencheckvalue;
  99. //基础值存储
  100. this.tbtripx.Text = tripxvalue;
  101. this.tbtripy.Text = tripyvalue;
  102. this.tbnav.Text = navvalue;
  103. //cbport.Text
  104. this.tbxspeed.Text = stepxvalue;
  105. this.tbyspeed.Text = stepyvalue;
  106. this.tbzspeed.Text = stepzvalue;
  107. // 串口列表
  108. GetSerialLst();
  109. // 运行速度列表
  110. dgvSpeedLoad();
  111. }
  112. private void GetSerialLst()
  113. {
  114. //清除cmbPort显示
  115. cmbPort.SelectedIndex = -1;
  116. cmbPort.Items.Clear();
  117. //获取串口列表
  118. string[] serialLst = SerialPort.GetPortNames();
  119. if (serialLst.Length > 0)
  120. {
  121. //取串口列表进行排序
  122. Array.Sort(serialLst);
  123. //将串口列表输出到comboBox
  124. cmbPort.Items.AddRange(serialLst);
  125. cmbPort.SelectedIndex = 0;
  126. }
  127. }
  128. public const int WM_DEVICE_CHANGE = 0x219; //设备改变
  129. public const int DBT_DEVICEARRIVAL = 0x8000; //设备插入
  130. public const int DBT_DEVICE_REMOVE_COMPLETE = 0x8004; //设备移除
  131. //消息处理
  132. protected override void WndProc(ref Message m)
  133. {
  134. switch (m.Msg) //判断消息类型
  135. {
  136. case WM_DEVICE_CHANGE: //设备改变消息
  137. {
  138. GetSerialLst(); //设备改变时重新获取串口列表
  139. }
  140. break;
  141. }
  142. base.WndProc(ref m);
  143. }
  144. private void dgvSpeed_CellContentClick(object sender, DataGridViewCellEventArgs e)
  145. {
  146. // 修改显示是否选中
  147. if (dgvSpeed.Columns[e.ColumnIndex].Name == "isShow" && e.RowIndex >= 0)
  148. {
  149. bool selectValue = Convert.ToBoolean(dgvSpeed.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue);
  150. if (selectValue)
  151. {
  152. if (m_speedCheckedCnt < 9)
  153. {
  154. lists[e.RowIndex].SChecked = 1;
  155. m_speedCheckedCnt++;
  156. }
  157. else
  158. {
  159. dgvSpeedLoad();
  160. MessageBox.Show("最多选择9条记录");
  161. }
  162. }
  163. else
  164. {
  165. if (lists[e.RowIndex].SChecked == 1)
  166. {
  167. m_speedCheckedCnt--;
  168. }
  169. lists[e.RowIndex].SChecked = 0;
  170. if (m_speedCheckedCnt > 9)
  171. {
  172. MessageBox.Show(PdnResources.GetString("Menu.Selectupto9records.Text"));
  173. }
  174. }
  175. }
  176. //点击button按钮事件
  177. if (dgvSpeed.Columns[e.ColumnIndex].Name == "btnDel" && e.RowIndex >= 0)
  178. {
  179. DialogResult result = MessageBox.Show(PdnResources.GetString("Menu.suredeletit.Text") + "?", PdnResources.GetString("Menu.Tips.text"), MessageBoxButtons.OKCancel);
  180. if (result == DialogResult.OK)
  181. {
  182. lists.RemoveAt(e.RowIndex);
  183. //dgvSpeed.Rows.RemoveAt(e.RowIndex);
  184. dgvSpeedLoad();
  185. }
  186. }
  187. }
  188. /// <summary>
  189. /// 运行速度列表加载
  190. /// </summary>
  191. private void dgvSpeedLoad()
  192. {
  193. dgvSpeed.Columns[0].Width = 80;
  194. dgvSpeed.Columns[1].Width = 80;
  195. m_speedCheckedCnt = 0;
  196. this.dgvSpeed.Rows.Clear();
  197. foreach (LoadingStageModel.Item item in lists)
  198. {
  199. int index = this.dgvSpeed.Rows.Add();
  200. if (item.SChecked == 1)
  201. {
  202. this.dgvSpeed.Rows[index].Cells[0].Value = true;
  203. m_speedCheckedCnt++;
  204. }
  205. else
  206. {
  207. this.dgvSpeed.Rows[index].Cells[0].Value = false;
  208. }
  209. //string lspeed = ("00" + item.LSpeed);
  210. //lspeed = lspeed.Substring(lspeed.Length - 3);
  211. //string zspeed = ("00" + item.ZSpeed);
  212. //zspeed = zspeed.Substring(zspeed.Length - 3);
  213. this.dgvSpeed.Rows[index].Cells[1].Value = (index + 1).ToString();
  214. this.dgvSpeed.Rows[index].Cells[2].Value = item.LSpeed;
  215. this.dgvSpeed.Rows[index].Cells[3].Value = item.ZSpeed;
  216. }
  217. this.dgvSpeed.ClearSelection();
  218. this.dgvSpeed.CurrentCell = null;
  219. if (dgvSpeed.Rows.Count > 0)
  220. this.dgvSpeed.Rows[0].Selected = false;
  221. }
  222. private void InitializeLanguageText()
  223. {
  224. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  225. this.btnClose.Text = PdnResources.GetString("Menu.File.Close.Text");
  226. this.btnSave.Text = PdnResources.GetString("Menu.ensure.text");
  227. this.groupBox2.Text = PdnResources.GetString("Menu.Hardwantrol.Locatavtion.steppingaccuracy.text");
  228. this.label20.Text = PdnResources.GetString("Menu.unit.text") + ":" + PdnResources.GetString("Menu.Micron.text");
  229. this.groupBox3.Text = PdnResources.GetString("Menu.BasicSettings.text");
  230. this.label14.Text = PdnResources.GetString("Menu.Hardwantrol.Locatavtion.Paritycorrection.text") + ":";
  231. this.label13.Text = PdnResources.GetString("Menu.Baudrate.text") + ":";
  232. this.label12.Text = PdnResources.GetString("Menu.Deviceport.text") + ":";
  233. this.groupBox4.Text = PdnResources.GetString("Menu.model.text");
  234. this.btnGetVersion.Text = PdnResources.GetString("Menu.Hardwantrol.Locatavtion.Read.text");
  235. this.label15.Text = PdnResources.GetString("Menu.Hardwantrol.Locatavtion.Currentstagemodel.text") + ":";
  236. this.groupBox5.Text = PdnResources.GetString("Menu.Hardwantrol.Locatavtion.Speedsetting.text");
  237. this.isShow.HeaderText = PdnResources.GetString("Menu.display.text");
  238. this.lSpeed.HeaderText = PdnResources.GetString("Menu.Stage.text");
  239. this.zSpeed.HeaderText = PdnResources.GetString("Menu.Zaxis.text");
  240. this.name.HeaderText = PdnResources.GetString("Menu.name.text");
  241. this.btnDel.HeaderText = PdnResources.GetString("Menu.operation.text");
  242. this.btnDel.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  243. this.btnDel.ToolTipText = PdnResources.GetString("Menu.Edit.Delete.Text");
  244. this.btnadd.Text = PdnResources.GetString("Menu.Addto.text");
  245. this.label19.Text = PdnResources.GetString("Menu.Zaxis.text");
  246. this.label18.Text = PdnResources.GetString("Menu.Stage.text");
  247. this.label17.Text = PdnResources.GetString("Menu.Runningspeed.text") + ":";
  248. this.groupBox6.Text = PdnResources.GetString("Menu.Hardwantrol.Locatavtion.travel.text");
  249. this.label8.Text = PdnResources.GetString("Menu.Micron.text");
  250. this.label9.Text = PdnResources.GetString("Menu.Hardwantrol.Locatavtion.navigatewindow.text") + ":";
  251. this.label6.Text = PdnResources.GetString("Menu.Micron.text");
  252. this.label5.Text = PdnResources.GetString("Menu.Micron.text");
  253. this.Text = PdnResources.GetString("Menu.Hardwantrol.Locatavtion.Locationnavigationparamssettings.text");
  254. }
  255. /// <summary>
  256. /// Required method for Designer support - do not modify
  257. /// the contents of this method with the code editor.
  258. /// </summary>
  259. private void InitializeComponent()
  260. {
  261. this.groupBox1 = new System.Windows.Forms.GroupBox();
  262. this.btnClose = new System.Windows.Forms.Button();
  263. this.btnSave = new System.Windows.Forms.Button();
  264. this.groupBox2 = new System.Windows.Forms.GroupBox();
  265. this.label20 = new System.Windows.Forms.Label();
  266. this.label3 = new System.Windows.Forms.Label();
  267. this.tbzspeed = new System.Windows.Forms.TextBox();
  268. this.label2 = new System.Windows.Forms.Label();
  269. this.tbyspeed = new System.Windows.Forms.TextBox();
  270. this.label1 = new System.Windows.Forms.Label();
  271. this.tbxspeed = new System.Windows.Forms.TextBox();
  272. this.groupBox3 = new System.Windows.Forms.GroupBox();
  273. this.cmbPort = new System.Windows.Forms.ComboBox();
  274. this.label14 = new System.Windows.Forms.Label();
  275. this.tboecheck = new System.Windows.Forms.TextBox();
  276. this.label13 = new System.Windows.Forms.Label();
  277. this.tbbps = new System.Windows.Forms.TextBox();
  278. this.label12 = new System.Windows.Forms.Label();
  279. this.groupBox4 = new System.Windows.Forms.GroupBox();
  280. this.btnGetVersion = new System.Windows.Forms.Button();
  281. this.lblVersion = new System.Windows.Forms.Label();
  282. this.label15 = new System.Windows.Forms.Label();
  283. this.groupBox5 = new System.Windows.Forms.GroupBox();
  284. this.label16 = new System.Windows.Forms.Label();
  285. this.label10 = new System.Windows.Forms.Label();
  286. this.panel1 = new System.Windows.Forms.Panel();
  287. this.dgvSpeed = new System.Windows.Forms.DataGridView();
  288. this.isShow = new System.Windows.Forms.DataGridViewCheckBoxColumn();
  289. this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
  290. this.lSpeed = new System.Windows.Forms.DataGridViewTextBoxColumn();
  291. this.zSpeed = new System.Windows.Forms.DataGridViewTextBoxColumn();
  292. this.btnDel = new System.Windows.Forms.DataGridViewButtonColumn();
  293. this.btnadd = new System.Windows.Forms.Button();
  294. this.tbz = new System.Windows.Forms.TextBox();
  295. this.label19 = new System.Windows.Forms.Label();
  296. this.tbxy = new System.Windows.Forms.TextBox();
  297. this.label18 = new System.Windows.Forms.Label();
  298. this.label17 = new System.Windows.Forms.Label();
  299. this.groupBox6 = new System.Windows.Forms.GroupBox();
  300. this.label11 = new System.Windows.Forms.Label();
  301. this.label8 = new System.Windows.Forms.Label();
  302. this.label6 = new System.Windows.Forms.Label();
  303. this.label9 = new System.Windows.Forms.Label();
  304. this.label7 = new System.Windows.Forms.Label();
  305. this.tbnav = new System.Windows.Forms.TextBox();
  306. this.tbtripy = new System.Windows.Forms.TextBox();
  307. this.label5 = new System.Windows.Forms.Label();
  308. this.label4 = new System.Windows.Forms.Label();
  309. this.tbtripx = new System.Windows.Forms.TextBox();
  310. this.groupBox1.SuspendLayout();
  311. this.groupBox2.SuspendLayout();
  312. this.groupBox3.SuspendLayout();
  313. this.groupBox4.SuspendLayout();
  314. this.groupBox5.SuspendLayout();
  315. this.panel1.SuspendLayout();
  316. ((System.ComponentModel.ISupportInitialize)(this.dgvSpeed)).BeginInit();
  317. this.groupBox6.SuspendLayout();
  318. this.SuspendLayout();
  319. //
  320. // groupBox1
  321. //
  322. this.groupBox1.Controls.Add(this.btnClose);
  323. this.groupBox1.Controls.Add(this.btnSave);
  324. this.groupBox1.Location = new System.Drawing.Point(12, 3);
  325. this.groupBox1.Name = "groupBox1";
  326. this.groupBox1.Size = new System.Drawing.Size(625, 65);
  327. this.groupBox1.TabIndex = 1;
  328. this.groupBox1.TabStop = false;
  329. this.groupBox1.Text = "操作";
  330. //
  331. // btnClose
  332. //
  333. this.btnClose.Location = new System.Drawing.Point(526, 24);
  334. this.btnClose.Name = "btnClose";
  335. this.btnClose.Size = new System.Drawing.Size(75, 23);
  336. this.btnClose.TabIndex = 1;
  337. this.btnClose.Text = "关闭";
  338. this.btnClose.UseVisualStyleBackColor = true;
  339. this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
  340. //
  341. // btnSave
  342. //
  343. this.btnSave.Location = new System.Drawing.Point(434, 24);
  344. this.btnSave.Name = "btnSave";
  345. this.btnSave.Size = new System.Drawing.Size(75, 23);
  346. this.btnSave.TabIndex = 0;
  347. this.btnSave.Text = "确定";
  348. this.btnSave.UseVisualStyleBackColor = true;
  349. this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
  350. //
  351. // groupBox2
  352. //
  353. this.groupBox2.Controls.Add(this.label20);
  354. this.groupBox2.Controls.Add(this.label3);
  355. this.groupBox2.Controls.Add(this.tbzspeed);
  356. this.groupBox2.Controls.Add(this.label2);
  357. this.groupBox2.Controls.Add(this.tbyspeed);
  358. this.groupBox2.Controls.Add(this.label1);
  359. this.groupBox2.Controls.Add(this.tbxspeed);
  360. this.groupBox2.Location = new System.Drawing.Point(12, 74);
  361. this.groupBox2.Name = "groupBox2";
  362. this.groupBox2.Size = new System.Drawing.Size(237, 111);
  363. this.groupBox2.TabIndex = 2;
  364. this.groupBox2.TabStop = false;
  365. this.groupBox2.Text = "步进精度";
  366. //
  367. // label20
  368. //
  369. this.label20.Location = new System.Drawing.Point(126, 61);
  370. this.label20.Name = "label20";
  371. this.label20.Size = new System.Drawing.Size(96, 22);
  372. this.label20.TabIndex = 12;
  373. this.label20.Text = "单位:微米";
  374. //
  375. // label3
  376. //
  377. this.label3.AutoSize = true;
  378. this.label3.Location = new System.Drawing.Point(6, 61);
  379. this.label3.Name = "label3";
  380. this.label3.Size = new System.Drawing.Size(17, 12);
  381. this.label3.TabIndex = 5;
  382. this.label3.Text = "Z:";
  383. //
  384. // tbzspeed
  385. //
  386. this.tbzspeed.Location = new System.Drawing.Point(29, 58);
  387. this.tbzspeed.Name = "tbzspeed";
  388. this.tbzspeed.Size = new System.Drawing.Size(75, 21);
  389. this.tbzspeed.TabIndex = 4;
  390. this.tbzspeed.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckKeyPress);
  391. //
  392. // label2
  393. //
  394. this.label2.AutoSize = true;
  395. this.label2.Location = new System.Drawing.Point(124, 23);
  396. this.label2.Name = "label2";
  397. this.label2.Size = new System.Drawing.Size(17, 12);
  398. this.label2.TabIndex = 3;
  399. this.label2.Text = "Y:";
  400. //
  401. // tbyspeed
  402. //
  403. this.tbyspeed.Location = new System.Drawing.Point(147, 20);
  404. this.tbyspeed.Name = "tbyspeed";
  405. this.tbyspeed.Size = new System.Drawing.Size(75, 21);
  406. this.tbyspeed.TabIndex = 2;
  407. this.tbyspeed.Text = "0.762";
  408. this.tbyspeed.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckKeyPress);
  409. //
  410. // label1
  411. //
  412. this.label1.AutoSize = true;
  413. this.label1.Location = new System.Drawing.Point(6, 23);
  414. this.label1.Name = "label1";
  415. this.label1.Size = new System.Drawing.Size(17, 12);
  416. this.label1.TabIndex = 1;
  417. this.label1.Text = "X:";
  418. //
  419. // tbxspeed
  420. //
  421. this.tbxspeed.Location = new System.Drawing.Point(29, 20);
  422. this.tbxspeed.Name = "tbxspeed";
  423. this.tbxspeed.Size = new System.Drawing.Size(75, 21);
  424. this.tbxspeed.TabIndex = 0;
  425. this.tbxspeed.Text = "0.762";
  426. this.tbxspeed.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckKeyPress);
  427. //
  428. // groupBox3
  429. //
  430. this.groupBox3.Controls.Add(this.cmbPort);
  431. this.groupBox3.Controls.Add(this.label14);
  432. this.groupBox3.Controls.Add(this.tboecheck);
  433. this.groupBox3.Controls.Add(this.label13);
  434. this.groupBox3.Controls.Add(this.tbbps);
  435. this.groupBox3.Controls.Add(this.label12);
  436. this.groupBox3.Location = new System.Drawing.Point(12, 191);
  437. this.groupBox3.Name = "groupBox3";
  438. this.groupBox3.Size = new System.Drawing.Size(625, 76);
  439. this.groupBox3.TabIndex = 3;
  440. this.groupBox3.TabStop = false;
  441. this.groupBox3.Text = "基础设置";
  442. //
  443. // cmbPort
  444. //
  445. this.cmbPort.FormattingEnabled = true;
  446. this.cmbPort.Location = new System.Drawing.Point(85, 31);
  447. this.cmbPort.Name = "cmbPort";
  448. this.cmbPort.Size = new System.Drawing.Size(81, 20);
  449. this.cmbPort.TabIndex = 12;
  450. //
  451. // label14
  452. //
  453. this.label14.Location = new System.Drawing.Point(389, 34);
  454. this.label14.Name = "label14";
  455. this.label14.Size = new System.Drawing.Size(103, 20);
  456. this.label14.TabIndex = 11;
  457. this.label14.Visible = false;
  458. //
  459. // tboecheck
  460. //
  461. this.tboecheck.Location = new System.Drawing.Point(498, 31);
  462. this.tboecheck.Name = "tboecheck";
  463. this.tboecheck.Size = new System.Drawing.Size(103, 21);
  464. this.tboecheck.TabIndex = 10;
  465. this.tboecheck.Visible = false;
  466. //
  467. // label13
  468. //
  469. this.label13.Location = new System.Drawing.Point(221, 34);
  470. this.label13.Name = "label13";
  471. this.label13.Size = new System.Drawing.Size(62, 18);
  472. this.label13.TabIndex = 9;
  473. this.label13.Text = "波特率:";
  474. //
  475. // tbbps
  476. //
  477. this.tbbps.Location = new System.Drawing.Point(289, 31);
  478. this.tbbps.Name = "tbbps";
  479. this.tbbps.Size = new System.Drawing.Size(75, 21);
  480. this.tbbps.TabIndex = 8;
  481. this.tbbps.Text = "9600";
  482. this.tbbps.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbbps_KeyPress);
  483. //
  484. // label12
  485. //
  486. this.label12.Location = new System.Drawing.Point(6, 34);
  487. this.label12.Name = "label12";
  488. this.label12.Size = new System.Drawing.Size(78, 24);
  489. this.label12.TabIndex = 7;
  490. this.label12.Text = "设备端口:";
  491. //
  492. // groupBox4
  493. //
  494. this.groupBox4.Controls.Add(this.btnGetVersion);
  495. this.groupBox4.Controls.Add(this.lblVersion);
  496. this.groupBox4.Controls.Add(this.label15);
  497. this.groupBox4.Location = new System.Drawing.Point(12, 273);
  498. this.groupBox4.Name = "groupBox4";
  499. this.groupBox4.Size = new System.Drawing.Size(625, 65);
  500. this.groupBox4.TabIndex = 4;
  501. this.groupBox4.TabStop = false;
  502. this.groupBox4.Text = "型号";
  503. //
  504. // btnGetVersion
  505. //
  506. this.btnGetVersion.Location = new System.Drawing.Point(532, 24);
  507. this.btnGetVersion.Name = "btnGetVersion";
  508. this.btnGetVersion.Size = new System.Drawing.Size(75, 23);
  509. this.btnGetVersion.TabIndex = 10;
  510. this.btnGetVersion.Text = "读取";
  511. this.btnGetVersion.UseVisualStyleBackColor = true;
  512. this.btnGetVersion.Click += new System.EventHandler(this.btnGetVersion_Click);
  513. //
  514. // lblVersion
  515. //
  516. this.lblVersion.Location = new System.Drawing.Point(136, 28);
  517. this.lblVersion.Name = "lblVersion";
  518. this.lblVersion.Size = new System.Drawing.Size(98, 19);
  519. this.lblVersion.TabIndex = 9;
  520. this.lblVersion.Text = "XXX";
  521. //
  522. // label15
  523. //
  524. this.label15.Location = new System.Drawing.Point(6, 28);
  525. this.label15.Name = "label15";
  526. this.label15.Size = new System.Drawing.Size(133, 19);
  527. this.label15.TabIndex = 8;
  528. this.label15.Text = "当前载物台型号:";
  529. //
  530. // groupBox5
  531. //
  532. this.groupBox5.Controls.Add(this.label16);
  533. this.groupBox5.Controls.Add(this.label10);
  534. this.groupBox5.Controls.Add(this.panel1);
  535. this.groupBox5.Controls.Add(this.btnadd);
  536. this.groupBox5.Controls.Add(this.tbz);
  537. this.groupBox5.Controls.Add(this.label19);
  538. this.groupBox5.Controls.Add(this.tbxy);
  539. this.groupBox5.Controls.Add(this.label18);
  540. this.groupBox5.Controls.Add(this.label17);
  541. this.groupBox5.Location = new System.Drawing.Point(12, 344);
  542. this.groupBox5.Name = "groupBox5";
  543. this.groupBox5.Size = new System.Drawing.Size(625, 361);
  544. this.groupBox5.TabIndex = 5;
  545. this.groupBox5.TabStop = false;
  546. //
  547. // label16
  548. //
  549. this.label16.AutoSize = true;
  550. this.label16.Location = new System.Drawing.Point(419, 33);
  551. this.label16.Name = "label16";
  552. this.label16.Size = new System.Drawing.Size(29, 12);
  553. this.label16.TabIndex = 18;
  554. this.label16.Text = "um/s";
  555. //
  556. // label10
  557. //
  558. this.label10.AutoSize = true;
  559. this.label10.Location = new System.Drawing.Point(386, 33);
  560. this.label10.Name = "label10";
  561. this.label10.Size = new System.Drawing.Size(35, 12);
  562. this.label10.TabIndex = 17;
  563. this.label10.Text = "Unit:";
  564. //
  565. // panel1
  566. //
  567. this.panel1.AutoScroll = true;
  568. this.panel1.Controls.Add(this.dgvSpeed);
  569. this.panel1.Location = new System.Drawing.Point(9, 62);
  570. this.panel1.Name = "panel1";
  571. this.panel1.Size = new System.Drawing.Size(610, 294);
  572. this.panel1.TabIndex = 16;
  573. //
  574. // dgvSpeed
  575. //
  576. this.dgvSpeed.AllowUserToAddRows = false;
  577. this.dgvSpeed.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  578. this.dgvSpeed.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  579. this.dgvSpeed.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  580. this.isShow,
  581. this.name,
  582. this.lSpeed,
  583. this.zSpeed,
  584. this.btnDel});
  585. this.dgvSpeed.Location = new System.Drawing.Point(4, 3);
  586. this.dgvSpeed.Name = "dgvSpeed";
  587. this.dgvSpeed.RowHeadersVisible = false;
  588. this.dgvSpeed.RowHeadersWidth = 51;
  589. this.dgvSpeed.RowTemplate.Height = 27;
  590. this.dgvSpeed.Size = new System.Drawing.Size(594, 282);
  591. this.dgvSpeed.TabIndex = 0;
  592. this.dgvSpeed.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSpeed_CellContentClick);
  593. //
  594. // isShow
  595. //
  596. this.isShow.MinimumWidth = 6;
  597. this.isShow.Name = "isShow";
  598. this.isShow.Resizable = System.Windows.Forms.DataGridViewTriState.True;
  599. this.isShow.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
  600. //
  601. // name
  602. //
  603. this.name.MinimumWidth = 6;
  604. this.name.Name = "name";
  605. this.name.ReadOnly = true;
  606. //
  607. // lSpeed
  608. //
  609. this.lSpeed.MinimumWidth = 6;
  610. this.lSpeed.Name = "lSpeed";
  611. this.lSpeed.ReadOnly = true;
  612. //
  613. // zSpeed
  614. //
  615. this.zSpeed.MinimumWidth = 6;
  616. this.zSpeed.Name = "zSpeed";
  617. this.zSpeed.ReadOnly = true;
  618. //
  619. // btnDel
  620. //
  621. this.btnDel.MinimumWidth = 6;
  622. this.btnDel.Name = "btnDel";
  623. this.btnDel.Resizable = System.Windows.Forms.DataGridViewTriState.True;
  624. this.btnDel.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
  625. //
  626. // btnadd
  627. //
  628. this.btnadd.Location = new System.Drawing.Point(531, 32);
  629. this.btnadd.Name = "btnadd";
  630. this.btnadd.Size = new System.Drawing.Size(75, 23);
  631. this.btnadd.TabIndex = 14;
  632. this.btnadd.Text = "添加";
  633. this.btnadd.UseVisualStyleBackColor = true;
  634. this.btnadd.Click += new System.EventHandler(this.btnadd_Click);
  635. //
  636. // tbz
  637. //
  638. this.tbz.Location = new System.Drawing.Point(279, 30);
  639. this.tbz.MaxLength = 3;
  640. this.tbz.Name = "tbz";
  641. this.tbz.Size = new System.Drawing.Size(80, 21);
  642. this.tbz.TabIndex = 13;
  643. this.tbz.Text = "100";
  644. this.tbz.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbz_KeyPress);
  645. //
  646. // label19
  647. //
  648. this.label19.Location = new System.Drawing.Point(246, 33);
  649. this.label19.Name = "label19";
  650. this.label19.Size = new System.Drawing.Size(36, 19);
  651. this.label19.TabIndex = 12;
  652. this.label19.Text = "Z轴";
  653. //
  654. // tbxy
  655. //
  656. this.tbxy.Location = new System.Drawing.Point(134, 30);
  657. this.tbxy.MaxLength = 3;
  658. this.tbxy.Name = "tbxy";
  659. this.tbxy.Size = new System.Drawing.Size(88, 21);
  660. this.tbxy.TabIndex = 11;
  661. this.tbxy.Text = "100";
  662. this.tbxy.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbxy_KeyPress);
  663. //
  664. // label18
  665. //
  666. this.label18.Location = new System.Drawing.Point(74, 33);
  667. this.label18.Name = "label18";
  668. this.label18.Size = new System.Drawing.Size(65, 19);
  669. this.label18.TabIndex = 10;
  670. this.label18.Text = "载物台";
  671. //
  672. // label17
  673. //
  674. this.label17.Location = new System.Drawing.Point(6, 33);
  675. this.label17.Name = "label17";
  676. this.label17.Size = new System.Drawing.Size(62, 19);
  677. this.label17.TabIndex = 9;
  678. this.label17.Text = "运行速度:";
  679. //
  680. // groupBox6
  681. //
  682. this.groupBox6.Controls.Add(this.label11);
  683. this.groupBox6.Controls.Add(this.label8);
  684. this.groupBox6.Controls.Add(this.label6);
  685. this.groupBox6.Controls.Add(this.label9);
  686. this.groupBox6.Controls.Add(this.label7);
  687. this.groupBox6.Controls.Add(this.tbnav);
  688. this.groupBox6.Controls.Add(this.tbtripy);
  689. this.groupBox6.Controls.Add(this.label5);
  690. this.groupBox6.Controls.Add(this.label4);
  691. this.groupBox6.Controls.Add(this.tbtripx);
  692. this.groupBox6.Location = new System.Drawing.Point(255, 74);
  693. this.groupBox6.Name = "groupBox6";
  694. this.groupBox6.Size = new System.Drawing.Size(382, 111);
  695. this.groupBox6.TabIndex = 3;
  696. this.groupBox6.TabStop = false;
  697. this.groupBox6.Text = "行程";
  698. //
  699. // label11
  700. //
  701. this.label11.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  702. this.label11.Location = new System.Drawing.Point(143, 20);
  703. this.label11.Name = "label11";
  704. this.label11.Size = new System.Drawing.Size(2, 81);
  705. this.label11.TabIndex = 18;
  706. //
  707. // label8
  708. //
  709. this.label8.AutoSize = true;
  710. this.label8.Location = new System.Drawing.Point(331, 79);
  711. this.label8.Name = "label8";
  712. this.label8.Size = new System.Drawing.Size(0, 12);
  713. this.label8.TabIndex = 12;
  714. this.label8.Visible = false;
  715. //
  716. // label6
  717. //
  718. this.label6.AutoSize = true;
  719. this.label6.Location = new System.Drawing.Point(108, 61);
  720. this.label6.Name = "label6";
  721. this.label6.Size = new System.Drawing.Size(29, 12);
  722. this.label6.TabIndex = 9;
  723. this.label6.Text = "微米";
  724. //
  725. // label9
  726. //
  727. this.label9.Location = new System.Drawing.Point(162, 79);
  728. this.label9.Name = "label9";
  729. this.label9.Size = new System.Drawing.Size(86, 22);
  730. this.label9.TabIndex = 11;
  731. this.label9.Visible = false;
  732. //
  733. // label7
  734. //
  735. this.label7.AutoSize = true;
  736. this.label7.Location = new System.Drawing.Point(4, 61);
  737. this.label7.Name = "label7";
  738. this.label7.Size = new System.Drawing.Size(17, 12);
  739. this.label7.TabIndex = 8;
  740. this.label7.Text = "Y:";
  741. //
  742. // tbnav
  743. //
  744. this.tbnav.Location = new System.Drawing.Point(250, 76);
  745. this.tbnav.Name = "tbnav";
  746. this.tbnav.Size = new System.Drawing.Size(75, 21);
  747. this.tbnav.TabIndex = 10;
  748. this.tbnav.Visible = false;
  749. this.tbnav.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckKeyPress);
  750. //
  751. // tbtripy
  752. //
  753. this.tbtripy.Location = new System.Drawing.Point(27, 58);
  754. this.tbtripy.Name = "tbtripy";
  755. this.tbtripy.Size = new System.Drawing.Size(75, 21);
  756. this.tbtripy.TabIndex = 7;
  757. this.tbtripy.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckKeyPress);
  758. //
  759. // label5
  760. //
  761. this.label5.AutoSize = true;
  762. this.label5.Location = new System.Drawing.Point(108, 23);
  763. this.label5.Name = "label5";
  764. this.label5.Size = new System.Drawing.Size(29, 12);
  765. this.label5.TabIndex = 6;
  766. this.label5.Text = "微米";
  767. //
  768. // label4
  769. //
  770. this.label4.AutoSize = true;
  771. this.label4.Location = new System.Drawing.Point(4, 23);
  772. this.label4.Name = "label4";
  773. this.label4.Size = new System.Drawing.Size(17, 12);
  774. this.label4.TabIndex = 5;
  775. this.label4.Text = "X:";
  776. //
  777. // tbtripx
  778. //
  779. this.tbtripx.Location = new System.Drawing.Point(27, 20);
  780. this.tbtripx.Name = "tbtripx";
  781. this.tbtripx.Size = new System.Drawing.Size(75, 21);
  782. this.tbtripx.TabIndex = 4;
  783. this.tbtripx.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckKeyPress);
  784. //
  785. // ParamSetingDialog
  786. //
  787. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
  788. this.ClientSize = new System.Drawing.Size(653, 711);
  789. this.Controls.Add(this.groupBox6);
  790. this.Controls.Add(this.groupBox5);
  791. this.Controls.Add(this.groupBox4);
  792. this.Controls.Add(this.groupBox3);
  793. this.Controls.Add(this.groupBox2);
  794. this.Controls.Add(this.groupBox1);
  795. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  796. this.Location = new System.Drawing.Point(0, 0);
  797. this.MaximizeBox = false;
  798. this.MinimizeBox = false;
  799. this.Name = "ParamSetingDialog";
  800. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  801. this.Text = "位置导航参数设置";
  802. this.Load += new System.EventHandler(this.ParamSetingDialog_Load);
  803. this.Controls.SetChildIndex(this.groupBox1, 0);
  804. this.Controls.SetChildIndex(this.groupBox2, 0);
  805. this.Controls.SetChildIndex(this.groupBox3, 0);
  806. this.Controls.SetChildIndex(this.groupBox4, 0);
  807. this.Controls.SetChildIndex(this.groupBox5, 0);
  808. this.Controls.SetChildIndex(this.groupBox6, 0);
  809. this.groupBox1.ResumeLayout(false);
  810. this.groupBox2.ResumeLayout(false);
  811. this.groupBox2.PerformLayout();
  812. this.groupBox3.ResumeLayout(false);
  813. this.groupBox3.PerformLayout();
  814. this.groupBox4.ResumeLayout(false);
  815. this.groupBox5.ResumeLayout(false);
  816. this.groupBox5.PerformLayout();
  817. this.panel1.ResumeLayout(false);
  818. ((System.ComponentModel.ISupportInitialize)(this.dgvSpeed)).EndInit();
  819. this.groupBox6.ResumeLayout(false);
  820. this.groupBox6.PerformLayout();
  821. this.ResumeLayout(false);
  822. }
  823. //参数设置点击了确定按钮
  824. private void btnSave_Click(object sender, EventArgs e)
  825. {
  826. //取得界面中输入的值
  827. string bpsvalue = this.tbbps.Text.Trim();
  828. string navvalue = this.tbnav.Text.Trim();
  829. string tripxvalue = this.tbtripx.Text.Trim();
  830. string tripyvalue = this.tbtripy.Text.Trim();
  831. string port = this.cmbPort.Text.Trim();
  832. string oddevencheckvalue = this.tboecheck.Text.Trim();
  833. string stepxvalue = this.tbxspeed.Text.Trim();
  834. string stepyvalue = this.tbyspeed.Text.Trim();
  835. string stepzvalue = this.tbzspeed.Text.Trim();
  836. if (string.IsNullOrEmpty(stepxvalue) || string.IsNullOrEmpty(stepyvalue) || string.IsNullOrEmpty(stepzvalue))
  837. {
  838. MessageBox.Show(PdnResources.GetString("Menu.Stepaccuracyannotbeempty.Text"));
  839. return;
  840. }
  841. if (string.IsNullOrEmpty(tripxvalue) || string.IsNullOrEmpty(tripyvalue))
  842. {
  843. MessageBox.Show(PdnResources.GetString("Menu.Theitinerarycannotbeempty.Text"));
  844. return;
  845. }
  846. if (string.IsNullOrEmpty(navvalue))
  847. {
  848. MessageBox.Show(PdnResources.GetString("Menu.henavigationwindowcannotbeempty.Text"));
  849. return;
  850. }
  851. if (string.IsNullOrEmpty(port))
  852. {
  853. MessageBox.Show(PdnResources.GetString("Menu.Thedeviceportannotbeempty.Text"));
  854. return;
  855. }
  856. if (string.IsNullOrEmpty(bpsvalue))
  857. {
  858. MessageBox.Show(PdnResources.GetString("Menu.Baudrempty.text"));
  859. return;
  860. }
  861. //设备值存储
  862. this.loadingStageModel.BaseSetPort = port;
  863. this.loadingStageModel.BaseSetBps = int.Parse(bpsvalue);
  864. this.loadingStageModel.BaseSetOddEvenCheck = oddevencheckvalue;
  865. //基础值存储
  866. this.loadingStageModel.TripX = tripxvalue;
  867. this.loadingStageModel.TripY = tripyvalue;
  868. this.loadingStageModel.TripNavWin = navvalue;
  869. this.loadingStageModel.SteppingX = stepxvalue;
  870. this.loadingStageModel.SteppingY = stepyvalue;
  871. this.loadingStageModel.SteppingZ = stepzvalue;
  872. string stageModelXml = XmlSerializeHelper.XmlSerialize<LoadingStageModel>(loadingStageModel);
  873. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\LoadingStage.xml";
  874. if (FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create))
  875. {
  876. if (Setted != null)
  877. {
  878. Setted(loadingStageModel);
  879. }
  880. //((LocationNavigationDialog)parentForm).ReloadingStageModel(loadingStageModel);
  881. MessageBox.Show(PdnResources.GetString("Menu.Thestagsuccessfully.text"));
  882. this.Close();
  883. }
  884. else
  885. {
  886. MessageBox.Show(PdnResources.GetString("Menu.Failedtosaveplatforminformation.Text"));
  887. }
  888. m_axisController.LoadingStageModel = loadingStageModel;
  889. }
  890. //关闭按钮点击
  891. private void btnClose_Click(object sender, EventArgs e)
  892. {
  893. this.Close();
  894. }
  895. //点击添加按钮
  896. private void btnadd_Click(object sender, EventArgs e)
  897. {
  898. loadingStageModel.items = lists;
  899. string xyvalue = this.tbxy.Text;
  900. string zvalue = this.tbz.Text;
  901. LoadingStageModel.Item it = new LoadingStageModel.Item();
  902. it.SChecked = 0;
  903. it.LSpeed = Int32.Parse(xyvalue);
  904. it.ZSpeed = Int32.Parse(zvalue);
  905. lists.Add(it);
  906. int index = this.dgvSpeed.Rows.Add();//获取新的一行
  907. string lspeed = ("00" + it.LSpeed);
  908. lspeed = lspeed.Substring(lspeed.Length - 3);
  909. string zspeed = ("00" + it.ZSpeed);
  910. zspeed = zspeed.Substring(zspeed.Length - 3);
  911. this.dgvSpeed.Rows[index].Cells[1].Value = (index + 1).ToString();
  912. this.dgvSpeed.Rows[index].Cells[2].Value = lspeed;
  913. this.dgvSpeed.Rows[index].Cells[3].Value = zspeed;
  914. }
  915. private void tbxy_KeyPress(object sender, KeyPressEventArgs e)
  916. {
  917. if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
  918. {
  919. e.Handled = true;
  920. return;
  921. }
  922. }
  923. private void tbz_KeyPress(object sender, KeyPressEventArgs e)
  924. {
  925. if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
  926. {
  927. e.Handled = true;
  928. return;
  929. }
  930. }
  931. private void tbbps_KeyPress(object sender, KeyPressEventArgs e)
  932. {
  933. if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
  934. {
  935. e.Handled = true;
  936. return;
  937. }
  938. }
  939. private void CheckKeyPress(object sender, KeyPressEventArgs e)
  940. {
  941. TextBox textBox = (TextBox)sender;
  942. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 && (int)e.KeyChar != 46)
  943. e.Handled = true;
  944. //小数点的处理。
  945. if ((int)e.KeyChar == 46) //小数点
  946. {
  947. if (textBox.Text.Length <= 0)
  948. e.Handled = true; //小数点不能在第一位
  949. else
  950. {
  951. float f, oldf;
  952. var b1 = float.TryParse(textBox.Text, out oldf);
  953. var b2 = float.TryParse(textBox.Text + e.KeyChar.ToString(), out f);
  954. if (b2 == false)
  955. {
  956. if (b1 == true)
  957. e.Handled = true;
  958. else
  959. e.Handled = false;
  960. }
  961. }
  962. }
  963. }
  964. private void btnGetVersion_Click(object sender, EventArgs e)
  965. {
  966. try
  967. {
  968. string m_portName = this.cmbPort.Text.Trim();
  969. int m_baudRate = int.Parse(this.tbbps.Text.Trim());
  970. m_axisController = AxisController.GetInstance();
  971. m_axisController.Open(m_portName, m_baudRate, Parity.None, 8, StopBits.One);
  972. new Task(() =>
  973. {
  974. Thread.Sleep(300);
  975. this.Invoke(new Action(() =>
  976. {
  977. lblVersion.Text = m_axisController.Version;
  978. }));
  979. }).Start();
  980. }
  981. catch (Exception ex)
  982. {
  983. // 串口无法打开时,打开参数设置界面
  984. MessageBox.Show(ex.Message);
  985. }
  986. }
  987. public void OnUpdatePosition()
  988. {
  989. // throw new NotImplementedException();
  990. }
  991. public void OnTimeoutConnect()
  992. {
  993. MessageBox.Show(PdnResources.GetString("Menu.Theconsoleresponsetimeout.Text"));
  994. }
  995. public void OnErrorSend()
  996. {
  997. MessageBox.Show(PdnResources.GetString("Menu.Replydataarsingerror.Text"));
  998. }
  999. private void ParamSetingDialog_Load(object sender, EventArgs e)
  1000. {
  1001. m_axisController = AxisController.GetInstance();
  1002. }
  1003. }
  1004. }