Beispiel #1
0
 /// <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("保存失败!");
     }
 }
Beispiel #2
0
        /// <summary>
        /// 单击树节点
        /// </summary>
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            this.panel2.Controls.Clear();
            object o = _planTree.GetSelectedNode(e.Node);

            if (o is Plan)
            {
                PlanInfoControl planInfo = new PlanInfoControl();
                planInfo.Plan = o as Plan;
                this.panel2.Controls.Add(planInfo);
                planInfo.Dock = DockStyle.Fill;
            }
            else
            {
                ZoneInfoControl controlZoneInfo = new ZoneInfoControl();
                controlZoneInfo.Set(o as ControlZone, _planTree.GetSelectedNode(e.Node.Parent) as Plan);
                this.panel2.Controls.Add(controlZoneInfo);
                controlZoneInfo.Dock = DockStyle.Fill;
            }
        }