//---------------------------------------------------------------------------------------------------------------------- public override void FindChields() { foreach (DriveInfo drive in DriveInfo.GetDrives()) { DiskElementViewModel item = new DiskElementViewModel(drive); Chields.Add(item); } }
//---------------------------------------------------------------------------------------------------------------------- public override void FindChields() { if (drive.IsReady) { foreach (DirectoryInfo dir in drive.RootDirectory.GetDirectories()) { DirectoryElementViewModel item = new DirectoryElementViewModel(dir); Chields.Add(item); } } }
//---------------------------------------------------------------------------------------------------------------------- public override void FindChields() { try { foreach (DirectoryInfo dir in directory.GetDirectories()) { DirectoryElementViewModel item = new DirectoryElementViewModel(dir); Chields.Add(item); } } catch (UnauthorizedAccessException e) { Console.Write(e.Message); } catch (DirectoryNotFoundException ed) { Console.Write(ed.Message); } }