Esempio n. 1
0
        private void RequestMetrics(RequestPayload data)
        {
            Client metricsClient = this.GetMetricsClient(this.AccessToken);

            metricsClient.RequestCompleted += (RunWorkerCompletedEventHandler)((metricsSender, metricsArgs) => {});
            metricsClient.Post((object)data);
        }
Esempio n. 2
0
        private void EnsureAccessToken(
            TransportService.Action <RequestPayload> doneCallback,
            RequestPayload data)
        {
            Client accessTokenClient = this.GetAccessTokenClient();

            accessTokenClient.RequestCompleted += (RunWorkerCompletedEventHandler)((tokenSender, tokenArgs) =>
            {
                if (tokenArgs.Error != null)
                {
                    return;
                }
                if (TransportService.accessToken == null)
                {
                    lock (TransportService.accessTokenLock)
                    {
                        if (TransportService.accessToken == null)
                        {
                            TransportService.accessToken = (string)tokenArgs.Result;
                        }
                    }
                }
                doneCallback(data);
            });
            accessTokenClient.Post((object)new AccessTokenPayload());
        }
Esempio n. 3
0
 public virtual void CallHome(RequestPayload data)
 {
     if (string.IsNullOrEmpty(this.AccessToken))
     {
         this.EnsureAccessToken(new TransportService.Action <RequestPayload>(this.RequestMetrics), data);
     }
     else
     {
         this.RequestMetrics(data);
     }
 }