private void handleSelectHops() { HopAddition h = new HopAddition(); if (HopsListView.SelectedItem != null) { var bsh = BSBoilHops.First(); h.Hop = (Hops)(HopsListView.SelectedItem); Debug.Assert(WorkRecepie.BatchVolume != 0); h.Amount = (bsh.Amount) / (WorkRecepie.BatchVolume); h.Duration = bsh.BoilTime; WorkRecepie.BoilHops.Add(h); var del = BSBoilHops.First(); BSBoilHops.Remove(del); if (BSGrainBill.Count == 0) { ImportedRecepie = WorkRecepie; this.Close(); } else { TextblockHops.Text = "Please select a corresponding hops for " + BSBoilHops.First().Name + " with alpha acid " + BSBoilHops.First().AlphaAcid.ToString(); } } else { MessageBox.Show("Please select a hop in the list to match the imported one"); } }
private void handleSelectMalts() { GristPart m = new GristPart(); if (MaltsListView.SelectedItem != null) { var bsfm = BSGrainBill.First(); m.FermentableAdjunct = (FermentableAdjunct)(MaltsListView.SelectedItem); m.Amount = bsfm.AmountPercent; m.Stage = FermentableStage.Mash; WorkRecepie.Fermentables.Add(m); var del = BSGrainBill.First(); BSGrainBill.Remove(del); if (BSGrainBill.Count == 0) { BSBoilHops = BeersmithImporter.GetBoilHops(WorkRecepie.Name).ToList(); ChangeTabItem(1); TextblockHops.Text = "Please select a corresponding hops for " + BSBoilHops.First().Name + " with alpha acid " + BSBoilHops.First().AlphaAcid.ToString(); } else { TextblockMalts.Text = "Please select a corresponding malt for " + BSGrainBill.First().FermentableName + ". " + BSGrainBill.First().AmountPercent.ToString() + " % of total grist"; } } else { MessageBox.Show("Please select a fermentable adjunct in the list"); } }