private bool ShowPedalConfig(PedalConfig pedalPar) { using (frmPedalDesign design = new frmPedalDesign()) { return(design.ShowPedalConfig(pedalPar, this)); } }
public void CopyFrom(PedalConfig sourcePar) { this.PealDeviceName = sourcePar.PealDeviceName; this.SignCount = sourcePar.SignCount; this.TouchInterval = sourcePar.TouchInterval; this.TouchWay = sourcePar.TouchWay; }
protected override void ReloadCustomDesign(string customContext) { if (string.IsNullOrEmpty(customContext)) { return; } _defPedalPar = JsonHelper.DeserializeObject <PedalConfig>(customContext); }
public bool ShowPedalConfig(PedalConfig cc, IWin32Window owner) { _isOk = false; _cc = cc; this.ShowDialog(owner); return(_isOk); }
static public PedalConfig GetConfig() { PedalConfig cc = new PedalConfig(); try { cc.PealDeviceName = AppSetting.ReadSetting("PealDeviceName"); cc.TouchWay = (SerialTouchWay)Enum.Parse(typeof(SerialTouchWay), AppSetting.ReadSetting("TouchWay", SerialTouchWay.stwDirect.ToString())); cc.TouchInterval = AppSetting.ReadInt("TouchInterval"); cc.SignCount = AppSetting.ReadInt("SignCount"); } catch (Exception ex) { MsgBox.ShowException(ex); } return(cc); }
static public void SetConfig(PedalConfig cc) { AppSetting.BatchBegin(); try { AppSetting.WriteSetting("PealDeviceName", cc.PealDeviceName); AppSetting.WriteSetting("TouchWay", cc.TouchWay.ToString()); AppSetting.WriteInt("TouchInterval", cc.TouchInterval); AppSetting.WriteInt("SignCount", cc.SignCount); AppSetting.BatchCommit(); } catch (Exception ex) { AppSetting.BatchCancel(); MsgBox.ShowException(ex); } }
private void butSure_Click(object sender, EventArgs e) { try { _cc.PealDeviceName = cbxPedal.Text; _cc.TouchWay = (SerialTouchWay)cbxTouchWay.SelectedIndex; _cc.TouchInterval = Convert.ToInt32(cbxInterval.Text); _cc.SignCount = Convert.ToInt32(cbxSignCount.Text); PedalConfig.SetConfig(_cc); _isOk = true; this.Close(); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
private void OpenPedal() { try { if (_pc == null) { _pc = PedalConfig.GetConfig(); } if (string.IsNullOrEmpty(_pc.PealDeviceName)) { _pc.CopyFrom(_defPedalPar); } if (string.IsNullOrEmpty(_pc.PealDeviceName)) { return; } if (_pedal == null) { _pedal = new PedalDevice(); this.Controls.Add(_pedal); _pedal.OnSerialSignal += SerialSignalProcess; } _pedal.Stop(); _pedal.InitDevice(_pc.PealDeviceName); _pedal.Start(); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
public PedalControl() { InitializeComponent(); _defPedalPar = new PedalConfig(); }