private Task <CalcSummaryViewModel> GetSummaryAsync(string fldName) { CalcSummaryViewModel cvm = new CalcSummaryViewModel(); cvm.summaryReqd = false; ChemicalBalanceMessage cbm = new ChemicalBalanceMessage(_ud, _sd); ChemicalBalances chemicalBalances = new ChemicalBalances(); chemicalBalances = cbm.GetChemicalBalances(fldName); List <BalanceMessages> msgs = cbm.DetermineBalanceMessages(fldName); foreach (var m in msgs) { switch (m.Chemical) { case "CropN": cvm.remNIcon = m.Icon; cvm.remNIconText = _sd.GetNutrientIcon(m.Icon).definition; break; case "CropP2O5": cvm.remPIcon = m.Icon; cvm.remPIconText = _sd.GetNutrientIcon(m.Icon).definition; break; case "CropK2O": cvm.remKIcon = m.Icon; cvm.remKIconText = _sd.GetNutrientIcon(m.Icon).definition; break; case "AgrN": cvm.reqNIcon = m.Icon; cvm.reqNIconText = _sd.GetNutrientIcon(m.Icon).definition; break; case "AgrP2O5": cvm.reqPIcon = m.Icon; cvm.reqPIconText = _sd.GetNutrientIcon(m.Icon).definition; break; case "AgrK2O": cvm.reqKIcon = m.Icon; cvm.reqKIconText = _sd.GetNutrientIcon(m.Icon).definition; break; } } cvm.reqN = chemicalBalances.balance_AgrN.ToString(); cvm.reqP = chemicalBalances.balance_AgrP2O5.ToString(); cvm.reqK = chemicalBalances.balance_AgrK2O.ToString(); cvm.remN = chemicalBalances.balance_CropN.ToString(); cvm.remP = chemicalBalances.balance_CropP2O5.ToString(); cvm.remK = chemicalBalances.balance_CropK2O.ToString(); cvm.summaryReqd = cbm.displayBalances; return(Task.FromResult(cvm)); }