private void FileBtn_Click(object sender, RoutedEventArgs e) { FileButton btn = sender as FileButton; if ((btn.info.Attributes & FileAttributes.Directory) == FileAttributes.Directory) { DirectoryInfo dir = new DirectoryInfo(btn.info.FullName); WrapPanel wrap = btn.Parent as WrapPanel; wrap.Children.Clear(); Populate(Tabs.SelectedItem as CloseableTab, dir); Title = btn.info.Name; } else { Process.Start(btn.info.FullName); } }
/* * @param tab Closeable tab to populate * @param info DirectoryInfo object to get all the file and directory info from. */ private void Populate(CloseableTab tab, DirectoryInfo info) { // TO DO: // Account for forbidden folders/files // Add caching in some form. // tab.Title = info.Name; LocationBox.Text = info.FullName; tab.Panel.Children.Clear(); foreach (FileSystemInfo file in info.GetFileSystemInfos()) { FileButton btn = new FileButton(file, config); btn.MouseEnter += FileBtn_MouseEnter; btn.MouseLeave += FileBtn_MouseLeave; btn.Click += FileBtn_Click; tab.Panel.Children.Add(btn); } }