| | |
| | | //using CodeProvider; |
| | | using DevExpress.Utils.Extensions; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraEditors.Controls; |
| | | using System.Data; |
| | | using Yw; |
| | | using Yw.WinFrmUI; |
| | | |
| | |
| | | { |
| | | public partial class IBoxFormProtocol : DocumentPage |
| | | { |
| | | private string startCode = "[&start&]"; |
| | | private string endCode = "[&end&]"; |
| | | private string paramCode = "[¶m&]"; |
| | | private string getprotocolCode = "getprotocol"; |
| | | private string saveprotocolCode = "saveprotocol"; |
| | | |
| | | public IBoxFormProtocol() |
| | | { |
| | | this.PageTitle.Caption = "协议配置"; |
| | | InitializeComponent(); |
| | | SetData(); |
| | | |
| | | |
| | | } |
| | | public event EventHandler<string> SendData; |
| | | private void SendText(string content) |
| | |
| | | SendData?.Invoke(null, content); |
| | | } |
| | | |
| | | |
| | | |
| | | public void HideButton() |
| | | { |
| | | simpleButton1.Visible = false; |
| | | } |
| | | private void simpleButton1_Click(object sender, EventArgs e) |
| | | { |
| | | Save(); |
| | |
| | | /// </summary> |
| | | public void Save() |
| | | { |
| | | SendText(startCode + saveprotocolCode + paramCode + JsonHelper.Object2Json(GetData()) + endCode); |
| | | |
| | | SendText(IBoxHelper.startCode + IBoxHelper.saveprotocolCode + IBoxHelper.paramCode + JsonHelper.Object2Json(GetData()) + IBoxHelper.endCode); |
| | | } |
| | | |
| | | public void SetData() |
| | | { |
| | | |
| | |
| | | private void EboxFormProtocol_Load(object sender, EventArgs e) |
| | | { |
| | | Thread.Sleep(500); |
| | | SendText(startCode + getprotocolCode + paramCode + endCode); |
| | | SendText(IBoxHelper.startCode + IBoxHelper.getprotocolCode + IBoxHelper.paramCode + IBoxHelper.endCode); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | stopBits = System.IO.Ports.StopBits.One |
| | | }; |
| | | } |
| | | if (isBlue) { |
| | | this.Invoke(new Action(() => |
| | | if (isBlue) |
| | | { |
| | | var protocols = new dModbus().ProtocolType(); |
| | | var des = protocols.FirstOrDefault(x => x.Value == model.ProtocolType).Key; |
| | | imageComboBoxEditType.SelectItemByDescription(des); |
| | | ChangeType(model.ProtocolType, model); |
| | | })); |
| | | this.Invoke(new Action(() => |
| | | { |
| | | var protocols = new dModbus().ProtocolType(); |
| | | var des = protocols.FirstOrDefault(x => x.Value == model.ProtocolType).Key; |
| | | imageComboBoxEditType.SelectItemByDescription(des); |
| | | ChangeType(model.ProtocolType, model); |
| | | })); |
| | | } |
| | | else |
| | | { |