Esempio n. 1
0
        void AddNewFolder()
        {
            var newFolderVM = new NewFolderViewModel();

            if (ShowNewFolderDialog(newFolderVM) == true)
            {
                string folderName = newFolderVM.FolderName;
                if (folderName != "" && SelectedItem.Type != ProjectItemType.File)
                {
                    DirectoryInfo di;
                    if (SelectedItem != null)
                    {
                        di = Directory.CreateDirectory(SelectedItem.Path + "\\" + folderName);
                    }
                    else
                    {
                        di = Directory.CreateDirectory(@"C:\Work\Work\WpfProject\ProjectA\" + folderName);
                    }
                    ProjectItem newItem = new ProjectItem(CloseTab)
                    {
                        Path = di.FullName, Name = folderName, Type = ProjectItemType.Folder
                    };
                    AddItemToItems(newItem, Items[0]);
                    MessageBox.Show("Folder created");
                }
                else
                {
                    MessageBox.Show("Incorrect folder name");
                }
            }
        }
Esempio n. 2
0
        protected virtual bool?ShowNewFolderDialog(NewFolderViewModel vm)
        {
            var newFolderWindow = new NewFolderWindow()
            {
                DataContext = vm
            };

            return(newFolderWindow.ShowDialog());
        }