/// <summary> /// Set the selected or all video(s) status. /// </summary> /// <param name="status">Status to set the video to.</param> private void SetStatus(WatchStatus status) { if (ModifierKeys == Keys.Shift) { if (MessageBox.Show($"Really mark all videos as {status.ToString()}?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { VideosListView.BeginUpdate(); foreach (ListViewItem item in VideosListView.Items) { if (((Database.Types.Video)item.Tag).WatchStatus != status) { Database.Videos.SetStatus(item.Name, status); UpdateVideoInListView((Database.Types.Video)item.Tag); } } VideosListView.EndUpdate(); } } else { if (VideosListView.SelectedItems.Count == 1) { ListViewItem selectedItem = VideosListView.SelectedItems[0]; Database.Videos.SetStatus(selectedItem.Name, status); UpdateVideoInListView((Database.Types.Video)selectedItem.Tag); } } }
/// <summary> /// Add all videos to <see cref="VideosListView"/> from <see cref="Channels.GetAllVideos(string)"/>. /// Clears all existing videos already in the listview (if any). /// </summary> /// <param name="channelID">Channel ID to add the videos from.</param> public void AddChannelVideos(string channelID) { VideosListView.BeginUpdate(); VideosListView.Items.Clear(); IEnumerable <Database.Types.Video> videos = Database.Channels.GetAllVideos(channelID).OrderByDescending(v => v.Posted); foreach (Database.Types.Video video in videos) { AddVideoToListView(video); } VideosListView.Columns[PostedColumn.Index].TextAlign = HorizontalAlignment.Right; VideosListView.EndUpdate(); }
/// <summary> /// Add all channels to <see cref="ChannelsListView"/> from <see cref="Channels.GetAll()"/>. /// Clears all existing channels already in the listview (if any). /// </summary> public void AddAllChannels() { ChannelsListView.BeginUpdate(); VideosListView.BeginUpdate(); ChannelsListView.Items.Clear(); VideosListView.Items.Clear(); ChannelsListViewChanged(); foreach (Database.Types.Channel channel in Database.Channels.GetAll()) { AddChannelToListView(channel); } ChannelsListView.EndUpdate(); VideosListView.EndUpdate(); }