private void addButton_click(object sender, DependencyPropertyChangedEventArgs e) { string title = itemNameBox.Text; int quantity = int.Parse(quantityBox.Text); string type = typeBox.Text; double price = double.Parse(priceBox.Text); Item item = new Item(new Random().Next(), title, quantity, type, price); calculator.AddItem(item); double total = calculator.getTotal(); totalLabel.Content = string.Format("Rp {0}", total); listBox.Items.Refresh(); }
private void AddButton_Click(object sender, RoutedEventArgs e) { string title = ItemNameBox.Text; int quantity = int.Parse(QuantityBox.Text); string type = TypeBox.Text; double price = double.Parse(PriceBox.Text); Item item = new Item(new Random().Next(), title, quantity, type, price); calculator.AddItem(item); double total = calculator.getTotal(); TotalLabel.Content = String.Format("Rp. {0}", total); ListBox.Items.Refresh(); }