Example #1
0
 private void populateMP4()
 {
     Videos.Clear();
     SQLHandler.selectQuery("SELECT * FROM MP4 ORDER BY title ASC");
     if (SQLHandler.read.HasRows)
     {
         MP4 video = new MP4();
         while (SQLHandler.read.Read())
         {
             video          = new MP4();
             video.MP4_ID   = Convert.ToInt16(SQLHandler.read[0]);
             video.Title    = SQLHandler.read[1].ToString();
             video.Location = SQLHandler.read[5].ToString();
             try
             {
                 string[] results = SQLHandler.read[3].ToString().Split(':');
                 int[]    result  = new int[] { Convert.ToInt16(results[0]), Convert.ToInt16(results[1]), Convert.ToInt16(results[2]) };
                 video.Duration = new TimeSpan(result[0], result[1], result[2]);
             }
             catch (Exception) { }
             try
             {
                 video.Plays = Convert.ToInt16(SQLHandler.read[4]);
             }
             catch (Exception) { }
             Videos.Add(video);
         }
     }
     VideoListBox.ItemsSource = Videos;
 }
Example #2
0
 private void VideoListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (MP4)
         {
             MP4 video = (MP4)VideoListBox.SelectedItem;
             VideoPlayer.Source = new Uri(video.Location);
             VideoPlayer.Play();
         }
         else
         {
             MP4 = true;
         }
     }
     catch (Exception)
     { }
 }