示例#1
0
 public static ImageSource GetImageSource(string directory, ItemState folderType)
 {
     try
     {
         return(FolderManager.GetImageSource(directory, new Size(16, 16), folderType));
     }
     catch
     {
         throw;
     }
 }
示例#2
0
 public FileSystemObjectInfo(FileSystemInfo info)
 {
     if (this is DummyFileSystemObjectInfo)
     {
         return;
     }
     this.Children       = new ObservableCollection <FileSystemObjectInfo>();
     this.FileSystemInfo = info;
     if (info is DirectoryInfo)
     {
         this.ImageSource = FolderManager.GetImageSource(info.FullName, ItemState.Close);
         this.AddDummy();
     }
     else if (info is FileInfo)
     {
         this.ImageSource = FileManager.GetImageSource(info.FullName);
     }
     this.PropertyChanged += FileSystemObjectInfo_PropertyChanged;
 }
示例#3
0
 void FileSystemObjectInfo_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (this.FileSystemInfo is DirectoryInfo)
     {
         if (string.Equals(e.PropertyName, "IsExpanded", StringComparison.CurrentCultureIgnoreCase))
         {
             if (this.IsExpanded)
             {
                 this.ImageSource = FolderManager.GetImageSource(this.FileSystemInfo.FullName, ItemState.Open);
                 if (this.HasDummy())
                 {
                     this.RemoveDummy();
                     this.ExploreDirectories();
                     this.ExploreFiles();
                 }
             }
             else
             {
                 this.ImageSource = FolderManager.GetImageSource(this.FileSystemInfo.FullName, ItemState.Close);
             }
         }
     }
 }