using POSV.Bean; using POSV.Utils; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace POSV.Component { public partial class GuestShowModifyForm : BusinessForm { public GuestShowModifyForm(string paramStr) { InitializeComponent(); try { if (!string.IsNullOrEmpty(paramStr)) { var param = JsonUtils.Deserialize(paramStr); if(param != null) { this.nameCom.Text = param.Name; this.baudCom.Text = param.Baud.ToString(); this.checkNumCom.Text = param.CheckNum.ToString(); this.dataNumCom.Text = param.DataNum.ToString(); this.stopNumCom.Text = param.StopNum.ToString(); this.customDisplayType.Text = param.DisplayType; this.columnNumCom.Text = param.ColumnNum.ToString(); this.checkTwoRow.Checked = param.RowNum == 2; this.checkOneRow.Checked = param.RowNum == 1; this.initCmd.Text = param.InitCmd; this.r1ReadyCmd.Text = param.R1ReadyCmd; this.r1DisplayCmd.Text = param.R1DisplayCmd; this.r1EndCmd.Text = param.R1EndCmd; this.r2ReadyCmd.Text = param.R2ReadyCmd; this.r2DisplayCmd.Text = param.R2DisplayCmd; this.r2EndCmd.Text = param.R2EndCmd; this.oneRowExistLight.Checked = param.OneRowExistLight; this.offLightCmd.Text = param.OffLightCmd; this.priceLightCmd.Text = param.PriceLightCmd; this.totalLightCmd.Text = param.TotalLightCmd; this.paidLightCmd.Text = param.PaidLightCmd; this.changeLightCmd.Text = param.ChangeLightCmd; } } } catch(Exception) { } } /// /// 关闭 /// /// /// private void OnCloseClick(object sender, EventArgs e) { if(this.Owner != null) { this.Owner.Close(); } this.Close(); } public delegate void KxCmdEventHandler(string kxParam); public event KxCmdEventHandler KxCmdCommit; /// /// 提交修改 /// /// /// private void OnSubmitTouchClick(object sender, Component.TouchEventArgs e) { POSV.Bean.GuestShowParameter param = new POSV.Bean.GuestShowParameter(); param.Name = this.nameCom.Text; param.Baud = StringUtils.GetInt(this.baudCom.Text); param.CheckNum = (SerialPortCheckType)Enum.Parse(typeof(SerialPortCheckType), this.checkNumCom.Text); param.DataNum = StringUtils.GetInt(this.dataNumCom.Text); param.StopNum = StringUtils.GetInt(this.stopNumCom.Text); param.DisplayType = this.customDisplayType.Text; param.ColumnNum = StringUtils.GetInt(this.columnNumCom.Text); param.RowNum = this.checkTwoRow.Checked ? 2 : 1; param.InitCmd = this.initCmd.Text; param.R1ReadyCmd = this.r1ReadyCmd.Text; param.R1DisplayCmd = this.r1DisplayCmd.Text; param.R1EndCmd = this.r1EndCmd.Text; param.R2ReadyCmd = this.r2ReadyCmd.Text; param.R2DisplayCmd = this.r2DisplayCmd.Text; param.R2EndCmd = this.r2EndCmd.Text; param.OneRowExistLight = this.oneRowExistLight.Checked; param.OffLightCmd = this.offLightCmd.Text; param.PriceLightCmd = this.priceLightCmd.Text; param.TotalLightCmd = this.totalLightCmd.Text; param.PaidLightCmd = this.paidLightCmd.Text; param.ChangeLightCmd = this.changeLightCmd.Text; KxCmdCommit?.Invoke(JsonUtils.Serialize(param)); this.OnCloseClick(sender, null); } private void OnCloseTouchClick(object sender, Component.TouchEventArgs e) { this.OnCloseClick(sender, null); } } }