1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-20 10:13:42 +00:00

redid lock pin page with pin control.

This commit is contained in:
Kyle Spearrin
2016-06-06 18:48:52 -04:00
parent 2c19413275
commit 89e4189779
6 changed files with 96 additions and 104 deletions

View File

@@ -0,0 +1,45 @@
using System;
using Bit.App.Models.Page;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class PinControl
{
private Action _pinEnteredAction;
public PinControl(Action pinEnteredAction)
{
_pinEnteredAction = pinEnteredAction;
Label = new Label
{
HorizontalTextAlignment = TextAlignment.Center,
FontSize = 30,
TextColor = Color.FromHex("333333"),
FontFamily = "Courier"
};
Label.SetBinding<PinPageModel>(Label.TextProperty, s => s.LabelText);
Entry = new ExtendedEntry
{
Keyboard = Keyboard.Numeric,
IsVisible = false,
MaxLength = 4
};
Entry.SetBinding<PinPageModel>(Xamarin.Forms.Entry.TextProperty, s => s.PIN);
Entry.TextChanged += PinEntry_TextChanged;
}
private void PinEntry_TextChanged(object sender, TextChangedEventArgs e)
{
if(e.NewTextValue.Length >= 4)
{
_pinEnteredAction();
}
}
public Label Label { get; set; }
public ExtendedEntry Entry { get; set; }
}
}