private void Import(bool isSampler) { int recordsAffected = 0; buttonImport.IsEnabled = false; DateTime t1 = DateTime.Now; statusbarStart.Content = t1.ToString("HH:mm:ss"); statusbarDauer.Content = ""; statusbarProgress.Visibility = Visibility.Visible; if (checkboxTestimport.IsChecked == true) { var result = DataGetSet.TruncateTestTables(); if (result == false) { return; } } for (int i = 0; i <= comboboxAlbum.Items.Count - 1; i++) { comboboxAlbum.SelectedIndex = i; if (isSampler == false && _ignores.Contains(comboboxAlbum.Text)) { continue; } List <MP3Record> mp3List = mp3Records(_fileDetails, false); // isSampler = false // save records if ((bool)checkboxTestimport.IsChecked == true) { recordsAffected += DataGetSet.SaveTestRecord(mp3List); } else { recordsAffected += DataGetSet.SaveRecord(mp3List); } } DateTime t2 = DateTime.Now; statusbarProgress.Visibility = Visibility.Hidden; statusbarDauer.Content = (t2 - t1).Milliseconds.ToString() + " ms"; labelSuccess.Content = $"{recordsAffected}"; labelFailed.Content = $"{_fileDetails.Count - recordsAffected}"; checkboxTestimport.IsChecked = false; buttonImport.IsEnabled = true; }
private void Import2(bool isSampler) { int recordsAffected = 0; buttonImport.IsEnabled = false; DateTime t1 = DateTime.Now; statusbarStart.Content = t1.ToString("HH:mm:ss"); statusbarDauer.Content = ""; statusbarProgress.Visibility = Visibility.Visible; if (checkboxTestimport.IsChecked == true) { var result = DataGetSet.TruncateTestTables(); if (result == false) { // Todo write log return; } } List <MP3Record> mp3List; foreach (var song in songRecords) { mp3List = new List <MP3Record>(); mp3List.Add(new MP3Record() { Album = song.Album, Artist = song.Artist, Catalog = song.Catalog, FileName = song.FileName, Genre = song.Genre, Media = song.Media, MD5 = song.MD5, Path = song.Path, Titel = song.Titel, FileDate = song.FileDate, FileSize = song.FileSize, IsSample = (bool)checkboxSampler.IsChecked } ); // save records if ((bool)checkboxTestimport.IsChecked == true) { recordsAffected += DataGetSet.SaveTestRecord(mp3List); } else { recordsAffected += DataGetSet.SaveRecord(mp3List); } } DateTime t2 = DateTime.Now; statusbarProgress.Visibility = Visibility.Hidden; statusbarDauer.Content = (t2 - t1).Milliseconds.ToString() + " ms"; labelSuccess.Content = $"{recordsAffected}"; labelFailed.Content = $"{songRecords.Count - recordsAffected}"; checkboxTestimport.IsChecked = false; buttonImport.IsEnabled = true; }