Ejemplo n.º 1
0
        public FileNode(ProjectFileEntry file, IconProvider iconProvider)
            : base(file.FilePath)
        {
            if (file == null)
                throw new ArgumentNullException("file");

            if (iconProvider == null)
                throw new ArgumentNullException("iconProvider");

            FileEntry = file;
            FileEntry.FilePathChanged += FileEntry_FilePathChanged;

            ImageIndex = SelectedImageIndex = (_iconProvider = iconProvider).GetImageIndex(file);
        }
 private void existingFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var dialog = new OpenFileDialog())
     {
         if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             var directoryNode = GetCurrentDirectoryNode();
             var projectNode = directoryNode.GetProjectNode();
             var sourcePath = new FilePath(dialog.FileName);
             var newPath = new FilePath(directoryNode.FilePath, sourcePath.FileName + sourcePath.Extension);
             _extensionHost.FileService.CopyFile(sourcePath, newPath);
             var fileEntry = new ProjectFileEntry(newPath);
             projectNode.ProjectEntry.Project.ProjectFiles.Add(fileEntry);
         }
     }
 }