예제 #1
0
        private void InternalAdd(string category)
        {
            // Running on background thread

            if (category == "TEST")
            {
                for (int i = 0; i < 20; i++)
                {
                    this.BeginInvoke(new Action<Image, string, string, long>(InternalAdd),
                        MediaServiceClient.Properties.Resources.no_image, "Test", "Test", -1);
                }
                this.BeginInvoke((MethodInvoker)delegate { pictureBox1.Visible = false; });
                return;
            }

            LibMediaServiceCommon.SearchMedia search = new LibMediaServiceCommon.SearchMedia();

            // For now to test return the search (max out at 20).
            List<LibMediaServiceCommon.DTO.MediaInfo> searchResults = search.Search("", category);

            foreach (LibMediaServiceCommon.DTO.MediaInfo movie in searchResults)
            {
                string movieOneName = movie.MediaName;
                string movieOneStoryLine = movie.StoryLine.Trim();
                long mediaId = movie.IdMediaInfo;

                // ***********************

                string imageLocation = LibMediaServiceCommon.Downloads.Instance.MediaAddress + "/" + movie.CoverArtLocation.Trim();

                this.BeginInvoke(new Action<string, string, string, long>(InternalAdd),
                    imageLocation, movieOneStoryLine, movieOneName, mediaId);

            }

            this.BeginInvoke((MethodInvoker)delegate { pictureBox1.Visible = false; });
        }
예제 #2
0
        /// <summary>
        /// When an item is clicked attempt to play the video.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ctrl_Click(object sender, EventArgs e)
        {
            if ((Control)sender is CarouselItems)
            {

                this.Parent.Hide();

                try
                {

                    CarouselItems b = (CarouselItems)sender;
                    VideoInfo v = (VideoInfo)b.Tag;
                    LibMediaServiceCommon.SearchMedia search = new LibMediaServiceCommon.SearchMedia();

                    if (v.MediaInfoId == -1)
                    {
                        throw new Exception("No media files to search for.  MediaId is set to -1.");
                    }

                    string url = LibMediaServiceCommon.Downloads.Instance.MediaAddress + "/" + search.Search(v.MediaInfoId);
                    MediaPlayer.Player dlg = new MediaPlayer.Player(url, true, true, true);
                    dlg.ShowDialog();
                }
                catch (Exception ex)
                {
                    LibMediaServiceCommon.Logging.Instance.WriteLine(ex);
                }
                this.Parent.Show();
            }
        }