/// <summary> /// 保存修改 /// </summary> private void buttonSave_Click(object sender, EventArgs e) { try { object o = _planTree.GetSelectedNode(treeView1.SelectedNode); if (o is Plan) { PlanInfoControl planInfo = this.panel2.Controls[0] as PlanInfoControl; Plan plan = planInfo.Plan; _planTree.ModifyPlan(plan); } else { ZoneInfoControl controlZoneInfo = this.panel2.Controls[0] as ZoneInfoControl; ControlZone zone = controlZoneInfo.Get(); Plan plan = _planTree.GetSelectedNode(treeView1.SelectedNode.Parent) as Plan; _planTree.ModifyZone(zone, plan); } _planTree.SaveTree(); MessageBox.Show("保存成功!"); } catch (Exception ex) { MessageBox.Show("保存失败!"); } }
/// <summary> /// 生成管控区 /// </summary> private void buttonConvert_Click(object sender, EventArgs e) { try { object o = _planTree.GetSelectedNode(treeView1.SelectedNode); if (o is Plan) { MessageBox.Show("请选择管控区!"); } else { ZoneInfoControl controlZoneInfo = this.panel2.Controls[0] as ZoneInfoControl; _zone = controlZoneInfo.Get(); _zone.CreateControlZone(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "创建失败!"); } }