public HealthVaultApp(HealthVaultAppSettings appSettings) { m_lock = new object(); m_appSettings = appSettings; m_serviceInfo = new ServiceInfoProxy() { ShellUrl = appSettings.ShellUrl, ServiceUrl = appSettings.ServiceUrl }; m_startupStatus = AppStartupStatus.Cancelled; m_appInfo = new AppInfoProxy(appSettings.MasterAppId, appSettings.IsMultiInstanceAware); m_client = new HealthVaultClient( m_appInfo, m_serviceInfo, appSettings.IsFirstParty, appSettings.WebAuthorizer != null ? (IWebAuthorizer)appSettings.WebAuthorizer : null); if (appSettings.IsFirstParty) { m_liveIdHostName = appSettings.LiveIdHostName; m_client.LiveIdHostName = appSettings.LiveIdHostName; } m_localVault = new LocalVault(this, appSettings.Folder, appSettings.Folder); m_vocabs = new Vocabs(this); UIThreadDispatcher.Current.Init(); }
private async Task <AppStartupStatus> ProvisionAppForOnlineAuthModel(CancellationToken cancelToken) { PersonInfo personInfo = null; try { personInfo = await BatchCallsForOnlinePersonInfoAsync(cancelToken); } catch (ServerException ex) { if (ex.IsStatusCode(ServerStatusCode.CredentialNotFound)) { m_startupStatus = AppStartupStatus.CredentialNotFound; } throw; } catch (TaskCanceledException) { m_startupStatus = AppStartupStatus.Cancelled; throw; } HandleEncryptionSetCache(); UserInfo = personInfo != null ? new UserInfo(personInfo) : null; m_localVault.RecordStores.ResetRecordObjects(UserInfo); await SaveUserInfoAsync(cancelToken); return(AppStartupStatus.Success); }
public HealthVaultApp(HealthVaultAppSettings appSettings) { m_lock = new object(); m_appSettings = appSettings; m_serviceInfo = new ServiceInfoProxy() { ShellUrl = appSettings.ShellUrl, ServiceUrl = appSettings.ServiceUrl }; m_startupStatus = AppStartupStatus.Cancelled; m_appInfo = new AppInfoProxy(appSettings.MasterAppId, appSettings.IsMultiInstanceAware); m_client = new CHBaseClient( m_appInfo, m_serviceInfo, appSettings.IsFirstParty, appSettings.WebAuthorizer != null ? (IWebAuthorizer)appSettings.WebAuthorizer : null); if (appSettings.IsFirstParty) { m_liveIdHostName = appSettings.LiveIdHostName; m_client.LiveIdHostName = appSettings.LiveIdHostName; } m_localVault = new LocalVault(this, appSettings.Folder, appSettings.Folder); m_vocabs = new Vocabs(this); UIThreadDispatcher.Current.Init(); }
private async Task EnsureProvisionedAsync(CancellationToken cancelToken) { m_startupStatus = AppStartupStatus.Pending; if (m_client.UseOnlineAuthModel) { m_startupStatus = await ProvisionAppForOnlineAuthModel(cancelToken); } else { m_startupStatus = await ProvisionAppForSODAAuthModel(cancelToken); } }
public IAsyncOperation <IsValidHealthVaultAccountResponse> HasAccountAsync() { return(AsyncInfo.Run( async cancelToken => { try { return await m_client.IsValidHealthVaultAccount <IsValidHealthVaultAccountResponse>( cancelToken); } catch (TaskCanceledException) { m_startupStatus = AppStartupStatus.Cancelled; throw; } })); }
public IAsyncOperation <bool> CreateAccountAsync(CreateAccountPersonInfo createAccountPersonInfo) { return(AsyncInfo.Run( async cancelToken => { try { return await CreateAccountAsync( createAccountPersonInfo, cancelToken); } catch (TaskCanceledException) { m_startupStatus = AppStartupStatus.Cancelled; throw; } })); }
public HealthVaultApp(HealthVaultAppSettings appSettings) { m_lock = new object(); m_appSettings = appSettings; m_serviceInfo = new ServiceInfoProxy() { ShellUrl = appSettings.ShellUrl, ServiceUrl = appSettings.ServiceUrl }; m_startupStatus = AppStartupStatus.Cancelled; m_appInfo = new AppInfoProxy(appSettings.MasterAppId); m_client = new HealthVaultClient(m_appInfo, m_serviceInfo, m_appSettings.UseWebAuthBroker); m_localVault = new LocalVault(this, appSettings.Folder, appSettings.Folder); m_vocabs = new Vocabs(this); }
private async Task <AppStartupStatus> ProvisionAppForSODAAuthModel(CancellationToken cancelToken) { bool isNewApp = !IsAppCreated; AppStartupStatus appStartupStatus = AppStartupStatus.Pending; try { appStartupStatus = await EnsureAppCreatedAsync(cancelToken); } catch { appStartupStatus = AppStartupStatus.Failed; throw; } if (appStartupStatus != AppStartupStatus.Success) { await SetUserAndSaveAsync(null, cancelToken); return(appStartupStatus); } HandleEncryptionSetCache(); if (!isNewApp) { await LoadUserInfoAsync(cancelToken); } if (!HasUserInfo) { // // Download updated Person Information // await UpdateUserInfoAsync(cancelToken); } return(AppStartupStatus.Success); }
public IAsyncAction StartAsync() { m_startupStatus = AppStartupStatus.Pending; return(AsyncInfo.Run(EnsureProvisionedAsync)); }
private async Task EnsureProvisionedAsync(CancellationToken cancelToken) { m_startupStatus = AppStartupStatus.Pending; bool isNewApp = !IsAppCreated; try { m_startupStatus = await EnsureAppCreatedAsync(cancelToken); } catch { m_startupStatus = AppStartupStatus.Failed; throw; } if (m_startupStatus != AppStartupStatus.Success) { await SetUserAndSaveAsync(null, cancelToken); return; } // Set up the encrypted local vault if (m_appSettings.UseEncryption) { var encryptedStore = new EncryptedObjectStore( FolderObjectStore.CreateRoot(m_appSettings.Folder), Client.Cryptographer, Client.State.ProvisioningInfo.SharedSecret); m_localVault = new LocalVault(this, FolderObjectStore.CreateRoot(m_appSettings.Folder), encryptedStore); } // Set the cache setting m_localVault.RecordStores.MaxCachedItems = m_appSettings.MaxCachedItems; if (!isNewApp) { await LoadUserInfoAsync(cancelToken); } if (!HasUserInfo) { // // Download updated Person Information // await UpdateUserInfoAsync(cancelToken); } }
public IAsyncAction StartAsync() { m_startupStatus = AppStartupStatus.Pending; return AsyncInfo.Run(cancelToken => EnsureProvisionedAsync(cancelToken)); }
private async Task<AppStartupStatus> ProvisionAppForOnlineAuthModel(CancellationToken cancelToken) { PersonInfo personInfo = null; try { personInfo = await BatchCallsForOnlinePersonInfoAsync(cancelToken); } catch (ServerException ex) { if (ex.IsStatusCode(ServerStatusCode.CredentialNotFound)) { m_startupStatus = AppStartupStatus.CredentialNotFound; } throw; } catch (TaskCanceledException) { m_startupStatus = AppStartupStatus.Cancelled; throw; } HandleEncryptionSetCache(); UserInfo = personInfo != null ? new UserInfo(personInfo) : null; m_localVault.RecordStores.ResetRecordObjects(UserInfo); await SaveUserInfoAsync(cancelToken); return AppStartupStatus.Success; }
public IAsyncOperation<bool> CreateAccountAsync(CreateAccountPersonInfo createAccountPersonInfo) { return AsyncInfo.Run( async cancelToken => { try { return await CreateAccountAsync( createAccountPersonInfo, cancelToken); } catch (TaskCanceledException) { m_startupStatus = AppStartupStatus.Cancelled; throw; } }); }
public IAsyncOperation<IsValidHealthVaultAccountResponse> HasAccountAsync() { return AsyncInfo.Run( async cancelToken => { try { return await m_client.IsValidHealthVaultAccount<IsValidHealthVaultAccountResponse>( cancelToken); } catch (TaskCanceledException) { m_startupStatus = AppStartupStatus.Cancelled; throw; } }); }
public IAsyncAction StartAsync() { m_startupStatus = AppStartupStatus.Pending; return AsyncInfo.Run(EnsureProvisionedAsync); }