Esempio n. 1
0
        private void AddItem(object sender, EventArgs e)
        {
            string       categoryGuid = copyTree.SelectedNode.Name;
            EditItemForm eif          = new EditItemForm();

            if (eif.ShowDialog() == DialogResult.OK)
            {
                Guid     itemGuid = Guid.NewGuid();
                Item     item     = new Item(eif.ItemName, eif.ItemContent, eif.ItemColor);
                TreeNode node     = copyTree.Nodes[categoryGuid].Nodes.Add(itemGuid.ToString(), item.Name);
                node.BackColor   = item.Color;
                node.ContextMenu = itemMenu;
                qcData.Categories[Guid.Parse(categoryGuid)].Items[itemGuid] = item;
            }
        }
Esempio n. 2
0
        private void EditItem(object sender, EventArgs e)
        {
            string       categoryGuid = copyTree.SelectedNode.Parent.Name;
            string       itemGuid     = copyTree.SelectedNode.Name;
            Item         item         = qcData.Categories[Guid.Parse(categoryGuid)].Items[Guid.Parse(itemGuid)];
            EditItemForm eif          = new EditItemForm(item.Name, item.Content, item.Color);

            if (eif.ShowDialog() == DialogResult.OK)
            {
                // update item
                item.Name    = eif.ItemName;
                item.Content = eif.ItemContent;
                item.Color   = eif.ItemColor;

                // update tree
                TreeNode node = copyTree.Nodes[categoryGuid].Nodes[itemGuid];
                node.Text      = item.Name;
                node.BackColor = item.Color;
            }
        }
Esempio n. 3
0
        private void EditMenuItem_Click(object sender, EventArgs e)
        {
            if (copyTree.SelectedNode.Level == 1)
            {
                string       categoryGuid = copyTree.SelectedNode.Parent.Name;
                string       itemGuid     = copyTree.SelectedNode.Name;
                Item         item         = qcData.Categories[Guid.Parse(categoryGuid)].Items[Guid.Parse(itemGuid)];
                EditItemForm eif          = new EditItemForm(item.Name, item.Content, item.Color);
                if (eif.ShowDialog() == DialogResult.OK)
                {
                    // update item
                    item.Name    = eif.ItemName;
                    item.Content = eif.ItemContent;
                    item.Color   = eif.ItemColor;

                    // update tree
                    TreeNode node = copyTree.Nodes[categoryGuid].Nodes[itemGuid];
                    node.Text      = item.Name;
                    node.BackColor = item.Color;
                }
            }
            else if (copyTree.SelectedNode.Level == 0)
            {
                string           categoryGuid = copyTree.SelectedNode.Name;
                Category         category     = qcData.Categories[Guid.Parse(categoryGuid)];
                EditCategoryForm ecf          = new EditCategoryForm(category.Name, category.Color);
                if (ecf.ShowDialog() == DialogResult.OK)
                {
                    // update category
                    category.Name  = ecf.CategoryName;
                    category.Color = ecf.CategoryColor;

                    // update tree
                    TreeNode node = copyTree.Nodes[categoryGuid];
                    node.Text      = category.Name;
                    node.BackColor = category.Color;
                }
            }
        }