Beispiel #1
0
 public AAPList(AAList song, int count)
 {
     artist    = song.artist;
     album     = song.album;
     title     = song.title;
     genre     = song.genre;
     filename  = song.filename;
     path      = song.path;
     length    = song.length;
     dateAdded = song.dateAdded;
     order     = count;
 }
Beispiel #2
0
 public AAPList(AAList song,int count)
 {
     artist = song.artist;
     album = song.album;
     title = song.title;
     genre = song.genre;
     filename = song.filename;
     path = song.path;
     length = song.length;
     dateAdded = song.dateAdded;
     order = count;
 }
Beispiel #3
0
        private void FileInfo_Click(object sender, RoutedEventArgs e)
        {
            AAList item = fulllistgrid.SelectedItems.Cast <AAList>().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
                    );
            }
        }
Beispiel #4
0
        private void SearchFilter(object sender, FilterEventArgs e)
        {
            AAList item = e.Item as AAList;

            if (item != null)
            {
                // Filter out products with price 25 or above
                if (item.displayName.ToUpper().Contains(fullsearch.Text.ToUpper()) || fullsearch.Text == "" || fullsearch.Text == "Search...")
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            }
        }
Beispiel #5
0
        //custom add file method
        private void AddFile(string filename)
        {
            if (!System.IO.File.Exists(filename))
            {
                return;
            }
            AAList addedsong = new AAList();

            addedsong.path     = Path.GetDirectoryName(filename);
            addedsong.filename = Path.GetFileName(filename);
            try
            {
                TagLib.File f = TagLib.File.Create(filename);
                if (f.Tag.Genres.Length != 0)
                {
                    addedsong.genre = f.Tag.Genres.GetValue(0).ToString();
                }
                if (f.Tag.Performers.Length != 0)
                {
                    addedsong.artist = f.Tag.Performers.GetValue(0).ToString();
                }
                if (f.Tag.Title != null)
                {
                    addedsong.title = f.Tag.Title;
                }
            }
            catch (UnsupportedFormatException e) { Console.WriteLine("UnsupportedFormat Exception" + e.Message); }
            addedsong.dateAdded = DateTime.Now;
            addedsong.order     = AALists.Count;
            try
            {
                Mp3FileReader naudio = new Mp3FileReader(filename);
                if (naudio != null)
                {
                    addedsong.length = (int)naudio.TotalTime.TotalSeconds;
                }
            }
            catch (InvalidDataException e) { Console.WriteLine("InvalidData Exception " + e.Message); }
            catch (InvalidOperationException e) { Console.WriteLine("InvalidOperation Exception " + e.Message); }
            catch (IOException e) { Console.WriteLine("IO Exception " + e.Message); }
            catch (Exception e) { Console.WriteLine("Some other exception" + e.Message); }
            //these actions called from the UI thread
            System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => { AALists.Add(addedsong); RemainingLabel.Visibility = Visibility.Visible;  RemainingLabel.Content = remaining + " files remaining"; }));
        }