Exemplo n.º 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            TreeNode node = tvGrp.SelectedNode;

            if (node == null || !(node.Tag is Group))
            {
                MessageBox.Show(LangPack.GetMongolian("Please select the group to modify."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            this.newGrpName = node.Text;
            GroupEditForm form = new GroupEditForm(this);

            if (DialogResult.OK != form.ShowDialog())
            {
                return;
            }

            node.Text = this.newGrpName;

            Group gp = node.Tag as Group;

            gp.Name = this.newGrpName;
            grpMng.UpdateGrp(gp.Key, gp);
        }
Exemplo n.º 2
0
        private void btnKindAdd_Click(object sender, EventArgs e)
        {
            this.brdNewName = string.Empty;

            GroupEditForm form = new GroupEditForm(this);

            form.OnCGChangeBoxEvt += new EventHandler <CGChangeEventArgs>(form_OnCGChangeBoxEvt);

            if (DialogResult.OK != form.ShowDialog())
            {
                form.OnCGChangeBoxEvt -= new EventHandler <CGChangeEventArgs>(form_OnCGChangeBoxEvt);
                return;
            }

            BoardInfo brd = new BoardInfo();

            brd.kind    = string.Format("({0})_{1}", this.brdKindNum, this.brdNewName);
            brd.kindNum = this.brdKindNum; //kind number
            brd.dicText = new Dictionary <string, BoardInfoDetail>();
            brdMng.dicBrd.Add(string.Format("({0})_{1}", this.brdKindNum, this.brdNewName), brd);

            brdMng.SaveBrdData();
            AddTreeData();
            form.OnCGChangeBoxEvt -= new EventHandler <CGChangeEventArgs>(form_OnCGChangeBoxEvt);
        }
Exemplo n.º 3
0
        private void btnKindEdit_Click(object sender, EventArgs e)
        {
            TreeNode node = tvKind.SelectedNode;

            if (node == null)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select the items to modify."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string tmpName = string.Empty;

            string[] tmp = node.Text.Split('_');
            tmpName = node.Text.Replace(tmp[0] + "_", "");
            tmp[0]  = tmp[0].Trim('(');
            tmp[0]  = tmp[0].Trim(')');

            this.brdNewName = tmpName;
            this.brdKindNum = int.Parse(tmp[0]);

            GroupEditForm form = new GroupEditForm(this);

            form.OnCGChangeBoxEvt += new EventHandler <CGChangeEventArgs>(form_OnCGChangeBoxEvt);

            if (DialogResult.OK != form.ShowDialog())
            {
                form.OnCGChangeBoxEvt -= new EventHandler <CGChangeEventArgs>(form_OnCGChangeBoxEvt);
                return;
            }

            BoardInfo brd = new BoardInfo();

            brd.kind    = string.Format("({0})_{1}", this.brdKindNum, this.brdNewName);
            brd.kindNum = this.brdKindNum;

            Dictionary <string, BoardInfoDetail> dicNewBrd = new Dictionary <string, BoardInfoDetail>();

            foreach (KeyValuePair <string, BoardInfoDetail> pair in brdMng.dicBrd[node.Text].dicText)
            {
                BoardInfoDetail newBrd = new BoardInfoDetail();
                newBrd.kind    = brd.kind;
                newBrd.kindNum = brd.kindNum;
                newBrd.name    = pair.Value.name;
                newBrd.text    = pair.Value.text;
                dicNewBrd.Add(newBrd.name, newBrd);
            }

            brd.dicText = dicNewBrd;
            brdMng.dicBrd.Add(string.Format("({0})_{1}", this.brdKindNum, this.brdNewName), brd);
            brdMng.dicBrd.Remove(node.Text);

            brdMng.SaveBrdData();
            AddTreeData();
            form.OnCGChangeBoxEvt -= new EventHandler <CGChangeEventArgs>(form_OnCGChangeBoxEvt);
        }
Exemplo n.º 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            GroupEditForm form = new GroupEditForm(this);

            if (DialogResult.OK != form.ShowDialog())
            {
                return;
            }

            // Create new group
            Group gp = new Group();

            gp.Key  = DateTime.Now.ToBinary().ToString();
            gp.Name = this.newGrpName;
            AddGroupItem(gp);

            this.newGrpName = string.Empty;

            grpMng.UpdateGrp(gp.Key, gp);
        }