bitwarden-android/src/App/Controls/PinControl.cs

40 lines
962 B
C#
Raw Normal View History

2016-06-07 01:48:52 +03:00
using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class PinControl
{
2016-06-12 07:49:35 +03:00
public EventHandler OnPinEntered;
2016-06-07 01:48:52 +03:00
2016-06-12 07:49:35 +03:00
public PinControl()
2016-06-07 01:48:52 +03:00
{
Label = new Label
{
HorizontalTextAlignment = TextAlignment.Center,
FontSize = 30,
FontFamily = "Courier"
};
Entry = new ExtendedEntry
{
Keyboard = Keyboard.Numeric,
2016-06-07 04:13:00 +03:00
MaxLength = 4,
Margin = new Thickness(0, int.MaxValue, 0, 0)
2016-06-07 01:48:52 +03:00
};
Entry.TextChanged += Entry_TextChanged;
2016-06-07 01:48:52 +03:00
}
private void Entry_TextChanged(object sender, TextChangedEventArgs e)
2016-06-07 01:48:52 +03:00
{
2016-06-12 07:49:35 +03:00
if(e.NewTextValue.Length >= 4)
{
2016-06-12 07:49:35 +03:00
OnPinEntered.Invoke(this, null);
}
}
2016-06-07 01:48:52 +03:00
public Label Label { get; set; }
public ExtendedEntry Entry { get; set; }
}
}