private void ProcessQueue(object state) { TelemetryInfo telemetryInfo = null; bool flag; lock (this.m_queue) { if (this.m_queue.Count > 0) { telemetryInfo = this.m_queue.Dequeue(); } flag = this.m_queue.Count > 0; } if (telemetryInfo != null) { this.SendTelemetry(telemetryInfo); } if (!flag) { return; } Application.DeferredInvoke(new DeferredInvokeHandler(this.ProcessQueue), null, DeferredInvokePriority.Low); }
private void SendTelemetry(object state) { TelemetryInfo telemetryInfo = (TelemetryInfo)state; telemetryInfo.Args.Add("@epochTime", telemetryInfo.elapsedTime); if (telemetryInfo.fSessionDatapoint) { int int32 = Convert.ToInt32(telemetryInfo.Args["@Data"]); string key = telemetryInfo.Args["@EventType"].ToString(); TelemetryAPI.AddToSessionEvent(telemetryInfo.eEvent, key, int32); } else if (telemetryInfo.eEvent == ETelemetryEvent.eTelemetryEventUndefined) { TelemetryAPI.SendDatapoint(telemetryInfo.dcsUri, telemetryInfo.Args); } else if (telemetryInfo.Args.Contains("@EventType")) { TelemetryAPI.SendEvent(telemetryInfo.eEvent, telemetryInfo.Args["@EventType"].ToString()); } else { TelemetryAPI.SendEvent(telemetryInfo.eEvent, null); } }
private void SendTelemetryInfo(TelemetryInfo info) => Application.DeferredInvoke(new DeferredInvokeHandler(this.SendTelemetry), info, DeferredInvokePriority.Low);