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,
|
2016-07-23 22:58:50 +03:00
|
|
|
|
FontSize = 35,
|
2016-06-07 01:48:52 +03:00
|
|
|
|
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
|
|
|
|
};
|
2016-06-08 02:19:21 +03:00
|
|
|
|
Entry.TextChanged += Entry_TextChanged;
|
2016-06-07 01:48:52 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-08 02:19:21 +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-08 02:19:21 +03:00
|
|
|
|
{
|
2016-06-12 07:49:35 +03:00
|
|
|
|
OnPinEntered.Invoke(this, null);
|
2016-06-08 02:19:21 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-07 01:48:52 +03:00
|
|
|
|
public Label Label { get; set; }
|
|
|
|
|
public ExtendedEntry Entry { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|