LEISTUNG Drehmoment [Nm]: Drehzahl [U/min] Leistung [PS] Leistung [kW] POWER torque [Nm]: engine speed [U/min] power [HP] power [kW] resultDict, bool firstCall) { List> resultSets; // Job 1 - ständig zu aktualisierende Werte ediabas.ArgString = "JA;IMOAK;INMOT;IMWVO;ILMMG"; ediabas.ArgBinaryStd = null; ediabas.ResultsRequests = string.Empty; ediabas.ExecuteJob("STATUS_MESSWERTBLOCK_LESEN"); resultSets = ediabas.ResultSets; if (resultSets != null && resultSets.Count >= 2) { EdiabasThread.MergeResultDictionarys(ref resultDict, resultSets[1], "STATUS_MESSWERTBLOCK_LESEN#"); } // extract values and save to global variables EdiabasNet.ResultData resultData; if (resultSets[1].TryGetValue("STAT_MOTORDREHZAHL_WERT", out resultData)) { if (resultData.OpData is Double) { mom_N = (int)((Double)resultData.OpData); } } if (resultSets[1].TryGetValue("STAT_MOTORMOMENT_AKTUELL_WERT", out resultData)) { if (resultData.OpData is Double) { mom_torque = (int)((Double)resultData.OpData); } } } public string FormatResult(JobReader.PageInfo pageInfo, MultiMap resultDict, string resultName, ref Android.Graphics.Color? textColor) { string result = string.Empty; double value; // bool found; // List of possible colors: https://docs.microsoft.com/en-us/dotnet/api/android.graphics.color?view=xamarin-android-sdk-9 switch (resultName) { case "STATUS_MESSWERTBLOCK_LESEN#STAT_MOTORMOMENT_WUNSCH_WERT": // value = ActivityMain.GetResultDouble(resultDict, resultName, 0, out found); // this is the reading we overwrite with calculated horsepower value = mom_torque * mom_N / 7127; // result format: {0,[DIGITS TOTAL INCL COMMA],[0|0.0|0.00|0.000...]} result = string.Format(ActivityMain.Culture, "{0,1:0}", value); // if (found && value <= 4000) textColor = Android.Graphics.Color.White; // else if (found && value <= 4250) textColor = Android.Graphics.Color.Yellow; // else if (found && value <= 4500) textColor = Android.Graphics.Color.Orange; // else if (found && value > 4500) textColor = Android.Graphics.Color.Red; // else textColor = Android.Graphics.Color.Gray; break; case "STATUS_MESSWERTBLOCK_LESEN#STAT_LUFTMASSE_PRO_HUB_WERT": // value = ActivityMain.GetResultDouble(resultDict, resultName, 0, out found); // and this one we will overwrite with power in kW value = mom_torque * mom_N / 7127 / 1.36; // result format: {0,[DIGITS TOTAL INCL COMMA],[0|0.0|0.00|0.000...]} result = string.Format(ActivityMain.Culture, "{0,1:0}", value); // if (found && value <= 4000) textColor = Android.Graphics.Color.White; // else if (found && value <= 4250) textColor = Android.Graphics.Color.Yellow; // else if (found && value <= 4500) textColor = Android.Graphics.Color.Orange; // else if (found && value > 4500) textColor = Android.Graphics.Color.Red; // else textColor = Android.Graphics.Color.Gray; break; } return result; } } ]]>