Example #1
0
        private void OnNewFolderClick(object sender, EventArgs e)
        {
            var    node     = _treeView.SelectedNode ?? _treeView.Nodes[0];
            string location = "";

            if (node != null)
            {
                var item = node.Tag as IProjectItem;
                if (item != null)
                {
                    location = item.Location;
                }
                else
                {
                    location = node.FullPath.Substring(_treeView.Nodes[0].Text.Length + 1);
                }
            }

            var dialog = new TextEditDialog("New Folder", "Folder Name:", "");

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                _controller.NewFolder(dialog.text, location);
            }
        }
Example #2
0
        private void OnRenameItemClick(object sender, EventArgs e)
        {
            FileType type = FileType.Base;

            var    item = (_treeView.SelectedNode.Tag as IProjectItem);
            string path = item.OriginalPath;

            if (_treeView.SelectedNode.Tag is ContentItem)
            {
                type = FileType.File;
            }
            else if (_treeView.SelectedNode.Tag is FolderItem)
            {
                type = FileType.Folder;
            }
            else
            {
                path = item.Name;
            }

            TextEditDialog dialog = new TextEditDialog("Rename", "New Name:", _treeView.SelectedNode.Text);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string newpath = System.IO.Path.GetDirectoryName(path) + System.IO.Path.DirectorySeparatorChar + dialog.text;
                _controller.Move(new [] { path }, new [] { newpath.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) ? newpath.Substring(1) : newpath }, new[] { type });
            }
        }
Example #3
0
        private void OnRenameItemClick(object sender, EventArgs e)
        {
            FileType type = FileType.Base;

            var item = (_treeView.SelectedNode.Tag as IProjectItem);
            string path = item.OriginalPath;

            if (_treeView.SelectedNode.Tag is ContentItem)
                type = FileType.File;
            else if (_treeView.SelectedNode.Tag is FolderItem)
                type = FileType.Folder;
            else
                path = item.Name;

            TextEditDialog dialog = new TextEditDialog("Rename", "New Name:", _treeView.SelectedNode.Text);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string newpath = System.IO.Path.GetDirectoryName(path) + System.IO.Path.DirectorySeparatorChar + dialog.text;
                _controller.Move(new [] { path }, new [] { newpath.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) ? newpath.Substring(1) : newpath }, new[] { type });
            }
        }
Example #4
0
        private void OnNewFolderClick(object sender, EventArgs e)
        {
            var node = _treeView.SelectedNode ?? _treeView.Nodes[0];
            string location = "";

            if (node != null)
            {
                var item = node.Tag as IProjectItem;
                if (item != null)
                    location = item.Location;
                else
                    location = node.FullPath.Substring(_treeView.Nodes[0].Text.Length + 1);
            }

            var dialog = new TextEditDialog("New Folder", "Folder Name:", "");
            if (dialog.ShowDialog() == DialogResult.OK)
                _controller.NewFolder(dialog.text, location);
        }