Ejemplo n.º 1
0
        private void UpdateTree(TreeNode root)
        {
            Menu rootMenu = root.Tag as Menu;
            OptionFactory of = new OptionFactory();
            root.Nodes.Clear();

            foreach (Version v in rootMenu.Versions)
            {
                TreeNode vnode = CreateVersionNode(root, v);

                foreach (Page page in v.Pages)
                {
                    TreeNode pnode = CreatePageNode(vnode, page);

                    foreach (Option option in page.Items)
                    {
                        CreateOptionNode(pnode, option);
                    }
                }
                foreach (Option option in v.Items)
                {
                    CreateOptionNode(vnode, option);
                }
            }
            RefreshPreview();
        }
Ejemplo n.º 2
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (SaveFileDialog sfd = new SaveFileDialog())
     {
         if (sfd.ShowDialog() == DialogResult.OK)
         {
             OptionFactory of = new OptionFactory();
             of.Serialize(treeView1.Nodes[0].Tag as Menu, sfd.FileName);
         }
     }
 }
Ejemplo n.º 3
0
        private void toggleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null)
            {
                TreeNode node = treeView1.SelectedNode;
                if (node.Tag.GetType() != typeof(Version) && node.Tag.GetType() != typeof(Page))
                {
                    node = node.Parent;
                }

                ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
                //TreeNode node = treeView1.SelectedNode;
                string type = menuItem.Tag as string;

                OptionFactory of = new OptionFactory();
                IOption option = of.Create(node.Tag as IContentContainer, type);
                TreeNode treeNode = new TreeNode(option.VariableName) { Tag = option };
                UpdateTreeNodeText(option, "VariableName", treeNode);
                node.Nodes.Add(treeNode);

                RefreshPreview();
            }
        }
Ejemplo n.º 4
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    OptionFactory of = new OptionFactory();
                    Menu menu = of.Deserialize(ofd.FileName);

                    treeView1.Nodes.Clear();
                    UpdateTree(CreateMenuNode(menu));
                }
            }
        }