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; } }
private void cmdBack_Click(object sender, RoutedEventArgs e) { if (RecentFolders.Count > 1) { //AddToRecent = false; FutureFolders.Push(RecentFolders.Pop()); // top of stack is current folder ClearFuture = false; CurrentFolder = RecentFolders.Pop(); ClearFuture = true; //AddToRecent = true; } }
void PopulateView() { CurrentItems.Clear(); System.Drawing.Icon icon; icon = Etier.IconHelper.IconReader.GetFolderIcon(Etier.IconHelper.IconReader.IconSize.Small, Etier.IconHelper.IconReader.FolderType.Closed); try { foreach (string s in Directory.EnumerateDirectories(CurrentFolder)) { FSItemVM info = new FSItemVM() { FullPath = s, DisplayName = System.IO.Path.GetFileName(s), type = FSItemType.Folder, DisplayIcon = Etier.IconHelper.IconReader.GetFolderIcon(s, Etier.IconHelper.IconReader.IconSize.Small, Etier.IconHelper.IconReader.FolderType.Closed).ToImageSource() }; CurrentItems.Add(info); } } catch (Exception) {} try { foreach (string s in Directory.EnumerateFiles(CurrentFolder)) { FSItemVM info = new FSItemVM() { FullPath = s, DisplayName = System.IO.Path.GetFileName(s), type = FSItemType.File }; try { icon = Etier.IconHelper.IconReader.GetFileIcon(info.FullPath, Etier.IconHelper.IconReader.IconSize.Small, false); info.DisplayIcon = icon.ToImageSource(); } catch (Exception) { info.DisplayIcon = null; } CurrentItems.Add(info); } } catch (Exception) { } if (RecentFolders.Count == 0 || String.Compare(CurrentFolder, RecentFolders.Last()) != 0) { RecentFolders.Push(CurrentFolder); } if (ClearFuture) { FutureFolders.Clear(); } }
public void AddRecentFolder(string folder) { if (string.IsNullOrEmpty(folder)) { return; } folder = folder.TrimEnd('\\'); var matchList = RecentFolders.Where(f => f.ToLower().Contains(folder.ToLower()) || !Directory.Exists(f)).ToList(); for (var index = 0; index < matchList.Count; index++) { RecentFolders.Remove(matchList[index]); } RecentFolders.Insert(0, folder); RecentFolders = RecentFolders.Take(mmApp.Configuration.RecentDocumentsLength).ToList(); }
private void OpenFolderInternal(string folder) { int total = 0; var files = new List <FileStreamsViewModel>(); foreach (var filename in Directory.EnumerateFiles(folder)) { total++; try { var file = FindStreams(filename); if (file == null) { continue; } files.Add(file); } catch (Win32Exception) { } } if (files.Count == 0) { MessageBoxService.ShowMessage($"No streams found in any of the {total} files.", Constants.Title, MessageBoxButton.OK, MessageBoxImage.Information); } else { var folderViewModel = new FolderViewModel(this, folder, files.ToArray()); //Tabs.Add(folderViewModel); var tab = AddTab(folderViewModel); RecentFolders.Remove(folder); RecentFolders.Insert(0, folder); if (RecentFolders.Count > 9) { RecentFolders.RemoveAt(9); } SelectedTab = tab; } }
/// <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(); } } } }