private StackPanel CreateUpOneDirectory() { var sp = new StackPanel(); sp.Margin = new Thickness(5); sp.Width = 50; var label = new TextBlock(); label.Text = "Up one directory"; label.TextWrapping = TextWrapping.Wrap; label.TextAlignment = TextAlignment.Center; var img = new Image(); img.Width = 42; img.Height = 42; img.Source = FileSkimmerBackend.GetImage("__upone").ToBitmapImage(); sp.Children.Add(img); sp.Children.Add(label); sp.PreviewMouseLeftButtonDown += (o, a) => { if (a.ClickCount == 2) { GoUp(); } }; return(sp); }
public DownloadControl(int index) { InitializeComponent(); var d = DownloadManager.Downloads[index]; lbshiftneturl.Text = d.ShiftnetUrl; pcicon.Image = FileSkimmerBackend.GetImage(d.Destination); int bytesTransferred = 0; pgprogress.Maximum = DownloadManager.Downloads[index].Bytes.Length; pgprogress.Value = DownloadManager.Downloads[index].Progress; DownloadManager.ProgressUpdate += (i, p) => { try { this.Invoke(new Action(() => { if (i == index) { bytesTransferred += 256; pgprogress.Value = bytesTransferred; lbshiftneturl.Text = $@"{d.ShiftnetUrl} {bytesTransferred} B out of {d.Bytes.Length} B transferred at {DownloadManager.GetDownloadSpeed()} B per second. To {d.Destination}"; pgprogress.Maximum = d.Bytes.Length; } })); } 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)) { if (dir.EndsWith(filter.SelectedItem.ToString())) { 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) { if (OpenerStyle == FileOpenerStyle.Open) { Callback?.Invoke(dir); AppearanceManager.Close(this); } } else { txtfilename.Text = Utils.GetFileInfo(dir).Name; } }; lbfiles.Children.Add(sp); } } } }