예제 #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("保存失败!");
     }
 }
예제 #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;
            }
        }
예제 #3
0
        /// <summary>
        /// 树节点双击
        /// </summary>
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            //如果是管控区节点,弹出对话框
            object o = _planTree.GetSelectedNode(e.Node);

            if (o is ControlZone)
            {
                foreach (Control control in this.panel2.Controls)
                {
                    if (control is ZoneInfoControl)
                    {
                        this.panel2.Controls.Remove(control);
                    }
                }
                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;

                ControlZone oo = o as ControlZone;

                Plan plan = _planTree.GetSelectedNode(e.Node.Parent) as Plan;
                //SQLForm sqlform = new SQLForm();
                //sqlform.sqlControl1.Load(plan.address,plan.isSDE);
                //sqlform.ShowDialog();
                //if (sqlform.DialogResult == DialogResult.OK)
                //{
                //    oo.sql = sqlform.sql;
                //}

                ////选择类别构建SQL语句
                //configTreeView configForm = new configTreeView(oo.sql);
                //configForm._fieldName = (o as ControlZone).BSM;
                //configForm.GetValue += new EventHandler(SendValue);
                //configForm.ShowDialog(this);
                //oo.sql = query_Sql;

                controlZoneInfo.Set(oo, _planTree.GetSelectedNode(e.Node.Parent) as Plan);
            }
        }
예제 #4
0
 /// <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 + "创建失败!");
     }
 }