public void AddFile(CapturedFile capturedFile) { this.capturedFiles.Add(capturedFile); CapturedFileView view = new CapturedFileView(capturedFile); view.SelectAsked += View_Clicked; view.LaunchAsked += View_LaunchAsked; view.LocateAsked += view_LocateAsked; view.HideAsked += View_HideAsked; view.DeleteAsked += View_DeleteAsked; // If we are still aligned with the first image, we keep updating the first visible, // otherwise we keep things as is. bool alignedToFirst = capturedFileViews.Count == 0 || first == capturedFileViews.Count - 1; capturedFileViews.Add(capturedFile.Time, view); this.Controls.Add(view); if (alignedToFirst) { first++; spotWidth = view.Width + margin; } RecomputeSpots(); LayoutThumbnails(); Invalidate(); }
/// <summary> /// Disposes resources used by the control. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } for (int i = capturedFiles.Count - 1; i >= 0; i--) { CapturedFile capturedFile = capturedFiles[i]; Control control = capturedFileViews[capturedFile.Time]; this.Controls.Remove(control); control.Dispose(); capturedFileViews.Remove(capturedFile.Time); capturedFiles.Remove(capturedFile); capturedFile.Dispose(); } } base.Dispose(disposing); }
public CapturedFileView(CapturedFile capturedFile) { this.capturedFile = capturedFile; InitializeComponent(); this.BackColor = Color.FromArgb(255, 44, 44, 44); lblFilename.Text = capturedFile.Filename; tbFilename.KeyDown += tbFilename_KeyDown; tbFilename.MouseEnter += Controls_MouseEnter; tbFilename.MouseLeave += Controls_MouseLeave; btnClose = new EmbeddedButton(Properties.Capture.thumb_close, this.Width - Properties.Capture.thumb_close.Width - 2, 2); btnClose.Click += btnClose_Click; buttons.Add(btnClose); BuildContextMenus(); ReloadMenusCulture(); }
private void HideCapturedFileView(CapturedFile capturedFile) { bool alignedToFirst = first == capturedFileViews.Count - 1; this.Controls.Remove(capturedFileViews[capturedFile.Time]); capturedFileViews.Remove(capturedFile.Time); capturedFiles.Remove(capturedFile); capturedFile.Dispose(); if (alignedToFirst) { first--; } RecomputeSpots(); LayoutThumbnails(); Invalidate(); }
public void AddFile(CapturedFile capturedFile) { bool known = capturedFiles.Any(c => c.Filename == capturedFile.Filename); if (known) { return; } this.capturedFiles.Add(capturedFile); if (capturedFiles.Count > PreferencesManager.FileExplorerPreferences.MaxRecentCapturedFiles) { HideCapturedFileView(capturedFiles[0]); } CapturedFileView view = new CapturedFileView(capturedFile); view.LaunchAsked += View_LaunchAsked; view.LaunchWatcherAsked += View_LaunchWatcherAsked; view.LocateAsked += view_LocateAsked; view.SelectAsked += View_Clicked; view.HideAsked += View_HideAsked; view.DeleteAsked += View_DeleteAsked; // If we are still aligned with the first image, we keep updating the first visible, // otherwise we keep things as is. bool alignedToFirst = capturedFileViews.Count == 0 || first == capturedFileViews.Count - 1; capturedFileViews.Add(capturedFile.Time, view); this.Controls.Add(view); if (alignedToFirst) { first++; spotWidth = view.Width + margin; } RecomputeSpots(); LayoutThumbnails(); Invalidate(); }
public void AddFile(string filename, Bitmap image, bool video, ImageRotation rotation) { CapturedFile capturedFile = new CapturedFile(filename, image, video, rotation); view.AddFile(capturedFile); }
public void AddFile(string filename, Bitmap image, bool video) { CapturedFile capturedFile = new CapturedFile(filename, image, video); view.AddFile(capturedFile); }