public void Forward() { if (FutureFolders.Count > 0) { ClearFuture = false; FV.CurrentFolder = FutureFolders.Pop(); ClearFuture = true; } }
public void Back() { if (RecentFolders.Count > 1) { FutureFolders.Push(RecentFolders.Pop()); // top of stack is always last valid folder ClearFuture = false; FV.CurrentFolder = RecentFolders.Pop(); ClearFuture = true; } }
/// <summary> /// Fills the ListView, or rather CurrentItems /// </summary> public void PopulateView() { CurrentItems.Clear(); if (!Directory.Exists(FV.CurrentFolder)) { return; } try { DirectoryInfo cur = new DirectoryInfo(FV.CurrentFolder); ImageSource dummy = new BitmapImage(); if (FV.ShowFolders) { foreach (DirectoryInfo dir in cur.GetDirectories()) { if (!FV.ShowHidden && dir.Attributes.HasFlag(FileAttributes.Hidden)) { continue; } FSItemVM info = new FSItemVM() { FullPath = dir.FullName, DisplayName = dir.Name, type = FSItemType.Folder }; if (!FV.ShowIcons) { info.DisplayIcon = dummy; // to prevent the icon from being loaded from file later } CurrentItems.Add(info); } } string FilterString = "*"; if (FV.FilterIndex >= 0 && FV.FilterIndex < FilterCount) { FilterString = FilterList[FV.FilterIndex].ToString(); } foreach (var CurFilterString in FilterString.Split(';')) { foreach (FileInfo f in cur.EnumerateFiles(CurFilterString)) { if (!FV.ShowHidden && f.Attributes.HasFlag(FileAttributes.Hidden)) { continue; } FSItemVM info = new FSItemVM() { FullPath = f.FullName, DisplayName = f.Name, //System.IO.Path.GetFileName(s), type = FSItemType.File }; if (!FV.ShowIcons) { info.DisplayIcon = dummy; // to prevent the icon from being loaded from file later } CurrentItems.Add(info); } } } catch (Exception) { } // reset column width manually (otherwise it is not updated) FV.TheGVColumn.Width = FV.TheGVColumn.ActualWidth; FV.TheGVColumn.Width = Double.NaN; if (RecentFolders.Count == 0 || String.Compare(FV.CurrentFolder, RecentFolders.Last()) != 0) { if (Directory.Exists(FV.CurrentFolder)) { RecentFolders.Push(FV.CurrentFolder); if (ClearFuture) { FutureFolders.Clear(); } } } }