- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using System.Xml.Linq;
- using System.Xml;
- namespace WpfApplication13
- {
- /// <summary>
- /// Logika interakcji dla klasy MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- static public string pathToCzytelnicy = @"..\..\Data\Czytelnicy.xml";
- static public string pathToRecenzenci = @"..\..\Data\Recenzenci.xml";
- static public string pathToKsiazki = @"..\..\Data\Ksiazki.xml";
- private XElement listaCzytelnikow;
- private XElement listaRecenzentow;
- private XElement listaKsiazek;
- public MainWindow()
- {
- InitializeComponent();
- listaCzytelnikow = XElement.Load(pathToCzytelnicy);
- gridCzytelnik.DataContext = listaCzytelnikow;
- listaRecenzentow = XElement.Load(pathToRecenzenci);
- gridRecenzent.DataContext = listaRecenzentow;
- listaKsiazek = XElement.Load(pathToKsiazki);
- gridKsiazka.DataContext = listaKsiazek;
- }
- private void btnDodajCzytelnika_Click(object sender, RoutedEventArgs e)
- {
- Window1 oknododajczytelnik = new Window1(this);
- oknododajczytelnik.Owner = this;
- oknododajczytelnik.ShowDialog();
- }
- private void btnZapiszCzytelnik_Click(object sender, RoutedEventArgs e)
- {
- listaCzytelnikow.Save(pathToCzytelnicy);
- MessageBox.Show("Dane zostały poprawnie zapisane !");
- }
- private void btnUsunCzytelnika_Click(object sender, RoutedEventArgs e)
- {
- }
- private void btnDodajRecenzenta_Click(object sender, RoutedEventArgs e)
- {
- Window2 oknododajrecenzent = new Window2(this);
- oknododajrecenzent.Owner = this;
- oknododajrecenzent.ShowDialog();
- }
- private void btnUsunRecenzenta_Click(object sender, RoutedEventArgs e)
- {
- }
- private void btnZapiszRecenzent_Click(object sender, RoutedEventArgs e)
- {
- listaRecenzentow.Save(pathToRecenzenci);
- MessageBox.Show("Dane zostały poprawnie zapisane !");
- }
- private void btnDodajKsiazke_Click(object sender, RoutedEventArgs e)
- {
- Window3 oknododajksiazka = new Window2(this);
- oknododajksiazka.Owner = this;
- oknododajksiazka.ShowDialog();
- }
- private void btnUsunKsiazke_Click(object sender, RoutedEventArgs e)
- {
- }
- private void btnZapiszKsiazka_Click(object sender, RoutedEventArgs e)
- {
- listaKsiazek.Save(pathToKsiazki);
- MessageBox.Show("Dane zostały poprawnie zapisane !");
- }
- }
- }