private void btnScanRobots_Click(object sender, EventArgs e) { DeviceScanForm dsf = new DeviceScanForm(this); if (dsf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dsf.SelectedList != null) { RobotConfigList.AddRange(dsf.SelectedList); SaveConfig(); LoadConfig(); } } }
private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("真的要删除吗?", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { if (lvConnectionList.SelectedItems.Count > 0) { foreach (ListViewItem lvi in lvConnectionList.SelectedItems) { RobotConfigList.Remove((RobotConfigItem)lvi.Tag); lvi.Remove(); } } SaveConfig(); LoadConfig(); } }
private void btnAdd_Click(object sender, EventArgs e) { DeviceEditorForm def = new DeviceEditorForm(); def.Text = "新增"; if (def.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (string.IsNullOrEmpty(def.NickName) || string.IsNullOrEmpty(def.IP) || def.Port <= 100) { return; } else { RobotConfigItem rci = new RobotConfigItem(); rci.NickName = def.NickName; rci.IP = def.IP; rci.Port = def.Port; RobotConfigList.Add(rci); SaveConfig(); LoadConfig(); } } }