Ejemplo n.º 1
0
 public HealthVaultClient(AppInfo appInfo, ServiceInfo serviceInfo, bool useWebAuthBroker)
     : this(
         appInfo,
         serviceInfo,
         new HttpTransport(serviceInfo.ServiceUrl),
         new HttpStreamer(),
         new Cryptographer(),
         useWebAuthBroker ? (IWebAuthorizer)new WebAuthorizer() : new BrowserWebAuthorizer())
 {
 }
        public async Task Save()
        {
            StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(
                FileName,
                CreationCollisionOption.ReplaceExisting);

            // Create a duplicate because this might be a ServiceInfoProxy
            // and you can't serialize internal classes.
            ServiceInfo duplicate = new ServiceInfo()
            {
                ServiceUrl = this.ServiceUrl,
                ShellUrl = this.ShellUrl
            };

            // We should have a lock around reads/writes, but you can't await inside a lock.
            await FileIO.WriteTextAsync(file, duplicate.ToXml());
        }
Ejemplo n.º 3
0
        public HealthVaultClient(
            AppInfo appInfo,
            ServiceInfo serviceInfo,
            IHttpTransport transport,
            IHttpStreamer streamer,
            ICryptographer cryptographer,
            IWebAuthorizer authorizer)
        {
            appInfo.ValidateRequired("appInfo");
            serviceInfo.ValidateRequired("serviceInfo");
            if (transport == null)
            {
                throw new ArgumentNullException("transport");
            }
            if (streamer == null)
            {
                throw new ArgumentNullException("streamer");
            }
            if (cryptographer == null)
            {
                throw new ArgumentNullException("cryptographer");
            }
            if (authorizer == null)
            {
                throw new ArgumentNullException("authorizer");
            }

            m_appInfo = appInfo;
            m_serviceInfo = serviceInfo;
            m_transport = transport;
            m_streamer = streamer;
            m_cryptographer = cryptographer;
            m_authorizer = authorizer;

            m_serviceMethods = new ServiceMethods(this);
            m_recordMethods = new RecordMethods(this);
            m_shell = new Shell(this);

            m_secretStore = new SecretStore(MakeStoreName(m_appInfo.MasterAppId));
            m_state = new ClientState();
            LoadState();
        }
Ejemplo n.º 4
0
        private static ServiceInfo CreateServiceInfo(
            bool production,
            bool isUSInstance)
        {
            var serviceInfo = new ServiceInfo();

            if (production)
            {
                if (isUSInstance)
                {
                    serviceInfo.InitForUSProduction();
                }
                else
                {
                    serviceInfo.InitForUKProduction();
                }
            }
            else
            {
                if (isUSInstance)
                {
                    serviceInfo.InitForUSPPE();
                }
                else
                {
                    serviceInfo.InitForUKPPE();
                }
            }

            return serviceInfo;
        }