private FileItem fgvLocal_FileReceived(string localPath) { if (string.IsNullOrEmpty(_currentPath)) { throw new Exception("Please select a local folder."); } if (Directory.Exists(localPath)) { string targetPath = Path.Combine(_currentPath, Path.GetFileName(localPath)); Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(localPath, targetPath, UIOption.AllDialogs); return(FileItem.FromLocalFolder(localPath)); } if (File.Exists(localPath)) { string targetPath = Path.Combine(_currentPath, Path.GetFileName(localPath)); Microsoft.VisualBasic.FileIO.FileSystem.CopyFile(localPath, targetPath, UIOption.AllDialogs); return(FileItem.FromLocalFile(localPath)); } throw new FileNotFoundException(); }