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) private async void Submit_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{ {
await _vm.SubmitAsync(); await _vm.SubmitAsync();
} }
} }
}
} }

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@ using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
public partial class HomePage : ContentPage public partial class HomePage : BaseContentPage
{ {
public HomePage() public HomePage()
{ {
@ -11,18 +11,27 @@ namespace Bit.App.Pages
} }
private void LogIn_Clicked(object sender, EventArgs e) private void LogIn_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{ {
Navigation.PushModalAsync(new NavigationPage(new LoginPage())); Navigation.PushModalAsync(new NavigationPage(new LoginPage()));
} }
}
private void Register_Clicked(object sender, EventArgs e) private void Register_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{ {
Navigation.PushModalAsync(new NavigationPage(new RegisterPage())); Navigation.PushModalAsync(new NavigationPage(new RegisterPage()));
} }
}
private void Settings_Clicked(object sender, EventArgs e) private void Settings_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{ {
Navigation.PushModalAsync(new NavigationPage(new EnvironmentPage())); 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) private async void LogIn_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{ {
await _vm.LogInAsync(); await _vm.LogInAsync();
} }
}
private void Hint_Clicked(object sender, EventArgs e) private void Hint_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{ {
Navigation.PushModalAsync(new NavigationPage(new HintPage())); Navigation.PushModalAsync(new NavigationPage(new HintPage()));
} }
} }
}
} }

View file

@ -19,6 +19,7 @@ namespace Bit.App.Pages
private readonly IStorageService _storageService; private readonly IStorageService _storageService;
private bool _showPassword; private bool _showPassword;
private string _email;
public LoginPageViewModel() 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 Command TogglePasswordCommand { get; }
public string ShowPasswordIcon => ShowPassword ? "" : ""; public string ShowPasswordIcon => ShowPassword ? "" : "";
public string Email { get; set; }
public string MasterPassword { get; set; } public string MasterPassword { get; set; }
public bool RememberEmail { get; set; } public bool RememberEmail { get; set; }

View file

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