1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-22 19:23:58 +00:00
Files
mobile/src/App/Pages/Accounts/TwoFactorPage.xaml.cs
2019-05-28 09:12:05 -04:00

72 lines
1.7 KiB
C#

using Bit.App.Controls;
using System;
using System.Threading.Tasks;
namespace Bit.App.Pages
{
public partial class TwoFactorPage : BaseContentPage
{
private TwoFactorPageViewModel _vm;
public TwoFactorPage()
{
InitializeComponent();
_vm = BindingContext as TwoFactorPageViewModel;
_vm.Page = this;
DuoWebView = _duoWebView;
SetActivityIndicator();
}
public HybridWebView DuoWebView { get; set; }
public void AddContinueButton()
{
if(ToolbarItems.Count == 0)
{
ToolbarItems.Add(_continueItem);
}
}
public void RemoveContinueButton()
{
if(ToolbarItems.Count > 0)
{
ToolbarItems.Remove(_continueItem);
}
}
protected async override void OnAppearing()
{
base.OnAppearing();
await LoadOnAppearedAsync(_scrollView, true, () =>
{
_vm.Init();
return Task.FromResult(0);
});
}
private async void Continue_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.SubmitAsync();
}
}
private async void Methods_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.AnotherMethodAsync();
}
}
private async void ResendEmail_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.SendEmailAsync(true, true);
}
}
}
}