Exemplo n.º 1
0
        private void SelectItem(string selectedFile)
        {
            var panel = splitContainer1.Panel2;

            panel.Controls.Clear();
            _selectedItemSettings      = _items[selectedFile];
            _selectedItemSettings.Dock = DockStyle.Fill;
            panel.Controls.Add(_selectedItemSettings);
        }
Exemplo n.º 2
0
        private void btnCtxAddItem_Click(object sender, EventArgs e)
        {
            //Check if Selected Node is a Directory or the Root Directory
            var ofd = new OpenFileDialog
            {
                CheckFileExists = true,
                Multiselect     = false
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var selectedFile         = ofd.FileName;
                var selectedItemSettings = new ItemSettingsComponent
                {
                    SelectedFile        = selectedFile,
                    StructureIdentifier = TraverseStructure()
                };

                _items.Add(selectedFile, selectedItemSettings);
                treeView1.SelectedNode.Nodes.Add(selectedFile, selectedFile.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries).Last());
                treeView1.SelectedNode.Expand();
                SelectItem(selectedFile);
            }
        }