Exemple #1
0
        private void UpdateUsage()
        {
            Log.Info("Updating meter usage.");

            if (string.IsNullOrEmpty(GetUserID()) || string.IsNullOrEmpty(GetPassword()))
            {
                return;
            }

            try
            {
                #pragma warning disable 618
                ServicePointManager.CertificatePolicy = new CertificateValidation();
                #pragma warning restore 618

                TelemeterService service = new TelemeterService();
                RetrieveUsageRequestType request = new RetrieveUsageRequestType { UserId = GetUserID(), Password = GetPassword() };
                service.retrieveUsageCompleted += HandleServiceretrieveUsageCompleted;
                service.retrieveUsageAsync(request);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Error retrieving meter usage.");

                if (UpdateMeterErrorEvent != null)
                {
                    UpdateMeterErrorEvent(ex.Message);
                }
            }
        }
Exemple #2
0
 /// <remarks/>
 public void retrieveUsageAsync(RetrieveUsageRequestType RetrieveUsageRequest)
 {
     this.retrieveUsageAsync(RetrieveUsageRequest, null);
 }
Exemple #3
0
 /// <remarks/>
 public void retrieveUsageAsync(RetrieveUsageRequestType RetrieveUsageRequest, object userState)
 {
     if ((this.retrieveUsageOperationCompleted == null))
     {
         this.retrieveUsageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnretrieveUsageOperationCompleted);
     }
     this.InvokeAsync("retrieveUsage", new object[] { RetrieveUsageRequest }, this.retrieveUsageOperationCompleted, userState);
 }
Exemple #4
0
 /// <remarks/>
 public System.IAsyncResult BeginretrieveUsage(RetrieveUsageRequestType RetrieveUsageRequest, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("retrieveUsage", new object[] { RetrieveUsageRequest }, callback, asyncState);
 }