public Baza(MainWindow window, ListBox lista, Button b1, Button b2, StreamWriter writer) { this.writer = writer; this.lista = lista; InitializeComponent(); w1 = window; txtBaza.Content = lista.Items.GetItemAt(lista.SelectedIndex).ToString().Substring(37); this.b1 = b1; this.b2 = b2; baza = App.bazy.getBazy().ElementAt <Poszczegolna_Baza>(lista.SelectedIndex); for (int i = 0; i < App.bazy.getBazy().ElementAt <Poszczegolna_Baza>(lista.SelectedIndex).getZwroty().Count; i++) { ListBoxItem item = new ListBoxItem(); item.Content = App.bazy.getBazy().ElementAt <Poszczegolna_Baza>(lista.SelectedIndex).getZwroty().ElementAt <Zwrot>(i).konkatenacja(); SolidColorBrush myBrush = new SolidColorBrush(Colors.FloralWhite); item.Background = myBrush; item.HorizontalAlignment = HorizontalAlignment.Stretch; item.FontSize = 24; listBaza.Items.Add(item); } baza = App.bazy.getBazy().ElementAt <Poszczegolna_Baza>(lista.SelectedIndex); }
public Wynik(int ile, int wynik, List <int> bledy, Poszczegolna_Baza baza, List <string> bledySTR, Window window) { InitializeComponent(); this.window = window; this.bledy = bledy; this.baza = baza; this.bledySTR = bledySTR; lblWynik.Content = "Wynik: " + wynik + "/" + ile + " pkt "; int i = 0; bazaBledow = new Poszczegolna_Baza(); foreach (var item in bledy) { ListBoxItem item2 = new ListBoxItem(); item2.Content = baza.getZwroty().ElementAt(item).getPL() + " - " + baza.getZwroty().ElementAt(item).getENG(); SolidColorBrush myBrush = new SolidColorBrush(Colors.LightCyan); item2.Background = myBrush; item2.HorizontalAlignment = HorizontalAlignment.Stretch; listWynik.Items.Add(item2); bazaBledow.Dodaj_Zwrot(baza.getZwroty().ElementAt(item).getPL(), baza.getZwroty().ElementAt(item).getENG()); ListBoxItem item3 = new ListBoxItem(); item3.Content = bledySTR.ElementAt(i++); SolidColorBrush myBrush2 = new SolidColorBrush(Colors.LightCyan); item3.Background = myBrush2; item3.HorizontalAlignment = HorizontalAlignment.Stretch; listBłąd.Items.Add(item3); } }
public TEST(Poszczegolna_Baza baza, Window window) { InitializeComponent(); this.baza = baza; this.window = window; tab = new int[baza.getZwroty().Count]; wynikowe = new string[baza.getZwroty().Count]; random = new Random(); i = random.Next(0, baza.getZwroty().Count); wylosowane = new int[baza.getZwroty().Count]; wylosowane[0] = i; Losowanie(); zwrotPL.Text = baza.getZwroty().ElementAt(i).getPL(); ile++; bledy = new List <int>(); bledySTR = new List <string>(); CountPytania.Content = "Pytanie " + 1 + " z " + baza.getZwroty().Count; }
public DodawanieZwrotu(ListBox lista, Poszczegolna_Baza baza, Button dodawanie, Window okno, StreamWriter writer) { InitializeComponent(); warning1.Visibility = Visibility.Collapsed; warning2.Visibility = Visibility.Collapsed; this.lista = lista; this.baza = baza; this.dodawanie = dodawanie; this.okno = okno; this.writer = writer; this.Left = okno.Left + 65; this.Top = okno.Top + okno.Height / 2; }
public MainWindow() { InitializeComponent(); try { stream = new FileStream("bazy" + ".dat", FileMode.Open); } catch { stream = new FileStream("bazy" + ".dat", FileMode.Create); } writer = new StreamWriter(stream); reader = new StreamReader(stream); while (!reader.EndOfStream) { ListBoxItem item = new ListBoxItem(); item.Content = reader.ReadLine(); SolidColorBrush myBrush = new SolidColorBrush(Colors.FloralWhite); item.Background = myBrush; item.HorizontalAlignment = HorizontalAlignment.Stretch; lista.Items.Add(item); Poszczegolna_Baza baza = new Poszczegolna_Baza(item.Content.ToString()); FileStream stream2 = new FileStream(item.Content.ToString() + ".dat", FileMode.Open); StreamReader reader2 = new StreamReader(stream2); int i = 1; Zwrot zwrot = new Zwrot(); while (!reader2.EndOfStream) { if (i % 2 != 0) { zwrot = new Zwrot(); zwrot.setPL(reader2.ReadLine()); } else if (i % 2 == 0) { zwrot.setENG(reader2.ReadLine()); baza.Dodaj_Zwrot(zwrot); } stream2.Position++; i++; } App.bazy.Dodaj_Baze(baza); stream.Position++; } stream.Position = stream.Length; }
public void Dodaj_Baze(Poszczegolna_Baza baza) { bazy.Add(baza); }