/// <summary> /// XML Laden. /// </summary> /// <returns></returns> private Nullable <bool> LoadXML() { //Save Dialog öffnen Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog { FileName = "Playlists", DefaultExt = ".xml", Filter = "XML (.xml)|*.xml" }; // Show save file dialog box Nullable <bool> result = dlg.ShowDialog(); // Process save file dialog box results if (result == true) { try { // Load document result = Playlists.Load(dlg.FileName); } catch (Exception ex) { MessageBox.Show("Es ist ein Fehler beim laden der Playlist aufgetreten." + ex.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); } } return(result); }
public MainWindow() { InitializeComponent(); try { picker = new Games(); steamCategoryParser = new SteamCategoryParser(picker); } catch (Exception) { if (File.Exists(steamInstallDirStoragePath)) { ReadInstallLocationAndLoadGames(); } else { PromptForSteamInstallDir(); } } btnPlayRandom.Content = PLAY_RANDOM_TEXT; gamesLists = Playlists.Load(); DataContext = this; playlistBox.ItemsSource = AllPlaylists; playlistBox.SelectedIndex = 0; }
public MainWindow() { InitializeComponent(); GenerateOperationsList(); GenerateFieldList(); Functions.ReadSettingsXML(); //Autoload der Playlist if (Functions.PlaylistAutoLoad && File.Exists(Functions.PlaylistXML)) { try { Playlists.Load(Functions.PlaylistXML); } catch (Exception ex) { MessageBox.Show("Es ist ein Fehler beim laden der Playlist aufgetreten." + ex.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); } ResetDatabinds(); } }
public MainWindow() { InitializeComponent(); try { picker = new Games(); } catch (Exception) { if (File.Exists(steamInstallDirStoragePath)) { ReadInstallLocationAndLoadGames(); } else { PromptForSteamInstallDir(); } } gamesLists = Playlists.Load(); DataContext = this; playlistBox.ItemsSource = playlistDictionary; }
private void initial_DoWork(object sender, DoWorkEventArgs e) { initial.ReportProgress(0, "Variablen werden ausgelesen"); bool playlistexist = Playlists.GetPlaylistNames.Count > 0; //Alles initialisieren und mit Abfragen bei Fehlern ausführen, wenn kein Autorun gemacht wurde. Autorun wird unten verarbeitet. if (Functions.Initialisieren(playlistexist) && !Functions.Autorun) { if (Playlists.GetPlaylistNames.Count == 0) { var resultDialog = MessageBox.Show( "Es wurde keine Wiedergabeliste(n) geladen. Es wird versucht diese aus dem Parameter der Config zu laden.", "Keine Wiedergabeliste geladen.", MessageBoxButton.OKCancel, MessageBoxImage.Information); if (resultDialog == MessageBoxResult.OK) { Playlists.Clear(); var res = Playlists.Load(Functions.PlaylistXML); if (res == true) { initial.ReportProgress(0, "Wiedergaben XML wurde geladen."); readedplaylists = true; } else { cancelerror = true; return; } } if (resultDialog == MessageBoxResult.Cancel) { //Abbruch return; } } initial.ReportProgress(10, Functions.StartDir + " wird nach Musik durchsucht"); if (Functions.ReadFiles()) { initial.ReportProgress(20, "Es wurden " + Functions.AllSongs.Count + " Lieder gefunden."); new Playlistwriter(Functions.AllSongs, Functions.PlaylistSavePath, initial, 20, Functions.ChangeMusicPath, Functions.PlaylistClearFolder); } else { var resultDialog = MessageBox.Show( "Beim auslesen Musikdateien ist ein Fehler aufgetreten. Klicken Sie Ok um das Settingsmenü aufzurufen oder Cancel um die Verarbeitung abzubrechen.", "Fehler beim Initialisieren", MessageBoxButton.OKCancel, MessageBoxImage.Information); if (resultDialog == MessageBoxResult.OK) { Settings se = new Settings(); se.Owner = Owner; se.Show(); //Hide(); return; } if (resultDialog == MessageBoxResult.Cancel) { cancelerror = true; } } } else { //Autorun durchführen. if (Functions.Autorun) { Playlists.Clear(); var res = Playlists.Load(Functions.PlaylistXML); if (res == true) { initial.ReportProgress(0, "Wiedergaben XML wurde geladen."); readedplaylists = true; } else { cancelerror = true; return; } initial.ReportProgress(10, Functions.StartDir + " wird nach Musik durchsucht"); if (Functions.ReadFiles()) { initial.ReportProgress(20, "Es wurden " + Functions.AllSongs.Count + " Lieder gefunden."); new Playlistwriter(Functions.AllSongs, Functions.PlaylistSavePath, initial, 20, Functions.ChangeMusicPath); } else { Close(); Owner.Close(); } } else { var resultDialog = MessageBox.Show( "Beim auslesen der Config ist ein Fehler aufgetreten. Bitte öffnen Sie das Settings Menü um die notwendigen Daten zu setzen..", "Fehler beim Initialisieren", MessageBoxButton.OK, MessageBoxImage.Information); if (resultDialog == MessageBoxResult.OK) { cancelerror = true; } } } }