public static void PastFileOrFolderToContentArea(string pathToCopy) { string path = AnalyzerFileSystem.GetPathFileOrFolderOfClipboard(); if (File.Exists(path)) { AnalyzerFileSystem.CopyFile(path, pathToCopy); } else if (Directory.Exists(path)) { AnalyzerFileSystem.CopyFile(path, pathToCopy); } }
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); }
/// <summary> /// Возвращает панель заполненную файлами и папками по указанной позиции АФС. /// </summary> /// <param name="numberPosition">Позиция АФС</param> /// <returns>Панель заполненную элементами</returns> public static WrapPanel GetPanelWithFoldersAndFilesForContentArea(sbyte numberPosition) { string[] namesDirectories = AnalyzerFileSystem.GetDirectoriesNameFromPosition(numberPosition); string[] namesFiles = AnalyzerFileSystem.GetFilesNameFromPosition(numberPosition); WrapPanel panelWithFoldersAndFiles = new WrapPanel(); #region Filling the panel with elements for (int i = 0; i < namesDirectories.Length; i++) { panelWithFoldersAndFiles.Children.Add(new ContentElementButton(numberPosition) { Text = namesDirectories[i], typeContentElement = TypeContentElement.folder, PathContentElement = $@"{AnalyzerFileSystem.GetPosition(numberPosition)}\{namesDirectories[i]}" }); } for (int i = 0; i < namesFiles.Length; i++) { ContentElementButton button = new ContentElementButton(numberPosition) { Text = namesFiles[i], typeContentElement = TypeContentElement.file, PathContentElement = $@"{AnalyzerFileSystem.GetPosition(numberPosition)}\{namesFiles[i]}" }; FileInfo file = new FileInfo(button.PathContentElement); button.ImageFolder.Source = GetIconForFile(file.Extension, button.PathContentElement); panelWithFoldersAndFiles.Children.Add(button); } #endregion return(panelWithFoldersAndFiles); }