Beispiel #1
0
        public static IEnumerable <IEnumerable <FileSystemEntryViewModel> > Create(
            ICodeSearchController host,
            TreeViewItemViewModel parentViewModel,
            FileSystemEntry fileSystemEntry,
            Action <FileSystemEntryViewModel> postCreate,
            bool flattenResults)
        {
            var fileEntry = fileSystemEntry as FileEntry;

            if (fileEntry != null)
            {
                return(new[] { CreateFileEntry(null, fileEntry, host, parentViewModel, fileSystemEntry, postCreate, flattenResults) });
            }
            else
            {
                if (flattenResults)
                {
                    var directoryEntry = fileSystemEntry as DirectoryEntry;
                    return(directoryEntry
                           .Entries
                           .Select(entry => CreateFileEntry(directoryEntry, (FileEntry)entry, host, parentViewModel, fileSystemEntry, postCreate, flattenResults))
                           .ToList());
                }
                else
                {
                    var result = new DirectoryEntryViewModel(host, parentViewModel, (DirectoryEntry)fileSystemEntry, postCreate);
                    postCreate(result);
                    return(new[] { new[] { result } });
                }
            }
        }
 public static FileSystemEntryViewModel Create(
   ICodeSearchController host,
   TreeViewItemViewModel parentViewModel,
   FileSystemEntry fileSystemEntry, Action<FileSystemEntryViewModel> postCreate) {
   var fileEntry = fileSystemEntry as FileEntry;
   if (fileEntry != null) {
     var result = new FileEntryViewModel(host, parentViewModel, fileEntry);
     postCreate(result);
     return result;
   }
   else {
     var result = new DirectoryEntryViewModel(host, parentViewModel, (DirectoryEntry) fileSystemEntry, postCreate);
     postCreate(result);
     return result;
   }
 }
Beispiel #3
0
        public static FileSystemEntryViewModel Create(
            ICodeSearchController host,
            TreeViewItemViewModel parentViewModel,
            FileSystemEntry fileSystemEntry, Action <FileSystemEntryViewModel> postCreate)
        {
            var fileEntry = fileSystemEntry as FileEntry;

            if (fileEntry != null)
            {
                var result = new FileEntryViewModel(host, parentViewModel, fileEntry);
                postCreate(result);
                return(result);
            }
            else
            {
                var result = new DirectoryEntryViewModel(host, parentViewModel, (DirectoryEntry)fileSystemEntry, postCreate);
                postCreate(result);
                return(result);
            }
        }