void UpdateLatencyElements(PmwLatencyService.LatestData?dataOrNull) { if (dataOrNull.HasValue) { PmwLatencyService.LatestData ld = dataOrNull.Value; PingEma = ld.ema; PingLatest = ld.latest; } else { PingEma = new PmwLatencyService.LatencySample { status = PmwLatencyService.SampleStatus.Nonexistent }; PingLatest = new PmwLatencyService.LatencySample { status = PmwLatencyService.SampleStatus.Nonexistent }; } }
string LatencySampleToCSV(PmwLatencyService.LatencySample ls) { string result; switch (ls.status) { case PmwLatencyService.SampleStatus.Good: result = ls.rttMs.ToString(); break; case PmwLatencyService.SampleStatus.Nonexistent: result = "N/A"; break; case PmwLatencyService.SampleStatus.TimedOut: result = "TimedOut"; break; default: result = "Error"; break; } return(result); }