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