private void UpdateFileType()
        {
            Image img = null;

            if (_pli != null)
            {
                img = _pli.GetImageEx(true);
            }

            if (img == null)
            {
                img = ImageProvider.GetIcon(_pli.Path, true);
            }

            tslFileType.Image = img;
            tslFileType.Tag   = _pli;
        }
Пример #2
0
        private void SetItemRelation(ListViewItem lvItem, PlaylistItem plItem)
        {
            if (lvItem != null && plItem != null)
            {
                lvItem.Tag = plItem;
                lvItem.SubItems[colFile.Index].Text = plItem.DisplayName;

                TimeSpan duration = plItem.Duration;
                bool     isActive = IsActiveItem(plItem);

                if (duration.TotalMilliseconds == 0 && isActive)
                {
                    try
                    {
                        duration = TimeSpan.FromSeconds((int)MediaRenderer.DefaultInstance.MediaLength);
                    }
                    catch
                    {
                        duration = TimeSpan.FromMilliseconds(0);
                    }

                    plItem.Duration = duration;
                }

                int      totalSeconds          = (int)(Math.Max(0, duration.TotalSeconds));
                TimeSpan representableDuration = TimeSpan.FromSeconds(totalSeconds);

                if (representableDuration.TotalMilliseconds == 0)
                {
                    lvItem.SubItems[colTime.Index].Text = "";
                }
                else
                {
                    lvItem.SubItems[colTime.Index].Text = duration.ToString();
                }

                lvItem.SubItems[colIcon.Index].Tag = new ExtendedSubItemDetail(plItem.GetImageEx(false), null);
                UpdateMiscIcon(lvItem);
            }
        }
        private void OnLabelMouseHover(object sender, EventArgs args)
        {
            ToolStripLabel lbl = sender as ToolStripLabel;

            if (lbl != null)
            {
                _hoveredItem = lbl;

                if (lbl == tslAudioOn || lbl == tslVideoOn || lbl == tslFilterState)
                {
                    _tip.ShowSimpleToolTip(lbl.Tag as string, lbl.Image);
                }
                else if (lbl == tslFileType)
                {
                    PlaylistItem pli = lbl.Tag as PlaylistItem;
                    if (pli != null)
                    {
                        var mediaInfo = pli.MediaInfo;

                        _tip.ShowToolTip(StringUtils.Limit(pli.DisplayName, 60), mediaInfo, pli.GetImageEx(true),
                                         pli.MediaFileInfo.CustomImage);
                    }
                    else
                    {
                        //Image img = ImageProvider.GetIcon(_mediaName, true);
                        //_tip.ShowSimpleToolTip(_mediaName, img);
                    }
                }
            }
        }
Пример #4
0
        void lvPlaylist_ItemMouseHover(object sender, ListViewItemMouseHoverEventArgs e)
        {
            if (_compactMode)
            {
                return;
            }

            ListViewItem item = e.Item;
            bool         set  = false;
            Point        p    = lvPlaylist.PointToClient(MousePosition);

            try
            {
                if (item != null && MouseButtons == MouseButtons.None)
                {
                    ListViewItem.ListViewSubItem lvsi = item.GetSubItemAt(p.X, p.Y);
                    if (lvsi != null)
                    {
                        ExtendedSubItemDetail esid = lvsi.Tag as ExtendedSubItemDetail;
                        if (esid != null && !string.IsNullOrEmpty(esid.Text))
                        {
                            _ttm.ShowSimpleToolTip(esid.Text, ImageProcessing.Subtitle);
                            set = true;
                        }
                        else
                        {
                            PlaylistItem pli = item.Tag as PlaylistItem;
                            if (pli != null)
                            {
                                pli.Rebuild();

                                Image customImage = pli.MediaFileInfo.CustomImage;

                                _ttm.ShowToolTip(StringUtils.Limit(pli.DisplayName, 60), pli.MediaInfo, pli.GetImageEx(true), customImage);
                                set = true;
                            }
                        }
                    }
                }
            }
            finally
            {
                if (!set)
                {
                    Debug.WriteLine("PL: lvPlaylist_ItemMouseHover no tip to set ...");
                    _ttm.RemoveAll();
                }
            }
        }