Facebook
From Filip, 7 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 374
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. using System.Xml.Linq;
  16. using System.Xml;
  17.  
  18. namespace WpfApplication13
  19. {
  20.     /// <summary>
  21.     /// Logika interakcji dla klasy MainWindow.xaml
  22.     /// </summary>
  23.    
  24.    
  25.     public partial class MainWindow : Window
  26.     {
  27.        
  28.        
  29.         static public string pathToCzytelnicy = @"..\..\Data\Czytelnicy.xml";
  30.         static public string pathToRecenzenci = @"..\..\Data\Recenzenci.xml";
  31.         static public string pathToKsiazki = @"..\..\Data\Ksiazki.xml";
  32.        
  33.         private XElement listaCzytelnikow;
  34.         private XElement listaRecenzentow;
  35.         private XElement listaKsiazek;
  36.        
  37.         public MainWindow()
  38.         {
  39.            
  40.            
  41.             InitializeComponent();
  42.             listaCzytelnikow = XElement.Load(pathToCzytelnicy);
  43.             gridCzytelnik.DataContext = listaCzytelnikow;
  44.             listaRecenzentow = XElement.Load(pathToRecenzenci);
  45.             gridRecenzent.DataContext = listaRecenzentow;
  46.             listaKsiazek = XElement.Load(pathToKsiazki);
  47.             gridKsiazka.DataContext = listaKsiazek;
  48.                  
  49.            
  50.          
  51.         }
  52.  
  53.         private void btnDodajCzytelnika_Click(object sender, RoutedEventArgs e)
  54.         {
  55.  
  56.            
  57.             Window1 oknododajczytelnik = new Window1(this);
  58.             oknododajczytelnik.Owner = this;
  59.             oknododajczytelnik.ShowDialog();
  60.            
  61.  
  62.  
  63.          
  64.            
  65.            
  66.         }
  67.  
  68.         private void btnZapiszCzytelnik_Click(object sender, RoutedEventArgs e)
  69.         {
  70.             listaCzytelnikow.Save(pathToCzytelnicy);
  71.             MessageBox.Show("Dane zostały poprawnie zapisane !");
  72.         }
  73.  
  74.        
  75.  
  76.         private void btnUsunCzytelnika_Click(object sender, RoutedEventArgs e)
  77.         {
  78.            
  79.            
  80.         }
  81.  
  82.         private void btnDodajRecenzenta_Click(object sender, RoutedEventArgs e)
  83.         {
  84.             Window2 oknododajrecenzent = new Window2(this);
  85.             oknododajrecenzent.Owner = this;
  86.             oknododajrecenzent.ShowDialog();
  87.         }
  88.  
  89.         private void btnUsunRecenzenta_Click(object sender, RoutedEventArgs e)
  90.         {
  91.  
  92.         }
  93.  
  94.         private void btnZapiszRecenzent_Click(object sender, RoutedEventArgs e)
  95.         {
  96.             listaRecenzentow.Save(pathToRecenzenci);
  97.             MessageBox.Show("Dane zostały poprawnie zapisane !");
  98.         }
  99.  
  100.         private void btnDodajKsiazke_Click(object sender, RoutedEventArgs e)
  101.         {
  102.             Window3 oknododajksiazka = new Window2(this);
  103.             oknododajksiazka.Owner = this;
  104.             oknododajksiazka.ShowDialog();
  105.         }
  106.  
  107.         private void btnUsunKsiazke_Click(object sender, RoutedEventArgs e)
  108.         {
  109.  
  110.         }
  111.  
  112.         private void btnZapiszKsiazka_Click(object sender, RoutedEventArgs e)
  113.         {
  114.             listaKsiazek.Save(pathToKsiazki);
  115.             MessageBox.Show("Dane zostały poprawnie zapisane !");
  116.         }
  117.  
  118.        
  119.  
  120.        
  121.  
  122.        
  123.  
  124.        
  125.     }
  126. }
  127.