public ParkWindow() { God g1 = new God("Zevs", 342343467); God g2 = new God("Venera", 53453453); God g3 = new God("Upiter", 879798798); God g4 = new God("Aid", 353453); God g5 = new God("Appolon", 2342342); Olymp olymp = new Olymp(5); MyXmlSerializer XMLSer = new MyXmlSerializer(); olymp = XMLSer.xmlDeserialize(); data = olymp.gods; InitializeComponent(); dgGods.IsReadOnly = true; labelH.Visibility = Visibility.Hidden; labelK.Visibility = Visibility.Hidden; textH.Visibility = Visibility.Hidden; textK.Visibility = Visibility.Hidden; button_save.Visibility = Visibility.Hidden; button_save_edit.Visibility = Visibility.Hidden; dgGods.ItemsSource = data; }
void Window_Closing(object sender, CancelEventArgs e) { Olymp olymp = new Olymp(); foreach (var item in data) { olymp.addGod(new God()); } MyXmlSerializer serialisator = new MyXmlSerializer(); serialisator.xmlSerialize(olymp); }