public override void GetRootFoldersAsync(Action <IEnumerable <IFolder> > callback) { ObservableCollection <IFolder> roots = new ObservableCollection <IFolder>(); LocalRootFolder pcFolder = new LocalRootFolder(); roots.Add(pcFolder); IList <string> personPaths = new List <string>() { Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), Environment.GetFolderPath(Environment.SpecialFolder.Personal), Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) }; LocalVirtualFolder personFolder = null; foreach (var path in personPaths) { DataSourceShell item = GetShellItem(path); if (!item.IsNull()) { using (item) { personFolder = new LocalVirtualFolder(item); roots.Add(personFolder); } break; } } if (!personFolder.IsNull()) { pcFolder.GetItemAsync(personFolder.FullPath, (item) => { if (!item.IsNull() && (item is IFolder)) { personFolder.RealFolder = item as IFolder; personFolder.IsExpanded = true; } }); } if (!callback.IsNull()) { callback(roots); } }
public LocalVirtualFolder(DataSourceShell shellItem) : base(string.Empty, null) { if (shellItem.IsNull()) { throw new ArgumentNullException(); } this.Name = shellItem.DisplayName; this.Icon = shellItem.Icon; this.FullPath = shellItem.Path; this.IsCheckVisible = false; this.Parent = this; }