public static ComboBoxItem[] GetButtonsForDriveSwitcher() { DriveInfo[] disks = AnalyzerFileSystem.GetAllLogicDisk(); ComboBoxItem[] buttonItems = new ComboBoxItem[disks.Length]; for (int i = 0; i < disks.Length; i++) { buttonItems[i] = new ComboBoxItem() { Content = disks[i].Name }; } return(buttonItems); }
/// <summary> /// Возвращает массив элементов дерева, заполненый логическими дисками. /// </summary> /// <returns>Массив элементов дерева</returns> private static TreeViewButton[] MakeTreeViewButtonsForLogicalDrives() { DriveInfo[] disks = AnalyzerFileSystem.GetAllLogicDisk(); TreeViewButton[] items = new TreeViewButton[disks.Length]; for (int i = 0; i < disks.Length; i++) { items[i] = new TreeViewButton(disks[i].Name) { Width = 150 }; items[i].ButtonForTreeView.Content = disks[i] + disks[i].VolumeLabel; } return(items); }