Ejemplo n.º 1
0
        public virtual async Task <IDataSourcePlugin> GetDataSourceDataAsync(NameValueCollection locations)
        {
            try
            {
                //this can return null if the internet connection is broken
                Console.WriteLine($"Will attempt {this.shareClient.CurrentDexcomServer}, user: {shareClient.Username}");
                this.shareGlucose = await shareClient.FetchLast(3);
            }
            catch (SpecificShareError err)
            {
                if (err.code == ShareKnownRemoteErrorCodes.AuthenticateAccountNotFound || err.code == ShareKnownRemoteErrorCodes.AuthenticatePasswordInvalid)
                {
                    this.shareGlucose = null;
                    throw new ConfigValidationException($"Dexcom share client uknown username or password. Entered username: {shareClient.Username}");
                }
            }

            return(this);
        }