1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-30 04:17:55 +02:00
bitwarden-mobile/src/App/Pages/Accounts/TwoFactorPage.xaml.cs

72 lines
1.7 KiB
C#
Raw Normal View History

2019-05-27 17:57:10 +02:00
using Bit.App.Controls;
using System;
2019-05-28 15:04:20 +02:00
using System.Threading.Tasks;
2019-05-24 03:19:45 +02:00
namespace Bit.App.Pages
{
public partial class TwoFactorPage : BaseContentPage
{
private TwoFactorPageViewModel _vm;
public TwoFactorPage()
{
InitializeComponent();
_vm = BindingContext as TwoFactorPageViewModel;
_vm.Page = this;
2019-05-27 17:57:10 +02:00
DuoWebView = _duoWebView;
2019-05-28 15:04:20 +02:00
SetActivityIndicator();
2019-05-24 03:19:45 +02:00
}
2019-05-27 17:57:10 +02:00
public HybridWebView DuoWebView { get; set; }
2019-05-28 15:12:05 +02:00
public void AddContinueButton()
{
if(ToolbarItems.Count == 0)
{
ToolbarItems.Add(_continueItem);
}
}
public void RemoveContinueButton()
{
if(ToolbarItems.Count > 0)
{
ToolbarItems.Remove(_continueItem);
}
}
2019-05-28 15:04:20 +02:00
protected async override void OnAppearing()
2019-05-24 03:19:45 +02:00
{
base.OnAppearing();
2019-05-28 15:04:20 +02:00
await LoadOnAppearedAsync(_scrollView, true, () =>
{
_vm.Init();
return Task.FromResult(0);
});
2019-05-24 03:19:45 +02:00
}
2019-05-27 16:28:38 +02:00
private async void Continue_Clicked(object sender, EventArgs e)
2019-05-24 03:19:45 +02:00
{
if(DoOnce())
{
2019-05-27 16:28:38 +02:00
await _vm.SubmitAsync();
2019-05-24 03:19:45 +02:00
}
}
2019-05-27 16:28:38 +02:00
private async void Methods_Clicked(object sender, EventArgs e)
2019-05-24 03:19:45 +02:00
{
if(DoOnce())
{
2019-05-27 16:28:38 +02:00
await _vm.AnotherMethodAsync();
}
}
2019-05-24 03:19:45 +02:00
2019-05-27 16:28:38 +02:00
private async void ResendEmail_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.SendEmailAsync(true, true);
2019-05-24 03:19:45 +02:00
}
}
}
}