Exemplo n.º 1
0
 private void NextButton2_Click(object sender = null, RoutedEventArgs e = null)
 {
     if (bbcount == 1)
     {
         if (curplay != null)
         {
             List <AAPList> sortedlist = new List <AAPList>(AAPLists.OrderBy(o => o.order));
             if (curplay.after == (int)After.Stop)
             {
                 RowBold(); return;
             }
             else if (curplay.after == (int)After.Repeat)
             {
                 RowBold(); curplay = sortedlist.First(); if (myControl.MediaPlayer.IsPlaying)
                 {
                     Play();
                 }
             }
             else if (sortedlist.IndexOf(curplay) == sortedlist.Count - 1)
             {
                 RowBold(); curplay = null; bbcount = 1; StopButton2_Click();
             }
             else
             {
                 RowBold();  curplay = sortedlist.ElementAt(sortedlist.IndexOf(curplay) + 1); if (myControl.MediaPlayer.IsPlaying || sender == null)
                 {
                     Play();
                 }
             }
         }
     }
     bbcount = 0;
 }
Exemplo n.º 2
0
        private void PLLoadList_Click(object sender, RoutedEventArgs e)
        {
            M3UFile _m3uFile = new M3UFile();

            using (var ofd = new OpenFileDialog {
                Filter = "M3U File (*.m3u)|*.m3u", Title = "Open Playlist"
            })
            {
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        Task task2 = Task.Run(new Action(() =>
                        {
                            _m3uFile.Load(ofd.FileName);
                            foreach (var entry in _m3uFile)
                            {
                                AAPList plist = new AAPList(entry, AAPLists.Count);
                                playlistgrid.Dispatcher.BeginInvoke(new Action(() => AAPLists.Add(plist)));
                            }
                            Save();
                        }));
                    }
                    catch (Exception ex)
                    {
                        System.Windows.MessageBox.Show(ex.Message, "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                    }
                    if (_m3uFile != null)
                    {
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void PLPlay(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row = (DataGridRow)sender;

            RowBold();
            curplay = row.Item as AAPList;
            Play();
        }
Exemplo n.º 4
0
 public AAPList(AAPList old) {
     artist = old.artist;
     album = old.album;
     title = old.title;
     genre = old.genre;
     filename = old.filename;
     path = old.path;
     length = old.length;
     dateAdded = old.dateAdded;
 }
Exemplo n.º 5
0
 public AAPList(AAPList old)
 {
     artist    = old.artist;
     album     = old.album;
     title     = old.title;
     genre     = old.genre;
     filename  = old.filename;
     path      = old.path;
     length    = old.length;
     dateAdded = old.dateAdded;
 }
Exemplo n.º 6
0
 private void PlayButton_Click(object sender, RoutedEventArgs e)
 {
     if (curplay == null)
     {
         if (AAPLists.Count != 0)
         {
             curplay = AAPLists.OrderBy(o => o.order).First();
         }
         else
         {
             return;
         }
     }
     Play();
 }
Exemplo n.º 7
0
        private void PLFileInfo_Click(object sender, RoutedEventArgs e)
        {
            AAPList item = playlistgrid.SelectedItems.Cast <AAPList>().First();

            if (item != null)
            {
                System.Windows.MessageBox.Show(
                    "Filename: " + item.filename + Environment.NewLine +
                    "Path: " + item.path + Environment.NewLine +
                    "Artist: " + item.artist + Environment.NewLine +
                    "Title: " + item.title + Environment.NewLine +
                    "Album: " + item.album + Environment.NewLine +
                    "Genre: " + item.genre + Environment.NewLine
                    );
            }
        }
Exemplo n.º 8
0
        private void SearchFilter2(object sender, FilterEventArgs e)
        {
            AAPList item = e.Item as AAPList;

            if (item != null)
            {
                // Filter out products with price 25 or above
                if (item.displayName.ToUpper().Contains(plsearch.Text.ToUpper()) || plsearch.Text == "" || plsearch.Text == "Search...")
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            }
        }
Exemplo n.º 9
0
 private void BackButton2_Click(object sender, RoutedEventArgs e)
 {
     if (bbcount == 1)
     {
         if (curplay != null)
         {
             List <AAPList> sortedlist = new List <AAPList>(AAPLists.OrderBy(o => o.order));
             if ((sortedlist.IndexOf(curplay) == 0 || myControl.MediaPlayer.Time > 10000) && (myControl.MediaPlayer.IsPlaying))
             {
                 Play();
             }
             else
             {
                 RowBold();  curplay = sortedlist.ElementAt(sortedlist.IndexOf(curplay) - 1); if (myControl.MediaPlayer.IsPlaying)
                 {
                     Play();
                 }
             }
         }
     }
     bbcount = 0;
 }