public bool AttemptRename(ArchiveItem archiveItem, string newName) { if (archiveItem.Name == newName) { return false; } Microsoft.VisualBasic.Devices.Computer pc = new Microsoft.VisualBasic.Devices.Computer(); string newPath = Path.Combine(archiveItem.DirInfo.Parent.FullName, newName); if (Directory.Exists(newPath)) { App.CurrentVMHelp.ShowNegativeHelpbar(String.Format("I can't rename to \"{0}\" as there is already a folder with that name.", newName)); return false; } pc.FileSystem.RenameDirectory(archiveItem.DirInfo.FullName, newName); archiveItem.DirInfo = new DirectoryInfo(newPath); App.CurrentVMHelp.ShowPositiveHelpbar(String.Format("I've renamed the folder {0} to {1}.", archiveItem.Name, newName)); archiveItem.Name = newName; return true; }
private void selectArchiveItem(ArchiveItem archiveItem) { vmSearchPage.SelectArchiveItem(archiveItem); }
private void copyArchiveItemToClipboard(ArchiveItem archiveItem) { StringCollection selectedItemPath = new StringCollection(); selectedItemPath.Add(archiveItem.DirInfo.FullName); Clipboard.SetFileDropList(selectedItemPath); vmHelp.ShowPositiveHelpbar(String.Format("I have copied {0} to the clipboard.", archiveItem.Name)); }
public void SelectArchiveItem(ArchiveItem selectedItem) { if (UserIsArchiving) { vmArchive.ArchiveInput(CurrentInput, selectedItem.DirInfo); CurrentInput = null; } else { SoundEffects.Play(SoundEffects.EffectEnum.Click); System.Diagnostics.Process.Start(selectedItem.DirInfo.FullName); if (Properties.Settings.Default.CloseAfterOpening) { Application.Current.Shutdown(); } } }
public void CreateNewFolder() { ioFolderCreator creator = new ioFolderCreator(); ArchiveItem newFolder = new ArchiveItem(creator.CreateNewFolder()); allArchiveItems.Add(newFolder); SearchFilter = newFolder.Name; UserIsRenamingFolder = true; }
public void DeleteFolder(ArchiveItem itemToBeDeleted) { Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory(itemToBeDeleted.DirInfo.FullName, Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin); allArchiveItems.Remove(itemToBeDeleted); SearchFilter = " "; SearchFilter = ""; App.CurrentVMHelp.ShowPositiveHelpbar(String.Format("I have deleted {0}. It can be recovered from the Windows recycle bin.", itemToBeDeleted.Name)); }