//全部删除 private void toolStripMenuItem_DelAll_Click(object sender, EventArgs e) { ExecCommandList.LC.Clear(); advTree1.Nodes.Clear(); if (TcpControl.Connected) { TcpControl.SendUItoServiceCommand("--cmd|clear"); } }
private void UpdateComboBox(object sender, DeviceDataEventArgs e) { this.Dispatcher.Invoke(() => { UsbControl.InitializeDeviceList(); TcpControl.InitializeDeviceList(); ConnectControl.InitializeDeviceList(); }); }
private void GetXML(string node) { if (TcpControl.Connected) { TcpControl.SendUItoServiceCommand("--file|" + node); } else { DevComponents.DotNetBar.MessageBoxEx.Show("与服务端通讯异常,无法同步信息!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void BTWriteAndReset_Click(object sender, EventArgs e) { if (TcpControl.Connected) { if (Insert00()) { DevComponents.DotNetBar.MessageBoxEx.Show("数据写入数据库成功!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); TcpControl.SendUItoServiceCommand("--rtu|"); } } else { DevComponents.DotNetBar.MessageBoxEx.Show("与服务端通讯异常,无法重置信息!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button_Set2_Click(object sender, EventArgs e) { if (TcpControl.Connected) { string xml = Program.wrx.GetXMLStr("Service"); xml = "--File|Service" + "|" + xml; TcpControl.SendUItoServiceCommand(xml); if (DevComponents.DotNetBar.MessageBoxEx.Show("服务信息配置成功,请重启软件?\n如果继续配置选[NO],配置完成后请重启本软件!", "[提示]", MessageBoxButtons.YesNo) == DialogResult.Yes) { System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location); System.Environment.Exit(0); } } else { DevComponents.DotNetBar.MessageBoxEx.Show("与服务端通讯异常,本地信息配置成功,无法将信息同步到服务!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//删除 private void toolStripMenuItem_Del_Click(object sender, EventArgs e) { if (node != null) { DevComponents.AdvTree.Cell cell = node.Cells[1]; DevComponents.AdvTree.Cell cell1 = node.Cells[2]; string SERVICETYPE = cell1.Tag.ToString(); var commands = from c in ExecCommandList.LC where c.STCD == node.Tag.ToString() && c.CommandID == cell.Tag.ToString() && c.SERVICETYPE == SERVICETYPE select c; if (commands.Count() > 0) { //删除服务器端列表中的召测命令 --cmd|tcp|0012345679|02 if (TcpControl.Connected) { TcpControl.SendUItoServiceCommand("--cmd|" + commands.First().SERVICETYPE + "|" + commands.First().STCD + "|" + commands.First().CommandID); } //删除本地列表和控件中的命令 DevComponents.AdvTree.Node Nd = null; foreach (var item in advTree1.Nodes) { if (item.Equals(node)) { Nd = item as DevComponents.AdvTree.Node; break; } } if (Nd != null) { advTree1.Nodes.Remove(Nd); } lock (ExecCommandList.LC) { List <Command> cmds = new List <Command>(commands); foreach (var item in cmds) { ExecCommandList.LC.Remove(item); } } } node = null; } }
private void button_Set3_Click(object sender, EventArgs e) { string protoco = "shuiwen"; if (comboBox_Protocol.SelectedIndex == 1) { protoco = "shuiwen"; } else if (comboBox_Protocol.SelectedIndex == 2) { protoco = "shuiziyuan"; } else if (comboBox_Protocol.SelectedIndex == 0) { protoco = "yanyu"; } else if (comboBox_Protocol.SelectedIndex == 3) { protoco = "zhengda212"; } if (TcpControl.Connected) { TcpControl.SendUItoServiceCommand("--pro|" + protoco); if (DevComponents.DotNetBar.MessageBoxEx.Show("服务信息配置成功,请重启软件?\n如果继续配置选[NO],配置完成后请重启本软件!", "[提示]", MessageBoxButtons.YesNo) == DialogResult.Yes) { System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location); System.Environment.Exit(0); } } else { DevComponents.DotNetBar.MessageBoxEx.Show("与服务端通讯异常,本地信息配置成功,无法将信息同步到服务!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information); } }