public void SaveData(string filePath)
 {
     //If the given path exists, save the data in JSON-Format
     if (filePath == String.Empty)
     {
         System.Windows.MessageBox.Show("No Savefile was specified. Data will not be saved");
     }
     else
     {
         using (System.IO.StreamWriter file =
                    new System.IO.StreamWriter(filePath, false))
         {
             PersistenceConverter converter = new PersistenceConverter();
             file.Write(JsonConvert.SerializeObject(converter.ConvertToData(window)));
         }
     }
 }
 public void LoadData(string filePath)
 {
     //If the specified savefile exists, try to load the data from the file to the program in JSON Format
     try
     {
         if (File.Exists(filePath))
         {
             using (System.IO.StreamReader file =
                        new System.IO.StreamReader(filePath, false))
             {
                 PersistenceConverter converter = new PersistenceConverter();
                 converter.ConvertFromData(window, JsonConvert.DeserializeObject <SaveData>(file.ReadToEnd()));
             }
         }
     }
     catch
     {
         System.Windows.MessageBox.Show("The specified save file has no valid data. Please check your settings for a valid file!", "Error 666: File not valid", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         window.ResetText();
     }
 }