예제 #1
0
        private void btnAddlamp_Click(object sender, EventArgs e)
        {
            RoadPosition _Parent   = this.tvClassify.SelectedNode.Tag as RoadPosition;
            RoadPosition _Classify = this.m_Application.ClassifyTypes.GetClassifyType(typeof(RoadPosition)).CreateClassify(_Parent) as RoadPosition;

            _Classify.OrdinalNumber = _Parent.Children.Count + 1;

            RoadClassifyManageForm frm = new RoadClassifyManageForm(_Classify, false);

            frm.Text = "添加灯杆名称";
            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                try
                {
                    frm.Classify.Save();
                    TreeNode tn = new TreeNode();
                    this.FillClassifyNode(frm.Classify, tn);
                    this.tvClassify.SelectedNode.Nodes.Add(tn);
                    this.tvClassify.SelectedNode.Expand();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "位置", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            RoadPosition           _Classify = this.tvClassify.SelectedNode.Tag as RoadPosition;
            RoadClassifyManageForm frm       = new RoadClassifyManageForm(_Classify, true);

            frm.Text = "修改名称";
            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                try
                {
                    frm.Classify.Save();
                    this.FillClassifyNode(frm.Classify, this.tvClassify.SelectedNode);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "位置", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #3
0
        private void btnAddroot_Click(object sender, EventArgs e)
        {
            RoadPosition           _Classify = this.m_Application.ClassifyTypes.GetClassifyType(typeof(RoadPosition)).CreateClassify() as RoadPosition;
            RoadClassifyManageForm frm       = new RoadClassifyManageForm(_Classify, false);

            frm.Text = "添加城市名称";
            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                try
                {
                    frm.Classify.Save();
                    btnAddroot.Enabled = false;
                    TreeNode tn = new TreeNode();
                    this.FillClassifyNode(frm.Classify, tn);
                    this.tvClassify.Nodes.Add(tn);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "公共分类", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }