mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
PIN dialog for tech page
This commit is contained in:
@@ -346,6 +346,9 @@ namespace PepperDash.Essentials
|
|||||||
/// 12345
|
/// 12345
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint AvNoControlsSubVisible = 12345;
|
public const uint AvNoControlsSubVisible = 12345;
|
||||||
|
|
||||||
|
// 10000 - 14999 are general "source" pages
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 15001
|
/// 15001
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -610,5 +613,36 @@ namespace PepperDash.Essentials
|
|||||||
/// 15091
|
/// 15091
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint SetupFullDistrib = 15091;
|
public const uint SetupFullDistrib = 15091;
|
||||||
|
|
||||||
|
// PIN dialogs ************************************
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 15201
|
||||||
|
/// </summary>
|
||||||
|
public const uint PinDialog4DigitVisible = 15201;
|
||||||
|
/// <summary>
|
||||||
|
/// 15206
|
||||||
|
/// </summary>
|
||||||
|
public const uint PinDialogCancelPress = 15206;
|
||||||
|
/// <summary>
|
||||||
|
/// 15207
|
||||||
|
/// </summary>
|
||||||
|
public const uint PinDialogErrorVisible = 15207;
|
||||||
|
/// <summary>
|
||||||
|
/// 15211
|
||||||
|
/// </summary>
|
||||||
|
public const uint PinDialogDot1 = 15211;
|
||||||
|
/// <summary>
|
||||||
|
/// 15212
|
||||||
|
/// </summary>
|
||||||
|
public const uint PinDialogDot2 = 15212;
|
||||||
|
/// <summary>
|
||||||
|
/// 15213
|
||||||
|
/// </summary>
|
||||||
|
public const uint PinDialogDot3 = 15213;
|
||||||
|
/// <summary>
|
||||||
|
/// 15214
|
||||||
|
/// </summary>
|
||||||
|
public const uint PinDialogDot4 = 15214;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,10 @@
|
|||||||
/// 3902 Tech page statuses
|
/// 3902 Tech page statuses
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint TechStatusList = 3902;
|
public const uint TechStatusList = 3902;
|
||||||
|
/// <summary>
|
||||||
|
/// 3903
|
||||||
|
/// </summary>
|
||||||
|
public const uint TechPinDialogKeypad = 3903;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,6 +42,16 @@ namespace PepperDash.Essentials.UIDrivers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint JoinText = 1;
|
public const uint JoinText = 1;
|
||||||
|
|
||||||
|
CTimer PinAuthorizedTimer;
|
||||||
|
|
||||||
|
string Pin;
|
||||||
|
|
||||||
|
StringBuilder PinEntryBuilder = new StringBuilder(4);
|
||||||
|
|
||||||
|
bool IsAuthorized;
|
||||||
|
|
||||||
|
SmartObjectNumeric PinKeypad;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -49,10 +59,12 @@ namespace PepperDash.Essentials.UIDrivers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="trilist"></param>
|
/// <param name="trilist"></param>
|
||||||
/// <param name="parent"></param>
|
/// <param name="parent"></param>
|
||||||
public EssentialsHuddleTechPageDriver(BasicTriListWithSmartObject trilist, IAVDriver parent)
|
public EssentialsHuddleTechPageDriver(BasicTriListWithSmartObject trilist, IAVDriver parent, string pin)
|
||||||
: base(trilist)
|
: base(trilist)
|
||||||
{
|
{
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
|
Pin = pin;
|
||||||
|
|
||||||
PagesInterlock = new JoinedSigInterlock(trilist);
|
PagesInterlock = new JoinedSigInterlock(trilist);
|
||||||
PagesInterlock.SetButDontShow(UIBoolJoin.TechSystemStatusVisible);
|
PagesInterlock.SetButDontShow(UIBoolJoin.TechSystemStatusVisible);
|
||||||
|
|
||||||
@@ -83,6 +95,8 @@ namespace PepperDash.Essentials.UIDrivers
|
|||||||
MenuList.Count = 3;
|
MenuList.Count = 3;
|
||||||
|
|
||||||
BuildStatusList();
|
BuildStatusList();
|
||||||
|
|
||||||
|
SetupPinModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -90,9 +104,21 @@ namespace PepperDash.Essentials.UIDrivers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Show()
|
public override void Show()
|
||||||
{
|
{
|
||||||
TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, true);
|
// divert to PIN if we need auth
|
||||||
PagesInterlock.Show();
|
if (IsAuthorized)
|
||||||
base.Show();
|
{
|
||||||
|
// Cancel the auth timer so we don't deauth after coming back in
|
||||||
|
if (PinAuthorizedTimer != null)
|
||||||
|
PinAuthorizedTimer.Stop();
|
||||||
|
|
||||||
|
TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, true);
|
||||||
|
PagesInterlock.Show();
|
||||||
|
base.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TriList.SetBool(UIBoolJoin.PinDialog4DigitVisible, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -100,11 +126,93 @@ namespace PepperDash.Essentials.UIDrivers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Hide()
|
public override void Hide()
|
||||||
{
|
{
|
||||||
|
// Leave it authorized for 60 seconds.
|
||||||
|
if (IsAuthorized)
|
||||||
|
PinAuthorizedTimer = new CTimer(o => {
|
||||||
|
IsAuthorized = false;
|
||||||
|
PinAuthorizedTimer = null;
|
||||||
|
}, 60000);
|
||||||
TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, false);
|
TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, false);
|
||||||
PagesInterlock.Hide();
|
PagesInterlock.Hide();
|
||||||
base.Hide();
|
base.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wire up the keypad and buttons
|
||||||
|
/// </summary>
|
||||||
|
void SetupPinModal()
|
||||||
|
{
|
||||||
|
TriList.SetSigFalseAction(UIBoolJoin.PinDialogCancelPress, CancelPinDialog);
|
||||||
|
PinKeypad = new SmartObjectNumeric(TriList.SmartObjects[UISmartObjectJoin.TechPinDialogKeypad], true);
|
||||||
|
PinKeypad.Digit0.UserObject = new Action<bool>(b => { if (b)DialPinDigit('0'); });
|
||||||
|
PinKeypad.Digit1.UserObject = new Action<bool>(b => { if (b)DialPinDigit('1'); });
|
||||||
|
PinKeypad.Digit2.UserObject = new Action<bool>(b => { if (b)DialPinDigit('2'); });
|
||||||
|
PinKeypad.Digit3.UserObject = new Action<bool>(b => { if (b)DialPinDigit('3'); });
|
||||||
|
PinKeypad.Digit4.UserObject = new Action<bool>(b => { if (b)DialPinDigit('4'); });
|
||||||
|
PinKeypad.Digit5.UserObject = new Action<bool>(b => { if (b)DialPinDigit('5'); });
|
||||||
|
PinKeypad.Digit6.UserObject = new Action<bool>(b => { if (b)DialPinDigit('6'); });
|
||||||
|
PinKeypad.Digit7.UserObject = new Action<bool>(b => { if (b)DialPinDigit('7'); });
|
||||||
|
PinKeypad.Digit8.UserObject = new Action<bool>(b => { if (b)DialPinDigit('8'); });
|
||||||
|
PinKeypad.Digit9.UserObject = new Action<bool>(b => { if (b)DialPinDigit('9'); });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="d"></param>
|
||||||
|
void DialPinDigit(char d)
|
||||||
|
{
|
||||||
|
PinEntryBuilder.Append(d);
|
||||||
|
var len = PinEntryBuilder.Length;
|
||||||
|
SetPinDotsFeedback(len);
|
||||||
|
|
||||||
|
// check it!
|
||||||
|
if (len == 4)
|
||||||
|
{
|
||||||
|
if (Pin == PinEntryBuilder.ToString())
|
||||||
|
{
|
||||||
|
IsAuthorized = true;
|
||||||
|
SetPinDotsFeedback(0);
|
||||||
|
TriList.SetBool(UIBoolJoin.PinDialog4DigitVisible, false);
|
||||||
|
Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetPinDotsFeedback(0);
|
||||||
|
TriList.SetBool(UIBoolJoin.PinDialogErrorVisible, true);
|
||||||
|
new CTimer(o =>
|
||||||
|
{
|
||||||
|
TriList.SetBool(UIBoolJoin.PinDialogErrorVisible, false);
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
|
PinEntryBuilder.Remove(0, len); // clear it either way
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Draws the dots as pin is entered
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="len"></param>
|
||||||
|
void SetPinDotsFeedback(int len)
|
||||||
|
{
|
||||||
|
TriList.SetBool(UIBoolJoin.PinDialogDot1, len >= 1);
|
||||||
|
TriList.SetBool(UIBoolJoin.PinDialogDot2, len >= 2);
|
||||||
|
TriList.SetBool(UIBoolJoin.PinDialogDot3, len >= 3);
|
||||||
|
TriList.SetBool(UIBoolJoin.PinDialogDot4, len == 4);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Does what it says
|
||||||
|
/// </summary>
|
||||||
|
void CancelPinDialog()
|
||||||
|
{
|
||||||
|
PinEntryBuilder.Remove(0, PinEntryBuilder.Length);
|
||||||
|
TriList.SetBool(UIBoolJoin.PinDialog4DigitVisible, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -139,7 +139,8 @@ namespace PepperDash.Essentials
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_TechDriver == null)
|
if (_TechDriver == null)
|
||||||
_TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, this);
|
#warning Make PIN come from config!
|
||||||
|
_TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, this, "1234");
|
||||||
return _TechDriver;
|
return _TechDriver;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user