private void lvitems_DoubleClick(object sender, EventArgs e) { if (lvitems.SelectedItems.Count <= 0) { return; } var item = lvitems.SelectedItems[0]; var path = item.Tag as string; if (currentdir == "__system") { ChangeDirectory(path); } else if (DirectoryExists(currentdir + "/" + path)) { ChangeDirectory(currentdir + "/" + path); } else if (FileExists(currentdir + "/" + path)) { FileSkimmerBackend.OpenFile(currentdir + "/" + path); } else if (path == "__..") { ChangeToParent(); } }
private void pinnedItems_Click(object sender, EventArgs e) { try { if (pinnedItems.SelectedNode != null) { string path = pinnedItems.SelectedNode.Tag.ToString(); if (DirectoryExists(path)) { currentdir = path; ResetList(); } else if (FileExists(path)) { FileSkimmerBackend.OpenFile(path); } } } catch { } }
public void Reset() { if (currentFolder != "__system") { this.SetTitle("File Skimmer - " + currentFolder); } else { this.SetTitle("File Skimmer"); } lbfiles.Children.Clear(); if (currentFolder == "__system") { foreach (var dir in Utils.Mounts) { var sp = new StackPanel(); sp.Width = 50; sp.Margin = new Thickness(5); var label = new TextBlock(); label.Text = dir.Name; label.TextWrapping = TextWrapping.Wrap; label.TextAlignment = TextAlignment.Center; var img = new Image(); img.Width = 42; img.Height = 42; img.Source = FileSkimmerBackend.GetImage(Utils.Mounts.IndexOf(dir) + ":").ToBitmapImage(); sp.Children.Add(img); sp.Children.Add(label); sp.PreviewMouseLeftButtonDown += (o, a) => { if (a.ClickCount == 2) { ChangeDirectory(Utils.Mounts.IndexOf(dir) + ":"); } }; lbfiles.Children.Add(sp); } } else { var __up = CreateUpOneDirectory(); lbfiles.Children.Add(__up); foreach (var dir in Utils.GetDirectories(currentFolder)) { var sp = new StackPanel(); sp.Margin = new Thickness(5); sp.Width = 50; var label = new TextBlock(); label.Text = Utils.GetDirectoryInfo(dir).Name; label.TextWrapping = TextWrapping.Wrap; label.TextAlignment = TextAlignment.Center; var img = new Image(); img.Width = 42; img.Height = 42; img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); sp.Children.Add(img); sp.Children.Add(label); sp.PreviewMouseLeftButtonDown += (o, a) => { if (a.ClickCount == 2) { ChangeDirectory(dir); } }; lbfiles.Children.Add(sp); } foreach (var dir in Utils.GetFiles(currentFolder)) { var sp = new StackPanel(); sp.Margin = new Thickness(5); sp.Width = 50; var label = new TextBlock(); label.Text = Utils.GetFileInfo(dir).Name; label.TextWrapping = TextWrapping.Wrap; label.TextAlignment = TextAlignment.Center; var img = new Image(); img.Width = 42; img.Height = 42; img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); sp.Children.Add(img); sp.Children.Add(label); sp.PreviewMouseLeftButtonDown += (o, a) => { if (a.ClickCount == 2) { FileSkimmerBackend.OpenFile(dir); } }; lbfiles.Children.Add(sp); } } }
public void Open(string path) { FileSkimmerBackend.OpenFile(path); }