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) { } } } }
private void PLSaveList_Click(object sender, RoutedEventArgs e) { M3UFile _m3uFile = new M3UFile(); foreach (AAPList entry in AAPLists) { M3UEntry line = new M3UEntry(entry.lengthAsTimeSpan, entry.displayName, entry.pathAsURI); _m3uFile.Add(line); } if (_m3uFile != null) { using (var sfd = new SaveFileDialog() { Filter = "M3U File (*.m3u)|*.m3u", Title = "Save Playlist" }) { if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _m3uFile.Save(sfd.FileName); } } } }