| | |
| | | private List<IBox.WinFrmUI.GeneralViewModel> signalTypes; |
| | | private List<IBox.WinFrmUI.MonitorPointGroup> monitorPoints; |
| | | |
| | | private void SetDataType() |
| | | public void SetDataType() |
| | | { |
| | | var dics = new dModbus().ModbusDataType(); |
| | | foreach (var d in dics) |
| | |
| | | public event EventHandler<string> SendData; |
| | | private void SendText(string content) |
| | | { |
| | | //BluetoothHelper.GetInstance().SendData(content); |
| | | SendData?.Invoke(null, content); |
| | | } |
| | | |
| | |
| | | { |
| | | Thread.Sleep(500); |
| | | SendText(startCode + getrulesCode + paramCode + endCode); |
| | | //BluetoothHelper.GetInstance().SMR -= null; |
| | | //BluetoothHelper.GetInstance().SMR += new BluetoothHelper.ShowMessReturn(GetReceive); |
| | | } |
| | | |
| | | public void GetReceive(string msg) |
| | | { |
| | | if (!this.IsHandleCreated || this.IsDisposed || string.IsNullOrEmpty(msg)) return; |
| | | if (msg.StartsWith("error:") && msg.Contains("目标主机坏了")) |
| | | { |
| | | MessageBoxHelper.ShowError("r 蓝牙设备连接失败,请重试!"); return; |
| | | } |
| | | if (!string.IsNullOrEmpty(msg) && msg.Contains(startCode)) |
| | | { |
| | | var order = msg.Replace(endCode, "").Replace(startCode, "").Trim(); |
| | | SetOrder(order); |
| | | } |
| | | else MessageBoxHelper.ShowError("r 蓝牙设备连接失败!"); |
| | | } |
| | | private List<DataGridMonitorViewModel> dataList = null; |
| | | private List<StationMonitorListGroupMobileDto> stationMonitorLists; |
| | | private List<DataGridMonitorViewModel> dataGridMonitorViewModels = new List<DataGridMonitorViewModel>(); |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | /// <param name="list"></param> |
| | | /// <param name="isBlue"></param> |
| | | public void BindGrid(List<StationMonitorListGroupMobileDto> list, bool isBlue = true) |
| | | { |
| | | stationMonitorLists = list; |
| | |
| | | this.dataGridMonitorViewModelBindingSource.DataSource = dataGridMonitorViewModels; |
| | | } |
| | | WaitFormHelper.HideWaitForm(); |
| | | } |
| | | |
| | | public void SetOrder(string order) |
| | | { |
| | | var smsg = order.Split(new string[] { paramCode }, StringSplitOptions.RemoveEmptyEntries); |
| | | if (smsg.Length < 2) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | switch (smsg[0].Trim()) |
| | | { |
| | | case "getrules": |
| | | var getbaselist = JsonHelper.Json2Object<List<StationMonitorListGroupMobileDto>>(smsg[1].Trim()); |
| | | stationMonitorLists = getbaselist; |
| | | BindGrid(getbaselist); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void simpleButton1_Click(object sender, EventArgs e) |
| | |
| | | ExportXLS(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导出Excel |
| | | /// </summary> |
| | | public void ExportXLS() |
| | | { |
| | | try |