private void Button_Click(object sender, RoutedEventArgs e) { if (Id.Text.Equals("") || Opis.Text.Equals("") || ClrPcker.SelectedColor.ToString().Equals("")) { MessageBox.Show("Neophodno je popuniti polja!"); Id.Focus(); return; } foreach (Etiketa ee in Window.Etikete) { if (ee.Id.Equals(Id.Text)) { System.Media.SystemSounds.Beep.Play(); MessageBox.Show("Uneseni Id je vec odabran"); return; } } Etiketa et; try { et = new Etiketa(Id.Text, Opis.Text, ClrPcker.SelectedColor); }catch { System.Media.SystemSounds.Beep.Play(); MessageBox.Show("Doslo je do greske pri unosu"); return; } Window.Etikete.Add(et); FileIO.UpisiLokal("etikete.bin", Window.Etikete); this.Close(); }
private void Otkloni(object sender, RoutedEventArgs e) { Button button = sender as Button; Etiketa et = button.DataContext as Etiketa; OdabraneEtikete.Remove(et); NeodabraneEtikete.Add(et); }
private void Button_Click_1(object sender, RoutedEventArgs e) { Etiketa et = Id_Selct.SelectedItem as Etiketa; Window.Etikete.Remove(et); Window.ObrisiEtikete(et); FileIO.UpisiLokal("etikete.bin", Window.Etikete); this.Close(); }
private void Id_SelectionChanged(object sender, SelectionChangedEventArgs e) { Etiketa et = Id_Selct.SelectedItem as Etiketa; if (et == null) { return; } Opis.Text = et.Opis; ClrPcker.SelectedColor = ColorConverter.ConvertFromString(et.Boja) as Color?; }
public void OsveziEtikete(Etiketa et) { foreach (Lokal l in Mapa1) { for (int i = 0; i < l.Etikete?.Count; i++) { Etiketa etiketa = l.Etikete[i]; if (etiketa.Equals(et)) { etiketa = et; break; } } } foreach (Lokal l in Mapa2) { for (int i = 0; i < l.Etikete?.Count; i++) { Etiketa etiketa = l.Etikete[i]; if (etiketa.Equals(et)) { etiketa = et; break; } } } foreach (Lokal l in Mapa3) { for (int i = 0; i < l.Etikete?.Count; i++) { Etiketa etiketa = l.Etikete[i]; if (etiketa.Equals(et)) { etiketa = et; break; } } } foreach (Lokal l in Mapa4) { for (int i = 0; i < l.Etikete?.Count; i++) { Etiketa etiketa = l.Etikete[i]; if (etiketa.Equals(et)) { etiketa = et; break; } } } this.SacuvajLokale(); }
private void OdaberiEtiketu(object sender, EventArgs e) { Etiketa et = etikete.SelectedItem as Etiketa; if (et == null) { return; } etikete.SelectedItem = null; OdabraneEtikete.Insert(0, et); NeodabraneEtikete.Remove(et); this.Odabrane.ItemsSource = OdabraneEtikete; }
public void ObrisiEtikete(Etiketa et) { foreach (Lokal l in Mapa1) { l.Etikete?.Remove(et); } foreach (Lokal l in Mapa2) { l.Etikete?.Remove(et); } foreach (Lokal l in Mapa3) { l.Etikete?.Remove(et); } foreach (Lokal l in Mapa4) { l.Etikete?.Remove(et); } this.SacuvajLokale(); }
private void Button_Click(object sender, RoutedEventArgs e) { Etiketa et = Id_Selct.SelectedItem as Etiketa; if (et == null) { MessageBox.Show("Neophodno je odabrati postojecu etiketu!"); return; } et.Opis = Opis.Text; et.Boja = ClrPcker.SelectedColor.ToString(); if (et.Opis.Equals("") || et.Boja.Equals("")) { MessageBox.Show("Neophodno je uneti opis i boju!"); return; } Window.OsveziEtikete(et); FileIO.UpisiLokal("etikete.bin", Window.Etikete); this.Close(); }