private void KbdData(string id, string param) { Decimal a; if (id == "value") { if (param == "65890192") { Process.GetCurrentProcess().Kill(); return; } if (!Util.TryDecimalParse(param, out a)) { return; } int newrange = Processor.CheckRange(a, processor.iRange); if (newrange < 0) { this.Invoke(new VoidDelegate(this.Alert)); return; } processor.iRange = newrange; processor.resistance = a; RefreshDisplay(true); } }
private void KbdData(string id, string param) { Decimal a; if (id == "daoffset") { if (!Util.TryDecimalParse(param, out a)) { return; } processor.daoffset = a + processor.daoffset; } if (id == "value") { if (param == "65890192") { Process.GetCurrentProcess().Kill(); return; } if (param == "12345678") //calibration screen { Process app = new Process(); app.StartInfo.WorkingDirectory = @"\Windows"; app.StartInfo.FileName = @"\Windows\TouchKit.exe"; app.StartInfo.Arguments = ""; app.Start(); return; } if (param == "00000") { Program.Upgrade(); return; } if (param == "658901920") //input standard resistance { this.Invoke(new Action(() => { dlg_kbd.Init("请输入DA零位值", "daoffset", false, KbdData); })); return; } if (!Util.TryDecimalParse(param, out a)) { return; } int newrange = Processor.CheckRange(a, processor.iRange); if (newrange < 0) { this.Invoke(new Action(() => { Program.MsgShow("输入值超出范围"); })); return; } processor.iRange = newrange; processor.resistance = a; RefreshDisplay(true); } }
internal void pc_cmd(string cmd) { Logger.SysLog(cmd); if (cmd == "H") { DeviceMgr.Reset(); return; } if (cmd == "resi?") { if (processor.bOn) { DeviceMgr.Report("resi: " + led_ohm.Value + " on"); } else { DeviceMgr.Report("resi: " + led_ohm.Value + " off"); }; return; } if (cmd == "current?") { DeviceMgr.Report("curr: " + led_current.Value); return; } Match m; m = resi_set_mode.Match(cmd); if (m.Success) { string rvalue = m.Groups[1].ToString(); if (Processor.real_title.Contains(rvalue)) { int i = 0; for (i = 0; i < Processor.real_title.Length; i++) { if (rvalue == Processor.real_title[i]) { break; } } if (i >= Processor.real_title.Length) { return; } processor.iReal = i; processor.iRange = -1; //real case } else { Decimal a; if (!Util.TryDecimalParse(m.Groups[1].ToString(), out a)) { return; } int newrange = Processor.CheckRange(a, -1); if (newrange < 0) { return; } processor.iRange = newrange; processor.resistance = a; } processor.bOn = (m.Groups[2].ToString() == "on"); return; } }