public static void save(string filename, Playlist playlist) { using (FileStream fs = new FileStream(filename, FileMode.Create)) { //XmlSerializer xmlSerializer = new XmlSerializer(typeof(IList)); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, playlist); } }
public MainWindow() { #if DEBUG Environment.SetEnvironmentVariable("SQLite_ForceLogPrepare","True"); #endif InitializeComponent(); _pausePlayToggle = new FunctionImageToggle(new BitmapImage(new Uri("pack://application:,,,/Icons/Symbols_Play_16xLG.png")), ref ImageMainWindowPausePlayButton, () => { if (MediaElementMainWindow.IsLoaded && MediaElementMainWindow.LoadedBehavior == MediaState.Manual && MediaElementMainWindow.Clock == null) { MediaElementMainWindow.Play(); //MessageBox.Show("Play"); } }, () => { if (MediaElementMainWindow.IsLoaded && MediaElementMainWindow.LoadedBehavior == MediaState.Manual && MediaElementMainWindow.Clock == null) { MediaElementMainWindow.Pause(); //MessageBox.Show("Pause"); } }); _volumeHandler = new VolumeHandler(ref MediaElementMainWindow, ref SliderMainWindowSoundSlider, ref ImageMainWindowVolumePic, new BitmapImage(new Uri("pack://application:,,,/Icons/SoundfileNoSound_461.png"))); IList<MediaEntry> mediaEntries = searchForFilesAndGetInfo(); _databaseHandler = new DatabaseHandler(mediaEntries); _mediaDict = new Dictionary<string, MediaEntry>(); initListBoxValues(mediaEntries,ListBoxMainWindowRecentlyPlayed); _defaultPlaylist = new Playlist(ListBoxMainWindowRecentlyPlayed.Items); _currentPlaylist = new Playlist(ListBoxMainWindowRecentlyPlayed.Items); _timeSliderHandler = new TimeSliderHandler(ref MediaElementMainWindow, ref SliderMainWindowTimeSlider, ref LabelMainWindowTimer); _timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) }; _timer.Tick += (source, e) => { _timeSliderHandler.updateSliderPosition(source,e);}; _timer.Start(); }
private void enterPlayList(object sender, RoutedEventArgs e) { IList selected = ListBoxMainWindowRecentlyPlayed.SelectedItems.Clone(); if (selected.Count > 0) { Playlist playlist = new Playlist(selected); populateListBox(playlist,ListBoxMainWindowRecentlyPlayed); _currentPlaylist = playlist; } }