private void ThumbListViewItem_VideoSelected(object sender, EventArgs e) { CancelEditMode(); ThumbnailFile tlvi = sender as ThumbnailFile; if (tlvi == null || selectedThumbnail == tlvi) { return; } Deselect(false); selectedThumbnail = tlvi; lastSelectedFile = tlvi.FileName; if (!externalSelection) { // Force focus so the hotkeys can be received. // Select the control so the whole page doesn't jump up to the top when we set focus. tlvi.Select(); this.Focus(); NotificationCenter.RaiseFileSelected(this, tlvi.FileName); } else { this.ScrollControlIntoView(tlvi); } externalSelection = false; }
private void listViews_SelectedIndexChanged(object sender, EventArgs e) { ListView lv = sender as ListView; if (lv == null || lv.SelectedItems.Count != 1) { return; } string file = lv.SelectedItems[0].Tag as string; if (string.IsNullOrEmpty(file)) { return; } foreach (ListViewItem item in lv.Items) { item.BackColor = Color.White; item.ForeColor = Color.Black; } lv.SelectedItems[0].BackColor = SystemColors.Highlight; lv.SelectedItems[0].ForeColor = SystemColors.HighlightText; if (!externalSelection) { NotificationCenter.RaiseFileSelected(this, file); } externalSelection = false; }
private void Deselect(bool raiseEvent) { if (selectedThumbnail == null) { return; } selectedThumbnail.SetUnselected(); selectedThumbnail = null; if (raiseEvent) { NotificationCenter.RaiseFileSelected(this, null); } }
public void Clear() { selectedThumbnail = null; NotificationCenter.RaiseFileSelected(this, null); for (int i = thumbnails.Count - 1; i >= 0; i--) { ThumbnailFile thumbnail = thumbnails[i]; thumbnail.LaunchVideo -= ThumbListViewItem_LaunchVideo; thumbnail.VideoSelected -= ThumbListViewItem_VideoSelected; thumbnail.FileNameEditing -= ThumbListViewItem_FileNameEditing; thumbnails.Remove(thumbnail); this.Controls.Remove(thumbnail); thumbnail.DisposeImages(); thumbnail.Dispose(); } }