private void btn_Aggiungi_Click(object sender, RoutedEventArgs e) { string nome = Nome.Text; string qt = Quantità.Text; if (string.IsNullOrWhiteSpace(nome)) { MessageBox.Show("Inserisci un Nome."); return; } if (string.IsNullOrWhiteSpace(qt)) { MessageBox.Show("Inserisci un Nome."); return; } int quantita = int.Parse(qt); Priorità priorita = (Priorità)priorità.SelectedValue; Spesa s = new Spesa(nome, quantita, priorita); spese.Add(s); lista.Items.Refresh(); }
public Spesa(string nome, int quantita, Priorità priorita) { this.nome = nome; this.quantita = quantita; this.priorita = priorita; }