public PIWebClient(UserContext userContext, QueueConsumer queueConsumer) { _userContext = userContext; HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter(); filter.IgnorableServerCertificateErrors.Add(ChainValidationResult.Untrusted); _httpClient = new HttpClient(filter); _httpClient.DefaultRequestHeaders.Add("Authorization", "Basic " + Convert.ToBase64String(UTF8Encoding.UTF8.GetBytes(string.Format("{0}:{1}", userContext.Username, userContext.Password)))); _queueConsumer = queueConsumer; _updateValuesService = new UpdateValuesAdhocService(); }
public static SessionContext GetSessionContext() { UserSettings userSettings = UserSettings.GetStoredUserSettings(); DataSettings dataSettings = DataSettings.GetStoredDataSettings(); UserContext userContext = new UserContext { Username = userSettings.Username, Password = userSettings.Password, WebIDs = userSettings.WebIDs }; DataContext dataContext = new DataContext { PhoneAccelerometerEnabled = dataSettings.PhoneSettings.AccelerometerEnabled, PhoneGeopositionEnabled = dataSettings.PhoneSettings.GeopositionEnabled }; SessionContext sessionContext = new SessionContext { UserContext = userContext, DataContext = dataContext }; return sessionContext; }