Esempio n. 1
0
 private void Opslaan(RoutedEventArgs e)
 {
     try
     {
         if (BackgroundImage != null)
         {
             SaveFileDialog dlg = new SaveFileDialog();
             dlg.FileName   = "";
             dlg.DefaultExt = ".txt";
             dlg.Filter     = "Kaarten |*.txt";
             if (dlg.ShowDialog() == true)
             {
                 using (StreamWriter bestand = new StreamWriter(dlg.FileName))
                 {
                     bestand.WriteLine(BackgroundName);
                     bestand.WriteLine(BackgroundImage.ToString());
                     bestand.WriteLine(BalLijst.Count);
                     if (BalLijst != null)
                     {
                         foreach (Model.Bal bal in BalLijst)
                         {
                             bestand.WriteLine(bal.BalKleur.ToString());
                             bestand.WriteLine(bal.XPositie);
                             bestand.WriteLine(bal.YPositie);
                         }
                     }
                     bestand.WriteLine(WensTekst);
                     bestand.WriteLine(LetterType);
                     bestand.WriteLine(Lettergrootte);
                 }
                 BestandsLocatie = dlg.FileName;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Save Mislukt", ex.Message, MessageBoxButton.OK);
     }
 }