Exemplo n.º 1
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     try
     {
         //recogemos el capitulo a reproducir
         var     allchapter    = chapterRepo.getAll();
         int     tempSelected  = (int)cmbTemp.SelectedItem;
         string  chapterTitle  = cmbCaps.SelectedItem.ToString();
         Chapter chapterToPlay = chapterRepo.getChapterToPlay(allchapter, serieSelected, tempSelected, chapterTitle).FirstOrDefault();
         //si la pelicula es una URL...
         if (chapterToPlay.Path.Contains("http"))
         {
             //si es un link de youtube abriremos una ventana para reproducir la pelicula
             if (chapterToPlay.Path.Contains("youtube"))
             {
                 VideoOnline v = new VideoOnline(chapterToPlay.Path);
                 v.Show();
             }
             else
             {
                 //sino abriremos el navegador con la url donde se encuentra la pelicula
                 Process.Start(chapterToPlay.Path);
             }
         }
         else
         {
             //y si no es ninguna de las anteriores abrimos el windows media player
             Process.Start("wmplayer", chapterToPlay.Path);
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("No se ha seleccionado capitulo", "Error al reproducir");
     }
 }
Exemplo n.º 2
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     try
     {
         //recogemos la pelicula a reproducir
         var  allFilms   = filmsRepo.GetAll();
         Film filmtoPlay = filmsRepo.GetBytitle(allFilms, filmSelected).FirstOrDefault();
         if (filmtoPlay != null)
         {
             //si la pelicula es una URL...
             if (filmtoPlay.Path.Contains("http"))
             {
                 //si es un link de youtube abriremos una ventana para reproducir la pelicula
                 if (filmtoPlay.Path.Contains("youtube"))
                 {
                     VideoOnline v = new VideoOnline(filmtoPlay.Path);
                     v.Show();
                 }
                 else
                 {
                     //sino abriremos el navegador con la url donde se encuentra la pelicula
                     Process.Start(filmtoPlay.Path);
                 }
             }
             else
             {
                 //y si no es ninguna de las anteriores abrimos el windows media player
                 Process.Start("wmplayer", filmtoPlay.Path);
             }
         }
         else
         {
             MessageBox.Show("No se ha seleccionado ninguna película", "Error");
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("No se ha seleccionado ninguna pelicula", "Error al reproducir");
     }
 }