private async void OnUserUpdate(UserManager.GoogleUserData userData)
        {
            ButtonRecord.IsEnabled = false;
            _assistant.Shutdown();
            if (userData != null)
            {
                _assistant.InitAssistantForUser(_userManager.GetChannelCredential());
                ButtonRecord.IsEnabled = true;
            }

            if (string.IsNullOrEmpty(settings.DeviceModelId))
            {
                string deviceModelId = await deviceRegistration.RegisterDeviceModel(settings.ProjectId, _userManager.Credential);

                string deviceId = await deviceRegistration.RegisterDeviceInstance(settings.ProjectId, _userManager.Credential, deviceModelId);

                settings.DeviceModelId = deviceModelId;
                settings.DeviceId      = deviceId;
            }

            if (string.IsNullOrEmpty(settings.DeviceId))
            {
                string deviceId = await deviceRegistration.RegisterDeviceInstance(settings.ProjectId, _userManager.Credential, settings.DeviceModelId);

                settings.DeviceId = deviceId;
            }

            settings.Save();
        }
Esempio n. 2
0
 private void OnUserUpdate(UserManager.GoogleUserData userData)
 {
     ButtonRecord.IsEnabled = false;
     _assistant.Shutdown();
     if (userData != null)
     {
         _assistant.InitAssistantForUser(_userManager.GetChannelCredential());
         ButtonRecord.IsEnabled = true;
     }
 }
Esempio n. 3
0
        private void UpdateProfile(UserManager.GoogleUserData userData)
        {
            if (TextBlockName.Dispatcher.CheckAccess())
            {
                GridSignedIn.Visibility      = userData != null ? Visibility.Visible : Visibility.Hidden;
                ImageGoogleSignIn.Visibility = userData == null ? Visibility.Visible : Visibility.Hidden;

                if (userData != null)
                {
                    TextBlockName.Text = userData.name;
                    ImageAvatar.Source = new BitmapImage(new Uri(Utils.GetDataStoreFolder() + userData.id + ".png"));
                }
            }
            else
            {
                TextBlockName.Dispatcher.BeginInvoke(new Action(() => UpdateProfile(userData)));
            }
        }
Esempio n. 4
0
 private void OnUserUpdate(UserManager.GoogleUserData userdata)
 {
     UpdateProfile(userdata);
 }