private void addGrains_Click(object sender, RoutedEventArgs e) { var sum = Grist.Sum(g => g.Amount); var sw = new SelectGrain(MaltRepo, sum); sw.ShowDialog(); if (sw.Result != null) { Grist.Add(sw.Result); recalculateGrainBill(); } }
private void MaltsListView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (MaltsListView.SelectedIndex >= Grist.Count() || MaltsListView.SelectedIndex < 0) { return; } double sum = Grist.Sum(g => g.Amount); sum -= Grist.ToArray()[MaltsListView.SelectedIndex].Amount; var sw = new SelectGrain(MaltRepo, sum, Grist.ToArray()[MaltsListView.SelectedIndex]); sw.ShowDialog(); if (sw.Result != null) { Grist.Remove((GristPart)MaltsListView.SelectedItem); Grist.Add(sw.Result); recalculateGrainBill(); } }
private void MaltsListView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (MaltsListView.SelectedIndex >= Grist.Count() || MaltsListView.SelectedIndex < 0) return; double sum = Grist.Sum(g => g.Amount); sum -= Grist.ToArray()[MaltsListView.SelectedIndex].Amount; var sw = new SelectGrain(MaltRepo, sum, Grist.ToArray()[MaltsListView.SelectedIndex]); sw.ShowDialog(); if (sw.Result != null) { Grist.Remove((GristPart)MaltsListView.SelectedItem); Grist.Add(sw.Result); recalculateGrainBill(); } }