Bitwarden-app-android-iphon.../src/App/Pages/Accounts/LoginPage.xaml.cs

54 lines
1.3 KiB
C#
Raw Normal View History

2019-04-19 15:42:55 +02:00
using System;
using Xamarin.Forms;
namespace Bit.App.Pages
{
2019-05-01 21:29:57 +02:00
public partial class LoginPage : BaseContentPage
2019-04-19 15:42:55 +02:00
{
private LoginPageViewModel _vm;
public LoginPage()
{
InitializeComponent();
_vm = BindingContext as LoginPageViewModel;
_vm.Page = this;
2019-05-01 21:29:57 +02:00
MasterPasswordEntry = _masterPassword;
2019-05-31 18:02:40 +02:00
_email.ReturnType = ReturnType.Next;
_email.ReturnCommand = new Command(() => _masterPassword.Focus());
2019-05-01 21:29:57 +02:00
}
public Entry MasterPasswordEntry { get; set; }
protected override async void OnAppearing()
{
base.OnAppearing();
await _vm.InitAsync();
if(string.IsNullOrWhiteSpace(_vm.Email))
{
RequestFocus(_email);
}
else
{
RequestFocus(_masterPassword);
}
2019-04-19 15:42:55 +02:00
}
private async void LogIn_Clicked(object sender, EventArgs e)
{
2019-05-07 05:30:54 +02:00
if(DoOnce())
{
await _vm.LogInAsync();
}
2019-04-19 15:42:55 +02:00
}
2019-05-01 21:53:56 +02:00
private void Hint_Clicked(object sender, EventArgs e)
{
2019-05-07 05:30:54 +02:00
if(DoOnce())
{
Navigation.PushModalAsync(new NavigationPage(new HintPage()));
}
2019-05-01 21:53:56 +02:00
}
2019-04-19 15:42:55 +02:00
}
}