示例#1
0
 private async void ScanTotp_Clicked(object sender, System.EventArgs e)
 {
     if (DoOnce())
     {
         var page = new ScanPage(key =>
         {
             Device.BeginInvokeOnMainThread(async() =>
             {
                 await Navigation.PopModalAsync();
                 await _vm.UpdateTotpKeyAsync(key);
             });
         });
         await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
     }
 }
示例#2
0
        private async void TotpButton_Clicked(object sender, EventArgs e)
        {
            var scanPage = new ScanPage((key) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await Navigation.PopModalAsync();
                    if (!string.IsNullOrWhiteSpace(key))
                    {
                        LoginTotpCell.Entry.Text = key;
                        _userDialogs.Toast(AppResources.AuthenticatorKeyAdded);
                    }
                    else
                    {
                        _userDialogs.Alert(AppResources.AuthenticatorKeyReadError);
                    }
                });
            });

            await Navigation.PushModalAsync(new ExtendedNavigationPage(scanPage));
        }
示例#3
0
        private async void ScanTotp_Clicked(object sender, System.EventArgs e)
        {
            if (DoOnce())
            {
                var cameraPermission = await PermissionManager.CheckAndRequestPermissionAsync(new Permissions.Camera());

                if (cameraPermission != PermissionStatus.Granted)
                {
                    return;
                }

                var page = new ScanPage(key =>
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await Navigation.PopModalAsync();
                        await _vm.UpdateTotpKeyAsync(key);
                    });
                });
                await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
            }
        }