more do once and other cleanup

This commit is contained in:
Kyle Spearrin 2019-05-06 23:30:54 -04:00
parent 7d3ef39f67
commit 8c31c7290c
8 changed files with 43 additions and 20 deletions

View file

@ -14,8 +14,11 @@ namespace Bit.App.Pages
}
private async void Submit_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.SubmitAsync();
}
}
}
}

View file

@ -23,7 +23,6 @@
Text="{u:I18n EmailAddress}"
StyleClass="box-label" />
<Entry
x:Name="_email"
Text="{Binding Email}"
Keyboard="Email"
StyleClass="box-value" />

View file

@ -13,15 +13,12 @@ namespace Bit.App.Pages
_vm.Page = this;
}
protected override void OnAppearing()
{
base.OnAppearing();
RequestFocus(_email);
}
private async void Submit_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.SubmitAsync();
}
}
}
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
<pages:BaseContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Pages.HomePage"
@ -32,4 +32,4 @@
</StackLayout>
</StackLayout>
</ContentPage>
</pages:BaseContentPage>

View file

@ -3,7 +3,7 @@ using Xamarin.Forms;
namespace Bit.App.Pages
{
public partial class HomePage : ContentPage
public partial class HomePage : BaseContentPage
{
public HomePage()
{
@ -11,18 +11,27 @@ namespace Bit.App.Pages
}
private void LogIn_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
Navigation.PushModalAsync(new NavigationPage(new LoginPage()));
}
}
private void Register_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
Navigation.PushModalAsync(new NavigationPage(new RegisterPage()));
}
}
private void Settings_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
Navigation.PushModalAsync(new NavigationPage(new EnvironmentPage()));
}
}
}
}

View file

@ -32,13 +32,19 @@ namespace Bit.App.Pages
}
private async void LogIn_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.LogInAsync();
}
}
private void Hint_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
Navigation.PushModalAsync(new NavigationPage(new HintPage()));
}
}
}
}

View file

@ -19,6 +19,7 @@ namespace Bit.App.Pages
private readonly IStorageService _storageService;
private bool _showPassword;
private string _email;
public LoginPageViewModel()
{
@ -41,9 +42,14 @@ namespace Bit.App.Pages
});
}
public string Email
{
get => _email;
set => SetProperty(ref _email, value);
}
public Command TogglePasswordCommand { get; }
public string ShowPasswordIcon => ShowPassword ? "" : "";
public string Email { get; set; }
public string MasterPassword { get; set; }
public bool RememberEmail { get; set; }

View file

@ -19,15 +19,18 @@ namespace Bit.App.Pages
public Entry MasterPasswordEntry { get; set; }
public Entry ConfirmMasterPasswordEntry { get; set; }
protected override async void OnAppearing()
protected override void OnAppearing()
{
base.OnAppearing();
RequestFocus(_email);
}
private async void Submit_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{
await _vm.SubmitAsync();
}
}
}
}