internal ArchiveDocumentIcon(Document doc) { InitializeComponent(); // Feed content Archive archive = doc as Archive; if (archive.IsReal == false) { throw new InvalidOperationException("VA cannot be displayed in real archive preview icon."); } System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(archive.Path); List1 = ListFileInfo.PopulateContents(info); // Bookeeping RootPath = info.FullName; CenterList = PageList1; // UI Setup bRoot = true; BackFolderName = info.Name; Path = info.FullName; Current = info; CenterList = PageList1; }
private void BackButton_Click(object sender, RoutedEventArgs e) { System.IO.DirectoryInfo Parent = Current.Parent; if (Current.FullName != RootPath && Parent != null) { // Load if (CenterList.ItemsSource == List1) { List2 = ListFileInfo.PopulateContents(Parent); } else { List1 = ListFileInfo.PopulateContents(Parent); } // Change if (CenterList == PageList1) { PageList2.ItemsSource = (CenterList.ItemsSource == List1) ? List2 : List1; } else { PageList1.ItemsSource = (CenterList.ItemsSource == List1) ? List2 : List1; } // Animate Switch AnimateLeft(CenterList); // UI Setup bRoot = Parent.FullName == RootPath ? true : false; BackFolderName = Parent.Name; Path = Parent.FullName; Current = Parent; } }
private void PageList_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox box = sender as ListBox; ListFileInfo selection = box.SelectedItem as ListFileInfo; // If a file do nothing, If a folder then Generate if (selection != null && selection.Type == ListFileType.Folder) { // Load if (box.ItemsSource == List1) { List2 = ListFileInfo.PopulateContents(selection.Path); } else { List1 = ListFileInfo.PopulateContents(selection.Path); } // Change if (box == PageList1) { PageList2.ItemsSource = (box.ItemsSource == List1) ? List2 : List1; } else { PageList1.ItemsSource = (box.ItemsSource == List1) ? List2 : List1; } // Animation switch AnimateRight(box); // UI Setup bRoot = false; BackFolderName = selection.Name; Path = selection.Path; Current = new System.IO.DirectoryInfo(selection.Path); } }