private void LoadAudioFilesData() { if (!System.IO.File.Exists(GetAudioFilesFileName())) { return; } XmlSerializer serializer = new XmlSerializer(typeof(AudioFileCollection)); using (System.IO.TextReader reader = new System.IO.StreamReader(GetAudioFilesFileName())) { audioFiles = (AudioFileCollection)serializer.Deserialize(reader); } }
public MainWindow() { InitializeComponent(); InitializeContextMenu(); audioFiles = new AudioFileCollection(); tags = new SortedObservableCollection <MusicTagger.Tag>(); LoadAudioFilesData(); libraryGrid.DataContext = audioFiles; LoadTagsFromFile(); lbTags.DataContext = tags; foreach (Tag t in tags) { t.PropertyChanged += TagSelectionChanged; } SetGridColumnWidth(); timer = new System.Timers.Timer(2000); timer.Start(); timer.Elapsed += TimerElapsed; txtSearch.KeyUp += OnTextSearchKeyPress; }