bitwarden-android/src/App/Pages/Accounts/LockPage.xaml.cs

72 lines
1.7 KiB
C#
Raw Normal View History

2019-05-16 00:37:59 +03:00
using System;
2019-05-16 15:41:57 +03:00
using System.Threading.Tasks;
2019-05-16 00:37:59 +03:00
using Xamarin.Forms;
namespace Bit.App.Pages
{
public partial class LockPage : BaseContentPage
{
private LockPageViewModel _vm;
public LockPage()
{
InitializeComponent();
_vm = BindingContext as LockPageViewModel;
_vm.Page = this;
MasterPasswordEntry = _masterPassword;
PinEntry = _pin;
}
public Entry MasterPasswordEntry { get; set; }
public Entry PinEntry { get; set; }
protected override async void OnAppearing()
{
base.OnAppearing();
await _vm.InitAsync();
if(!_vm.FingerprintLock)
2019-05-16 00:37:59 +03:00
{
if(_vm.PinLock)
{
RequestFocus(PinEntry);
}
else
{
RequestFocus(MasterPasswordEntry);
}
2019-05-16 00:37:59 +03:00
}
}
2019-05-16 15:41:57 +03:00
private void Unlock_Clicked(object sender, EventArgs e)
2019-05-16 00:37:59 +03:00
{
if(DoOnce())
{
2019-05-16 15:41:57 +03:00
var tasks = Task.Run(async () =>
{
await Task.Delay(50);
Device.BeginInvokeOnMainThread(async () =>
{
await _vm.SubmitAsync();
});
});
2019-05-16 00:37:59 +03:00
}
}
private async void LogOut_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.LogOutAsync();
}
}
2019-05-17 16:42:20 +03:00
private async void Fingerprint_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.PromptFingerprintAsync();
}
}
2019-05-16 00:37:59 +03:00
}
}