/// <summary>
        /// Creates a
        /// <see cref="CpMediaItem"/>
        /// object, given a metadata instantiation
        /// block.
        /// </summary>
        /// <param name="info">
        /// The metadata to use when instantiating the media.
        /// </param>
        /// <returns>a new media item</returns>
        public static CpMediaItem CreateItem(MediaBuilder.item info)
        {
            CpMediaItem newObj = new CpMediaItem();

            MediaBuilder.SetObjectProperties(newObj, info);
            return(newObj);
        }
        /// <summary>
        /// Call this method if a spider is no longer interested in an object
        /// that was earlier marked as being of interest to this spider.
        /// </summary>
        /// <param name="obj"></param>
        private void DecrementMatch(ICpMedia obj)
        {
            CpMediaContainer cpc = obj as CpMediaContainer;
            CpMediaItem      cpi = obj as CpMediaItem;

            if (cpc != null)
            {
                cpc.DecrementSpiderMatches();
            }
            else if (cpi != null)
            {
                cpi.DecrementSpiderMatches();
            }
        }
        private void deleteMediaMenuItem_Click(object sender, System.EventArgs e)
        {
            if (mediaListView.SelectedItems.Count == 0) return;

            if (MessageBox.Show(this,"Delete selected media items permanently?","Delete Media",MessageBoxButtons.YesNo,MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                lock (mediaListView)
                {
                    CpMediaItem[] medias = new CpMediaItem[mediaListView.SelectedItems.Count];
                    int i = 0;
                    foreach (ListViewItem li in mediaListView.SelectedItems)
                    {
                        medias[i] = (CpMediaItem)mediaListView.SelectedItems[i].Tag;
                        i++;
                    }

                    foreach (CpMediaItem item in medias)
                    {
                        item.RequestDestroyObject(null,new CpMediaDelegates.Delegate_ResultDestroyObject(ResultDestroyObjectSink));
                    }
                }
            }
        }
 public void PopupRendererForm(AVRenderer renderer, CpMediaItem[] playmedias)
 {
     if (rendererFormTable.ContainsKey(renderer) == true)
     {
         RendererControlForm form = (RendererControlForm)rendererFormTable[renderer];
         if (playmedias != null) form.SetupConnection(playmedias);
         form.Activate();
     }
     else
     {
         RendererControlForm form = new RendererControlForm(this,renderer,null);
         rendererFormTable.Add(renderer,form);
         if (playmedias != null) form.SetupConnection(playmedias);
         form.Show();
     }
 }
        private void PlayMediaMenuSelectedSink(object sender, EventArgs e)
        {
            if (mediaListView.SelectedItems.Count > 0)
            {
                AVRenderer selectedSendToRenderer = (AVRenderer)PlayToRendererMenuItemMapping[sender];

                lock (mediaListView)
                {
                    CpMediaItem[] medias = new CpMediaItem[mediaListView.SelectedItems.Count];
                    int i = 0;
                    foreach (ListViewItem li in mediaListView.SelectedItems)
                    {
                        medias[i] = (CpMediaItem)mediaListView.SelectedItems[i].Tag;
                        i++;
                    }

                    PopupRendererForm(selectedSendToRenderer,medias);
                }
            }
            else if (m_SelectedContainer != null)
            {
                AVRenderer selectedSendToRenderer = (AVRenderer)PlayToRendererMenuItemMapping[sender];
                PopupRendererForm(selectedSendToRenderer, m_SelectedContainer);
            }
        }
 /// <summary>
 /// Creates a 
 /// <see cref="CpMediaItem"/>
 /// object, given a metadata instantiation
 /// block.
 /// </summary>
 /// <param name="info">
 /// The metadata to use when instantiating the media.
 /// </param>
 /// <returns>a new media item</returns>
 public static CpMediaItem CreateItem(MediaBuilder.item info)
 {
     CpMediaItem newObj = new CpMediaItem();
     MediaBuilder.SetObjectProperties(newObj, info);
     return newObj;
 }
 private void classTypePictureBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (item != null)
     {
         CpMediaItem[] items = new CpMediaItem[1];
         items[0] = item;
         classTypePictureBox.DoDragDrop(items, DragDropEffects.Copy | DragDropEffects.Move);
     }
 }