Example #1
0
 private void BtPrevious_Click(object sender, RoutedEventArgs e)
 {
     if (isLibrary)
     {
         if (LvLibrary.SelectedIndex > 0)
         {
             LvLibrary.SelectedIndex--;
         }
         LvLibrary.Focus();
     }
     else if (isPlaylist)
     {
         if (LvPlay.SelectedIndex > 0)
         {
             LvPlay.SelectedIndex--;
         }
         LvPlay.Focus();
     }
     else
     {
         MessageBoxEx.Show("Internal Error");
         return;
     }
     mediaPlayer.Open(new Uri(currentFile));
     Play(ImagePlay);
 }
Example #2
0
 private void BtNext_Click(object sender, RoutedEventArgs e)
 {
     if (isLibrary)
     {
         if (LvLibrary.SelectedIndex < LvLibrary.Items.Count - 1)
         {
             LvLibrary.SelectedIndex++;
         }
         else if (LvLibrary.SelectedIndex == LvLibrary.Items.Count - 1)
         {
             LvLibrary.SelectedIndex = 0;
         }
         LvLibrary.Focus();
     }
     else if (isPlaylist)
     {
         if (LvPlay.SelectedIndex < LvPlay.Items.Count - 1)
         {
             LvPlay.SelectedIndex++;
         }
         else if (LvPlay.SelectedIndex == LvPlay.Items.Count - 1)
         {
             LvPlay.SelectedIndex = 0;
         }
         LvPlay.Focus();
     }
     else
     {
         MessageBoxEx.Show("Internal Error");
         return;
     }
     mediaPlayer.Open(new Uri(currentFile));
     Play(ImagePlay);
 }
Example #3
0
 private void BtPlay_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!isPlaying)
         {
             if (isLibrary)
             {
                 if (LvLibrary.SelectedItem != null)
                 {
                     LvLibrary.Focus();
                     Play(ImagePlay);
                 }
                 else
                 {
                     MessageBoxEx.Show("You should select a music");
                 }
             }
             else if (isPlaylist)
             {
                 if (LvPlay.SelectedItem != null)
                 {
                     LvPlay.Focus();
                     Play(ImagePlay);
                 }
                 else
                 {
                     MessageBoxEx.Show("You should select a music");
                 }
             }
         }
         else
         {
             Pause(ImagePlay);
         }
     }
     catch (ArgumentNullException ex)
     {
         MessageBoxEx.Show("You should select a music" + ex.StackTrace);
     }
 }
Example #4
0
        private void RefreshMusicLibrary()
        {
            if (db.GetAllSongsFromLib() != null)
            {
                ListMusicLibrary = db.GetAllSongsFromLib();
            }
            else
            {
                Close();
            }

            LvLibrary.ItemsSource = ListMusicLibrary;
            if (LvLibrary.Items.Count == 0)
            {
                DisablePlayControl();
            }
            else
            {
                LvLibrary.Focus();
                LvLibrary.SelectedIndex = indexbeforeAdd;
                LvLibrary.Items.Refresh();
                EnablePlayControl();
            }
        }