示例#1
0
 public override async Task OnNavigateToAsync()
 {
     await LoadAsync(async() =>
     {
         await _connection.AuthenticateAsync();
     });
 }
        private async void ConnectToHealthVaultAsync(object sender, EventArgs eventArgs)
        {
            _statusView.Text = "Connecting...";

            // create a configuration for our HealthVault application
            var configuration = GetPpeConfiguration();

            try
            {
                // get a connection to HealthVault
                _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);
                await _connection.AuthenticateAsync();
            }
            catch (Exception e)
            {
                _statusView.Text = $"Error connecting... {e.ToString()}";
            }

            // get a thing client

            _thingClient = _connection.CreateThingClient();

            PersonInfo personInfo = await _connection.GetPersonInfoAsync();

            // update visual state
            _connectionButton.Visibility = ViewStates.Gone;
            _controlsLayout.Visibility   = ViewStates.Visible;
            _disconnectButton.Visibility = ViewStates.Visible;
            _statusView.Text             = $"Hello {personInfo.Name}";
        }
示例#3
0
        private async Task ConnectToHealthVaultAsync()
        {
            activityIndicator.StartAnimating();
            UpdateTitle("Connecting...");
            statusLabel.Text = "";

            try
            {
                var configuration = GetPpeConfiguration();

                _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);
                await _connection.AuthenticateAsync();

                _thingClient = _connection.CreateThingClient();
                PersonInfo personInfo = await _connection.GetPersonInfoAsync();

                connectButton.SetTitle("Disconnect", UIControlState.Normal);
                SetStatusLabelText("");
                UpdateTitle(personInfo.Name);
                controlView.Hidden = false;
            }
            catch (Exception e)
            {
                UpdateTitle("Error");
                SetStatusLabelText(e.ToString());
                connectButton.SetTitle("Retry", UIControlState.Normal);
            }
        }
示例#4
0
        private async void Connect_OnClick(object sender, RoutedEventArgs e)
        {
            OutputBlock.Text = "Connecting...";

            var configuration = new HealthVaultConfiguration
            {
                MasterApplicationId = Guid.Parse("d6318dff-5352-4a10-a140-6c82c6536a3b")
            };

            _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);
            await _connection.AuthenticateAsync();

            OutputBlock.Text = "Connected.";
        }
示例#5
0
        private async void Connect_OnClicked(object sender, EventArgs e)
        {
            OutputLabel.Text = "Connecting...";

            var configuration = new HealthVaultConfiguration
            {
                MasterApplicationId = Guid.Parse("d6318dff-5352-4a10-a140-6c82c6536a3b")
            };

            _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);

            await _connection.AuthenticateAsync();

            _thingClient = _connection.CreateThingClient();
            ConnectedButtons.IsVisible = true;

            OutputLabel.Text = "Connected.";
        }
示例#6
0
        private async void Connect_OnClick(object sender, RoutedEventArgs e)
        {
            OutputBlock.Text = "Connecting...";

            var configuration = new HealthVaultConfiguration
            {
                MasterApplicationId = Guid.Parse(AppId)
            };

            _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);

            HealthVaultConnectionFactory.ThingTypeRegistrar.RegisterApplicationSpecificHandler(
                applicationId: AppId,
                subtypeTag: CustomDataTypeSubtypeTag,
                applicationSpecificHandlerClass: typeof(CustomDataType));

            await _connection.AuthenticateAsync();

            OutputBlock.Text = "Connected.";
        }