private void lstTreeLevels_ItemTap(object sender, ItemTappedEventArgs e) { try { CalcTreeRowInfo calcTreeRowInfo = e.Item as CalcTreeRowInfo; _equationsUiService.ShowMathExpression(calcTreeRowInfo.MathExpression); } catch (Exception ex) { Logging.LogException(ex); throw; } }
private static void GetCalculationTreeRows2(SingleResult input, IList <CalcTreeRowInfo> calculationTreeRows, string sCurrentIndent, string NumberFormat) { CalcTreeRowInfo rowInfo = new CalcTreeRowInfo(); rowInfo.MathExpression = input; rowInfo.DisplayText = string.Format("{0}{1}{2}{3}\n", sCurrentIndent, (input?.Name?.Length == 0) ? "" : string.Format("{0} = ", input?.Name), ( (input?.CalcQuantity?.CalcStatus == CalcStatus.Good) ? string.Format("{0:" + NumberFormat + "}", input?.CalcQuantity?.Value) : "" /*Missing or bad value*/ ), (input?.CalcQuantity?.Message?.Length == 0) ? "" : (" // " + input?.CalcQuantity?.Message)); calculationTreeRows.Add(rowInfo); }
private static void GetCalculationTreeRows2(FunctionCalc fnCalc, IList <CalcTreeRowInfo> calculationTreeRows, string sCurrentIndent, string sIndentStep, string NumberFormat) { CalcTreeRowInfo rowInfo = new CalcTreeRowInfo(); rowInfo.MathExpression = fnCalc; if (fnCalc.Function is FnEquals) { rowInfo.DisplayText = string.Format("{0}{1} ({2}) {3}\n", sCurrentIndent, fnCalc.Function.Name, fnCalc.Function.AsciiSymbol, (fnCalc.CalcQuantity.Message.Length == 0) ? "" : (" // " + fnCalc.CalcQuantity.Message)); } else { rowInfo.DisplayText = string.Format("{0}{1} ({2}) = {3}{4}\n", sCurrentIndent, fnCalc.Function.Name, fnCalc.Function.AsciiSymbol, ((fnCalc.GetCalcStatus() == CalcStatus.Good) ? string.Format("{0:" + NumberFormat + "}", fnCalc.CalcQuantity.Value) : "!"), (fnCalc.CalcQuantity.Message.Length == 0) ? "" : (" // " + fnCalc.CalcQuantity.Message)); } calculationTreeRows.Add(rowInfo); // ---------------------- foreach (SingleResult input in fnCalc.Inputs) { if (input is FunctionCalc) { GetCalculationTreeRows2(((FunctionCalc)input), calculationTreeRows, (sCurrentIndent + sIndentStep), sIndentStep, NumberFormat); } else { GetCalculationTreeRows2(input, calculationTreeRows, (sCurrentIndent + sIndentStep), NumberFormat); } } }