Ejemplo n.º 1
0
        private void VideosListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (VideosListView.SelectedItems.Count == 1)
            {
                Database.Types.Video selectedVideo = (Database.Types.Video)VideosListView.SelectedItems[0].Tag;
                string openVideoTip = $"Open video in browser.{Environment.NewLine}{selectedVideo.URL}";

                VideoPictureBox.Image   = Database.ImageFile.Get(selectedVideo.ID, ImageType.VideoThumbnail);
                VideoPictureBox.Visible = true;
                GeneralToolTip.SetToolTip(VideoPictureBox, openVideoTip);
                VideoDescriptionLabel.Text = StringUtils.FormatVideoDescription(selectedVideo.Description);

                VideoLinkLabel.Tag  = selectedVideo.URL;
                VideoLinkLabel.Text = selectedVideo.Title;
                GeneralToolTip.SetToolTip(VideoLinkLabel, openVideoTip);
                PostedLabel.Text   = selectedVideo.Posted.Value.ToString();
                DurationLabel.Text = TimeSpanUtils.ConvertDuration(selectedVideo.Duration);

                VideoInfoPanel.Visible = true;
            }
            else
            {
                VideosListViewChanged();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates a video in <see cref="VideosListView"/> from <see cref="Videos"/> data.
        /// </summary>
        /// <param name="video">Video to update.</param>
        private void UpdateVideoInListView(Database.Types.Video video)
        {
            ListViewItem item = VideosListView.Items.Find(video.ID, false).FirstOrDefault();

            if (item != null)
            {
                Database.Types.Video updatedVideo = Database.Videos.GetByID(video.ID);
                item.Name             = updatedVideo.ID;
                item.Tag              = updatedVideo;
                item.Text             = updatedVideo.Title;
                item.BackColor        = DisplayStatusColor(updatedVideo.WatchStatus);
                item.SubItems[1].Text = updatedVideo.Posted.Value.ToUniversalTime().Humanize();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add a single video to <see cref="VideosListView"/>.
        /// </summary>
        /// <param name="video">Video to add.</param>
        private void AddVideoToListView(Database.Types.Video video)
        {
            ListViewItem videoItem = new ListViewItem {
                Name      = video.ID,
                Tag       = video,
                Text      = $"{video.Title}",
                BackColor = DisplayStatusColor(video.WatchStatus)
            };

            ListViewItem.ListViewSubItem postedDateItem = new ListViewItem.ListViewSubItem {
                Text = video.Posted.Value.ToUniversalTime().Humanize(),
            };
            videoItem.SubItems.Add(postedDateItem);

            VideosListView.Items.Add(videoItem);
        }