private void 退出采集站ToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "是否要退出IO采集站,退出后设备将无法获取传输数据!", "退出提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { MonitorFormManager.ApplicationExit(); } }
private void btnOK_BtnClick(object sender, EventArgs e) { if (FrmDialog.ShowDialog(this, "保存后需要重新启动系统,是否要保存?", "保存提示", true, true, true, true) == DialogResult.OK) { try { TcpPackConfig.ReceiveBufferSize = int.Parse(ucReceiveBufferSize.InputText); TcpPackConfig.SendBufferSize = int.Parse(ucSendBufferSize.InputText); TcpPackConfig.ReceiveTimeout = int.Parse(ucReceiveTimeout.InputText); TcpPackConfig.SendTimeout = int.Parse(ucSendTimeout.InputText); TcpPackConfig.HeartBeat = tbHeart.Text; TcpPackConfig.HeadPack = tbHead.Text; TcpPackConfig.TailPack = tbTail.Text; TcpPackConfig.DelayTime = int.Parse(ucDelayTime.InputText); IOMonitorManager.Config.RemotePort = ucRemotePort.InputText; IOMonitorManager.Config.RemoteIP = tbIP.Text; IOMonitorManager.Config.WriteConfig(); this.DialogResult = DialogResult.OK; } catch (Exception ex) { MonitorFormManager.DisplyException(ex); } } }
private void MonitorForm_Load(object sender, EventArgs e) { lblTitle.Text = PubConstant.Product; timer.Start(); DbHelperSQLite.connectionString = "Data Source=" + Application.StartupPath + "\\IOProject\\Station.station"; btnClose.Location = new Point(this.Width - btnClose.Width, btnClose.Location.Y); btMin.Location = new Point(this.Width - btnClose.Width - btMin.Width - 4, btnClose.Location.Y); btMax.Location = new Point(this.Width - btnClose.Width - btMin.Width - btMax.Width - 6, btnClose.Location.Y); try { runBakcMenu.Checked = IOMonitorManager.IsBackRun; runBackToolMenu.Checked = IOMonitorManager.IsBackRun; MonitorFormManager.InitMonitorMainForm(this); IOMonitorManager.OnMonitorException += MonitorManager_OnMonitorException; IOMonitorManager.OnMonitorReceive += IOMonitorManager_OnMonitorReceive; } catch (Exception ex) { MonitorFormManager.AppendLogItem(ex.Message); } }
/// <summary> /// 设置采集点的采集值 /// </summary> /// <returns></returns> public void SetIOValue(Scada.Model.IO_SERVER server, Scada.Model.IO_COMMUNICATION comm, Scada.Model.IO_DEVICE device) { try { ChangedBinds(server, comm, device.Copy()); } catch (Exception ex) { MonitorFormManager.DisplyException(ex); } }
public void LoadTreeStatus() { Task.Run(() => { try { MonitorFormManager.LoadProject(this.IoTreeStatus); } catch (Exception ex) { MonitorFormManager.DisplyException(ex); } }); }
private void listView_SelectedIndexChanged(object sender, EventArgs e) { if (listView.SelectedItems.Count < 0) { return; } try { IO_PARA para = listView.SelectedItems[0].Tag as IO_PARA; MonitorFormManager.SetIOPara(this.Server, this.Communication, this.Device, para); } catch (Exception ex) { MonitorFormManager.DisplyException(ex); } }
private void IoTreeStatus_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node is IoDeviceTreeNode) { try { IoDeviceTreeNode devNode = e.Node as IoDeviceTreeNode; this.mediator.IOMonitorForm.Device = devNode.Device; this.mediator.IOMonitorForm.Communication = devNode.Communication; this.mediator.IOMonitorForm.ChangedBinds(devNode.Server, devNode.Communication, devNode.Device); this.mediator.IOMonitorForm.SetIOValue(devNode.Server, devNode.Communication, devNode.Device); } catch (Exception ex) { MonitorFormManager.DisplyException(ex); } } }
/// <summary> /// 异常处理 /// </summary> /// <param name="ex"></param> private void MonitorManager_OnMonitorException(Exception ex) { MonitorFormManager.AppendLogItem(ex.Message); }
//采集服务器操作返回事件 //写入之日 private void MonitorManager_OnMonitorLog(string log) { MonitorFormManager.AppendLogItem(log); }
private void IOMonitorManager_OnMonitorReceive(Scada.Model.IO_SERVER server, Scada.Model.IO_COMMUNICATION comm, Scada.Model.IO_DEVICE device, byte[] sourceBytes) { MonitorFormManager.MonitorIODataShowView(server, comm, device); }
static void Application_ApplicationExit(object sender, EventArgs e) { MonitorFormManager.ApplicationExit(); }