Пример #1
0
 private void OnEpisodeButtonClicked(object sender, EventArgs e)
 {
     int episode = int.Parse(((Button)sender).Text);
     if (player == null || player.IsDisposed)
     {
         player = new FormJwPlayer();
         player.Open(currentProvider);
         player.EpisodeChange += Player_EpisodeChange;
     }
     
     player.Play(selectedSeason, episode);
 }
Пример #2
0
 private async void CreateAndSelectSeries(string linkExtension)
 {
     if (currentProvider != null)
     {
         this.player = null;
         FormLoadingIndicator.ShowDialog(this, "Loading series. This usually shouldn't take any longer then 30 seconds.");
         int res = await currentProvider.LoadSeriesAsync(linkExtension, comboBoxChangeSeries);
         FormLoadingIndicator.CloseDialog();
         if (res == StreamProvider.RESULT_OK || res == StreamProvider.RESULT_USE_CACHED)
         {
             comboBoxChangeSeries.Invoke((MethodInvoker)(() =>
             {
                 if (currentProvider.GetSeasonCount() != 0) selectedSeason = 1;
                 comboBoxChangeSeries.Items.Insert(comboBoxChangeSeries.Items.Count - 1, currentProvider.GetSeries());
                 comboBoxChangeSeries.SelectedItem = currentProvider.GetSeries();
                 Settings.WriteValue(Settings.LAST_SERIES, currentProvider.GetLinkExtension());
                 Settings.SaveFileSettings();
                 BuildUIForCurrentProvider();
                 HighlightCurrentEpisode(true);
             }));
         }
     }
     flowPanelEpisodeButtons.Invoke((MethodInvoker)(() =>
     {
         flowPanelEpisodeButtons.Focus();
     }));
 }
Пример #3
0
 private void RemoveSeries(Series series)
 {
     downloadToolStripMenuItem.Enabled = false;
     refreshToolStripMenuItem.Enabled = false;
     seriesToolStripMenuItem.Enabled = false;
     Seriescache.RemoveCachedSeries(series);
     comboBoxChangeSeries.Items.Remove(series);
     if (player != null && !player.IsDisposed)
     {
         player.Close();
         player = null;
     }
     currentProvider = null;
     ClearEpisodePanel();
 }
Пример #4
0
        private void TcpServer_NetworkControl(TcpServer source, NetworkControlEventArgs e)
        {
            switch (e.EventId)  //happens always
            {
                case NetworkControlEvent.SkipStart:
                    int newSkipStartValue = e.Data.ReadInt(0);
                    numericUpDownSkipStart.Value = newSkipStartValue;
                    break;
                case NetworkControlEvent.SkipEnd:
                    int newSkipEndValue = e.Data.ReadInt(0);
                    numericUpDownSkipEnd.Value = newSkipEndValue;
                    break;
            }

            if (player != null && !player.IsDisposed && player.IsLoaded)    //player available
            {
                switch (e.EventId)
                {
                    case NetworkControlEvent.PlayPause:
                        Task.Run(async () =>
                        {
                            if (await player.GetIsPlayingAsync())
                            {
                                player.Pause();
                            }
                            else
                            {
                                player.Play();
                            }
                        });
                        break;
                    case NetworkControlEvent.Next:
                        player.Next();
                        break;
                    case NetworkControlEvent.Previous:
                        player.Previous();
                        break;
                    case NetworkControlEvent.PlayEpisode:
                        player.Play(selectedSeason, e.Data.ReadInt(0));
                        break;
                    case NetworkControlEvent.ClosePlayer:
                        player.Close();
                        break;
                    case NetworkControlEvent.SeekTo:
                        int pos = e.Data.ReadInt(0);
                        player.SetPosition(pos);
                        break;
                    case NetworkControlEvent.ToggleFullscreen:
                        player.Maximized = !player.Maximized;
                        break;
                    case NetworkControlEvent.Volume:
                        player.SetVolume(e.Data[0]);
                        break;
                }
            }
            else    //player not available
            {
                switch (e.EventId)
                {
                    case NetworkControlEvent.Volume:
                        Settings.WriteValue(Settings.VOLUME, e.Data[0]);
                        break;
                    case NetworkControlEvent.PlayEpisode:
                        player = new FormJwPlayer();
                        player.Open(currentProvider);
                        player.EpisodeChange += Player_EpisodeChange;
                        player.Play(selectedSeason, e.Data.ReadInt(0));
                        break;
                }
            }
            
        }