Ejemplo n.º 1
0
 private void PlayWorker(object sender, PlexDL.WaitWindow.WaitWindowEventArgs e)
 {
     if (!mPlayer.Playing)
     {
         string FileName = (string)e.Arguments[0];
         StartPlayer(FileName);
         SetIconPause();
     }
 }
Ejemplo n.º 2
0
        private void GetObjectFromIndexCallback(object sender, PlexDL.WaitWindow.WaitWindowEventArgs e)
        {
            int index = (int)e.Arguments[0];

            e.Result = GetObjectFromIndexWorker(index);
        }
Ejemplo n.º 3
0
        private void LoadWorker(object sender, PlexDL.WaitWindow.WaitWindowEventArgs e)
        {
            if (StreamingContent.ContentGenre != "")
            {
                if (lblGenreValue.InvokeRequired)
                {
                    lblGenreValue.BeginInvoke((MethodInvoker) delegate
                    {
                        lblGenreValue.Text = StreamingContent.ContentGenre;
                    });
                }
                else
                {
                    lblGenreValue.Text = StreamingContent.ContentGenre;
                }
            }
            if (StreamingContent.ContentDuration != 0)
            {
                if (lblRuntimeValue.InvokeRequired)
                {
                    lblRuntimeValue.BeginInvoke((MethodInvoker) delegate
                    {
                        lblRuntimeValue.Text = Common.Methods.CalculateTime(StreamingContent.ContentDuration);
                    });
                }
                else
                {
                    lblRuntimeValue.Text = Common.Methods.CalculateTime(StreamingContent.ContentDuration);
                }
            }
            if (StreamingContent.StreamInformation.ByteLength != 0)
            {
                if (lblSizeValue.InvokeRequired)
                {
                    lblSizeValue.BeginInvoke((MethodInvoker) delegate
                    {
                        lblSizeValue.Text = Common.Methods.FormatBytes(StreamingContent.StreamInformation.ByteLength);
                    });
                }
                else
                {
                    lblSizeValue.Text = Common.Methods.FormatBytes(StreamingContent.StreamInformation.ByteLength);
                }
            }
            if (StreamingContent.StreamResolution.Height != 0)
            {
                if (lblResolutionValue.InvokeRequired)
                {
                    lblResolutionValue.BeginInvoke((MethodInvoker) delegate
                    {
                        lblResolutionValue.Text = StreamingContent.StreamResolution.ResolutionString();
                    });
                }
                else
                {
                    lblResolutionValue.Text = StreamingContent.StreamResolution.ResolutionString();
                }
            }
            if (StreamingContent.StreamPosterUri != "")
            {
                if (picPoster.InvokeRequired)
                {
                    picPoster.BeginInvoke((MethodInvoker) delegate
                    {
                        picPoster.BackgroundImage = Common.Methods.getImageFromUrl(StreamingContent.StreamPosterUri);
                    });
                }
                else
                {
                    picPoster.BackgroundImage = Common.Methods.getImageFromUrl(StreamingContent.StreamPosterUri);
                }
            }
            if (StreamingContent.StreamInformation.Container != "")
            {
                if (lblContainerValue.InvokeRequired)
                {
                    lblContainerValue.BeginInvoke((MethodInvoker) delegate
                    {
                        lblContainerValue.Text = StreamingContent.StreamInformation.Container;
                    });
                }
                else
                {
                    lblContainerValue.Text = StreamingContent.StreamInformation.Container;
                }
            }
            foreach (PlexActor a in StreamingContent.Actors)
            {
                Panel p = new Panel()
                {
                    Size      = new Size(358, 125),
                    Location  = new Point(3, 3),
                    BackColor = Color.White
                };
                Label lblActorName = new Label()
                {
                    Text     = a.ActorName,
                    AutoSize = true,
                    Location = new Point(88, 3),
                    Font     = new Font(FontFamily.GenericSansSerif, 13),
                    Visible  = true
                };

                MaterialLabel lblActorRole = new MaterialLabel()
                {
                    Text     = a.ActorRole,
                    AutoSize = true,
                    Location = new Point(112, 29),
                    Visible  = true
                };
                PictureBox actorPortrait = new PictureBox()
                {
                    Size     = new Size(79, 119),
                    Location = new Point(3, 3),
                    BackgroundImageLayout = ImageLayout.Stretch,
                    BackgroundImage       = Common.Methods.getImageFromUrl(a.ThumbnailUri),
                    Visible = true
                };
                p.Controls.Add(lblActorRole);
                p.Controls.Add(lblActorName);
                p.Controls.Add(actorPortrait);

                if (flpActors.InvokeRequired)
                {
                    flpActors.BeginInvoke((MethodInvoker) delegate
                    {
                        flpActors.Controls.Add(p);
                    });
                }
                else
                {
                    flpActors.Controls.Add(p);
                }
            }

            //no actors, so tell the user with a dud panel
            if (flpActors.Controls.Count == 0)
            {
                if (flpActors.InvokeRequired)
                {
                    flpActors.BeginInvoke((MethodInvoker) delegate
                    {
                        flpActors.Controls.Add(NoActorsFound());
                    });
                }
                else
                {
                    flpActors.Controls.Add(NoActorsFound());
                }
            }

            //apply content title and enable VLC streaming
            if (this.InvokeRequired)
            {
                this.BeginInvoke((MethodInvoker) delegate
                {
                    btnStreamInVLC.Visible = true;
                    this.Text = StreamingContent.StreamInformation.ContentTitle;
                    this.Refresh();
                });
            }
            else
            {
                btnStreamInVLC.Visible = true;
                this.Text = StreamingContent.StreamInformation.ContentTitle;
                this.Refresh();
            }
        }