public ListPageItem(FileSystemItem genericReference) : this() { try { reference = FileSystemItem.DeriveType(genericReference.Path); if (reference is File) { var fileRef = (File)reference; textFileName.Inlines.Add(new Run(fileRef.GetNameWithoutExtension())); var r = new Run(fileRef.Extension); r.Foreground = Brushes.Gray; textFileName.Inlines.Add(r); } else { textFileName.Inlines.Add(new Run(reference.Name)); } iconBlank.Source = getIcon(reference); } catch (Exception) { textFileName.Text = genericReference.Name; iconBlank.Source = getIcon(); } iconBlank.Visibility = System.Windows.Visibility.Visible; if (genericReference.IsShortcut) { textFileName.FontStyle = FontStyles.Italic; } /*switch (this.ItemType) * { * case ItemTypes.File: * iconBlank.Visibility = System.Windows.Visibility.Visible; * break; * case ItemTypes.Folder: * iconFolder.Visibility = System.Windows.Visibility.Visible; * break; * case ItemTypes.FolderShortcut: * iconFolder.Visibility = System.Windows.Visibility.Visible; * textFileName.FontStyle = FontStyles.Italic; * break; * case ItemTypes.FileShortcut: * iconBlank.Visibility = System.Windows.Visibility.Visible; * textFileName.FontStyle = FontStyles.Italic; * break; * default: * break; * }*/ }
/// <summary> /// Get all concrete folders and jump (shortcuts to folders) /// </summary> /// <param name="path">Path of folder to search inside</param> /// <returns>Returns a list of directories including jumps</returns> public static List <FileSystemItem> Search(string path)//, SearchOptions) { var contents = new List <FileSystemItem>(); // add directories contents.AddRange(getDirs(path)); // add files (conver to links or jumps if they are) foreach (var f in getFiles(path)) { contents.Add(FileSystemItem.DeriveType(f.Path)); } return(contents); }