Merge remote-tracking branch 'origin/bugfix/ecs-535' into bugfix/ecs-541

This commit is contained in:
Neil Dorin
2017-10-19 15:12:55 -06:00
7 changed files with 166 additions and 46 deletions

View File

@@ -36,6 +36,8 @@ namespace PepperDash.Essentials.Core.Touchpanels.Keyboards
public Action HideAction { get; set; } public Action HideAction { get; set; }
CTimer BackspaceTimer;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@@ -88,7 +90,8 @@ namespace PepperDash.Essentials.Core.Touchpanels.Keyboards
TriList.SetSigTrueAction(2947, () => Press('.')); TriList.SetSigTrueAction(2947, () => Press('.'));
TriList.SetSigTrueAction(2948, () => Press('@')); TriList.SetSigTrueAction(2948, () => Press('@'));
TriList.SetSigTrueAction(2949, () => Press(' ')); TriList.SetSigTrueAction(2949, () => Press(' '));
TriList.SetSigTrueAction(2950, Backspace); TriList.SetSigHeldAction(2950, 500, StartBackspaceRepeat, StopBackspaceRepeat, Backspace);
//TriList.SetSigTrueAction(2950, Backspace);
TriList.SetSigTrueAction(2951, Shift); TriList.SetSigTrueAction(2951, Shift);
TriList.SetSigTrueAction(2952, NumShift); TriList.SetSigTrueAction(2952, NumShift);
TriList.SetSigTrueAction(2953, Clear); TriList.SetSigTrueAction(2953, Clear);
@@ -204,6 +207,28 @@ namespace PepperDash.Essentials.Core.Touchpanels.Keyboards
char Y(int i) { return new char[] { 'y', 'Y', '6', '^' }[i]; } char Y(int i) { return new char[] { 'y', 'Y', '6', '^' }[i]; }
char Z(int i) { return new char[] { 'z', 'Z', ',', ',' }[i]; } char Z(int i) { return new char[] { 'z', 'Z', ',', ',' }[i]; }
/// <summary>
/// Does what it says
/// </summary>
void StartBackspaceRepeat()
{
if (BackspaceTimer == null)
{
BackspaceTimer = new CTimer(o => Backspace(), null, 0, 175);
}
}
/// <summary>
/// Does what it says
/// </summary>
void StopBackspaceRepeat()
{
if (BackspaceTimer != null)
{
BackspaceTimer.Stop();
BackspaceTimer = null;
}
}
void Backspace() void Backspace()
{ {

View File

@@ -77,7 +77,7 @@ namespace PepperDash.Essentials.Core
/// Sets an action to a held sig as well as a released-without-hold action /// Sets an action to a held sig as well as a released-without-hold action
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static BoolOutputSig SetSigHeldAction(this BoolOutputSig sig, uint heldMs, Action heldAction, Action releaseAction) public static BoolOutputSig SetSigHeldAction(this BoolOutputSig sig, uint heldMs, Action heldAction, Action holdReleasedAction, Action releaseAction)
{ {
CTimer heldTimer = null; CTimer heldTimer = null;
bool wasHeld = false; bool wasHeld = false;
@@ -98,12 +98,18 @@ namespace PepperDash.Essentials.Core
} }
}, heldMs); }, heldMs);
} }
else if (!wasHeld) // released else if (!press && !wasHeld) // released, no hold
{ {
heldTimer.Stop(); heldTimer.Stop();
if (releaseAction != null) if (releaseAction != null)
releaseAction(); releaseAction();
} }
else // !press && wasHeld // released after held
{
heldTimer.Stop();
if (holdReleasedAction != null)
holdReleasedAction();
}
}); });
} }
@@ -114,9 +120,19 @@ namespace PepperDash.Essentials.Core
/// <returns>The sig</returns> /// <returns>The sig</returns>
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction, Action releaseAction) public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction, Action releaseAction)
{ {
return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, releaseAction); return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, null, releaseAction);
} }
/// <summary>
/// Sets an action to a held sig, an action for the release of hold, as well as a released-without-hold action
/// </summary>
/// <returns></returns>
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction,
Action holdReleasedAction, Action releaseAction)
{
return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, holdReleasedAction, releaseAction);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@@ -908,6 +908,7 @@ namespace PepperDash.Essentials
HeaderGearButton.SetIcon(HeaderListButton.Gear); HeaderGearButton.SetIcon(HeaderListButton.Gear);
HeaderGearButton.OutputSig.SetSigHeldAction(2000, HeaderGearButton.OutputSig.SetSigHeldAction(2000,
ShowTech, ShowTech,
null,
() => () =>
{ {
if (CurrentRoom.OnFeedback.BoolValue) if (CurrentRoom.OnFeedback.BoolValue)

View File

@@ -22,11 +22,13 @@ namespace PepperDash.Essentials
} }
/// <summary> /// <summary>
/// Hides CurrentJoin and shows join. Does nothing when resending CurrentJoin /// Hides CurrentJoin and shows join. Will check and re-set signal if join
/// equals CurrentJoin
/// </summary> /// </summary>
public void ShowInterlocked(uint join) public void ShowInterlocked(uint join)
{ {
if (CurrentJoin == join) Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
if (CurrentJoin == join && TriList.BooleanInput[join].BoolValue)
return; return;
SetButDontShow(join); SetButDontShow(join);
TriList.SetBool(CurrentJoin, true); TriList.SetBool(CurrentJoin, true);
@@ -38,7 +40,8 @@ namespace PepperDash.Essentials
/// <param name="join"></param> /// <param name="join"></param>
public void ShowInterlockedWithToggle(uint join) public void ShowInterlockedWithToggle(uint join)
{ {
if (CurrentJoin == join) Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
if (CurrentJoin == join)
HideAndClear(); HideAndClear();
else else
{ {
@@ -53,6 +56,7 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void HideAndClear() public void HideAndClear()
{ {
Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
Hide(); Hide();
CurrentJoin = 0; CurrentJoin = 0;
} }
@@ -63,7 +67,8 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void Hide() public void Hide()
{ {
if (CurrentJoin > 0) Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
if (CurrentJoin > 0)
TriList.BooleanInput[CurrentJoin].BoolValue = false; TriList.BooleanInput[CurrentJoin].BoolValue = false;
} }
@@ -72,7 +77,8 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void Show() public void Show()
{ {
if (CurrentJoin > 0) Debug.Console(2, "Trilist {0:X2}, interlock showing {1}", TriList.ID, CurrentJoin);
if (CurrentJoin > 0)
TriList.BooleanInput[CurrentJoin].BoolValue = true; TriList.BooleanInput[CurrentJoin].BoolValue = true;
} }

View File

@@ -88,6 +88,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
bool CodecHasFavorites; bool CodecHasFavorites;
CTimer BackspaceTimer;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@@ -176,7 +178,9 @@ namespace PepperDash.Essentials.UIDrivers.VC
TriList.SetSigFalseAction(UIBoolJoin.VCDirectorySearchTextPress, RevealKeyboard); TriList.SetSigFalseAction(UIBoolJoin.VCDirectorySearchTextPress, RevealKeyboard);
TriList.SetSigFalseAction(UIBoolJoin.VCDirectoryBackspacePress, SearchKeypadBackspacePress); //TriList.SetSigFalseAction(UIBoolJoin.VCDirectoryBackspacePress, SearchKeypadBackspacePress);
TriList.SetSigHeldAction(UIBoolJoin.VCDirectoryBackspacePress, 500,
StartSearchBackspaceRepeat, StopSearchBackspaceRepeat, SearchKeypadBackspacePress);
CallSharingInfoVisibleFeedback = new BoolFeedback(() => !string.IsNullOrEmpty(Codec.SharingSourceFeedback.StringValue)); CallSharingInfoVisibleFeedback = new BoolFeedback(() => !string.IsNullOrEmpty(Codec.SharingSourceFeedback.StringValue));
CallSharingInfoVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.CallSharedSourceInfoEnable]); CallSharingInfoVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.CallSharedSourceInfoEnable]);
@@ -253,7 +257,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
KeypadMode = eKeypadMode.DTMF; KeypadMode = eKeypadMode.DTMF;
DialStringBuilder.Remove(0, DialStringBuilder.Length); DialStringBuilder.Remove(0, DialStringBuilder.Length);
DialStringFeedback.FireUpdate(); DialStringFeedback.FireUpdate();
TriList.SetBool(UIBoolJoin.VCKeypadVisible, false); DialStringTextCheckEnables();
Parent.ShowNotificationRibbon("Connected", 2000); Parent.ShowNotificationRibbon("Connected", 2000);
StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress); StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress);
VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCKeypadVisible); VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCKeypadVisible);
@@ -432,7 +436,9 @@ namespace PepperDash.Essentials.UIDrivers.VC
DialKeypad.Misc1.SetSigFalseAction(() => DialKeypadPress("*")); DialKeypad.Misc1.SetSigFalseAction(() => DialKeypadPress("*"));
DialKeypad.Misc2SigName = "#"; DialKeypad.Misc2SigName = "#";
DialKeypad.Misc2.SetSigFalseAction(() => DialKeypadPress("#")); DialKeypad.Misc2.SetSigFalseAction(() => DialKeypadPress("#"));
TriList.SetSigFalseAction(UIBoolJoin.VCKeypadBackspacePress, DialKeypadBackspacePress); //TriList.SetSigFalseAction(UIBoolJoin.VCKeypadBackspacePress, DialKeypadBackspacePress);
TriList.SetSigHeldAction(UIBoolJoin.VCKeypadBackspacePress, 500,
StartBackspaceRepeat, StopBackspaceRepeat, DialKeypadBackspacePress);
} }
else else
Debug.Console(0, "Trilist {0:x2}, VC dial keypad object {1} not found. Check SGD file or VTP", Debug.Console(0, "Trilist {0:x2}, VC dial keypad object {1} not found. Check SGD file or VTP",
@@ -769,17 +775,19 @@ namespace PepperDash.Essentials.UIDrivers.VC
if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCKeypadWithFavoritesVisible && KeypadMode == eKeypadMode.Dial) if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCKeypadWithFavoritesVisible && KeypadMode == eKeypadMode.Dial)
{ {
var kb = Parent.Keyboard; var kb = Parent.Keyboard;
kb.KeyPress += new EventHandler<PepperDash.Essentials.Core.Touchpanels.Keyboards.KeyboardControllerPressEventArgs>(Keyboard_KeyPress); kb.KeyPress -= Keyboard_DialKeyPress;
kb.KeyPress += Keyboard_DialKeyPress;
kb.HideAction = this.DetachDialKeyboard; kb.HideAction = this.DetachDialKeyboard;
kb.GoButtonText = "Connect"; kb.GoButtonText = "Connect";
kb.GoButtonVisible = true; kb.GoButtonVisible = true;
DialStringKeypadCheckEnables(); DialStringTextCheckEnables();
kb.Show(); kb.Show();
} }
else if(VCControlsInterlock.CurrentJoin == UIBoolJoin.VCDirectoryVisible) else if(VCControlsInterlock.CurrentJoin == UIBoolJoin.VCDirectoryVisible)
{ {
var kb = Parent.Keyboard; var kb = Parent.Keyboard;
kb.KeyPress += new EventHandler<KeyboardControllerPressEventArgs>(Search_KeyPress); kb.KeyPress -= Keyboard_SearchKeyPress;
kb.KeyPress += Keyboard_SearchKeyPress;
kb.HideAction = this.DetachSearchKeyboard; kb.HideAction = this.DetachSearchKeyboard;
kb.GoButtonText = "Search"; kb.GoButtonText = "Search";
kb.GoButtonVisible = true; kb.GoButtonVisible = true;
@@ -789,33 +797,37 @@ namespace PepperDash.Essentials.UIDrivers.VC
} }
/// <summary> /// <summary>
/// /// Event handler for keyboard dialing
/// </summary> /// </summary>
void Keyboard_KeyPress(object sender, PepperDash.Essentials.Core.Touchpanels.Keyboards.KeyboardControllerPressEventArgs e) void Keyboard_DialKeyPress(object sender, PepperDash.Essentials.Core.Touchpanels.Keyboards.KeyboardControllerPressEventArgs e)
{ {
if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCKeypadVisible) if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCKeypadWithFavoritesVisible && KeypadMode == eKeypadMode.Dial)
{ {
if (KeypadMode == eKeypadMode.Dial) if (e.Text != null)
if (e.Text != null) DialStringBuilder.Append(e.Text);
DialStringBuilder.Append(e.Text); else
else {
{ if (e.SpecialKey == KeyboardSpecialKey.Backspace)
if (e.SpecialKey == KeyboardSpecialKey.Backspace) DialKeypadBackspacePress();
DialKeypadBackspacePress(); else if (e.SpecialKey == KeyboardSpecialKey.Clear)
else if (e.SpecialKey == KeyboardSpecialKey.Clear) DialKeypadClear();
DialKeypadClear(); else if (e.SpecialKey == KeyboardSpecialKey.GoButton)
else if (e.SpecialKey == KeyboardSpecialKey.GoButton) {
{ ConnectPress();
ConnectPress(); Parent.Keyboard.Hide();
Parent.Keyboard.Hide(); }
} }
}
DialStringFeedback.FireUpdate(); DialStringFeedback.FireUpdate();
DialStringKeypadCheckEnables(); DialStringTextCheckEnables();
} }
} }
void Search_KeyPress(object sender, KeyboardControllerPressEventArgs e) /// <summary>
/// Event handler for keyboard directory searches
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Keyboard_SearchKeyPress(object sender, KeyboardControllerPressEventArgs e)
{ {
if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCDirectoryVisible) if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCDirectoryVisible)
{ {
@@ -838,14 +850,17 @@ namespace PepperDash.Essentials.UIDrivers.VC
} }
} }
/// <summary>
/// Call
/// </summary>
void DetachDialKeyboard() void DetachDialKeyboard()
{ {
Parent.Keyboard.KeyPress -= Keyboard_KeyPress; Parent.Keyboard.KeyPress -= Keyboard_DialKeyPress;
} }
void DetachSearchKeyboard() void DetachSearchKeyboard()
{ {
Parent.Keyboard.KeyPress -= Search_KeyPress; Parent.Keyboard.KeyPress -= Keyboard_SearchKeyPress;
} }
/// <summary> /// <summary>
@@ -917,7 +932,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
{ {
DialStringBuilder.Append(i); DialStringBuilder.Append(i);
DialStringFeedback.FireUpdate(); DialStringFeedback.FireUpdate();
DialStringKeypadCheckEnables(); DialStringTextCheckEnables();
} }
else else
{ {
@@ -926,16 +941,44 @@ namespace PepperDash.Essentials.UIDrivers.VC
DialStringFeedback.FireUpdate(); DialStringFeedback.FireUpdate();
// no delete key in this mode! // no delete key in this mode!
} }
} }
/// <summary>
/// Does what it says
/// </summary>
void StartBackspaceRepeat()
{
if (BackspaceTimer == null)
{
BackspaceTimer = new CTimer(o => DialKeypadBackspacePress(), null, 0, 175);
}
}
/// <summary>
/// Does what it says
/// </summary>
void StopBackspaceRepeat()
{
if (BackspaceTimer != null)
{
BackspaceTimer.Stop();
BackspaceTimer = null;
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
void DialKeypadBackspacePress() void DialKeypadBackspacePress()
{ {
DialStringBuilder.Remove(DialStringBuilder.Length - 1, 1); if (KeypadMode == eKeypadMode.Dial)
DialStringFeedback.FireUpdate(); {
DialStringKeypadCheckEnables(); DialStringBuilder.Remove(DialStringBuilder.Length - 1, 1);
DialStringFeedback.FireUpdate();
DialStringTextCheckEnables();
}
else
DialKeypadClear();
} }
/// <summary> /// <summary>
@@ -945,13 +988,13 @@ namespace PepperDash.Essentials.UIDrivers.VC
{ {
DialStringBuilder.Remove(0, DialStringBuilder.Length); DialStringBuilder.Remove(0, DialStringBuilder.Length);
DialStringFeedback.FireUpdate(); DialStringFeedback.FireUpdate();
DialStringKeypadCheckEnables(); DialStringTextCheckEnables();
} }
/// <summary> /// <summary>
/// Checks the enabled states of various elements around the keypad /// Checks the enabled states of various elements around the keypad
/// </summary> /// </summary>
void DialStringKeypadCheckEnables() void DialStringTextCheckEnables()
{ {
var textIsEntered = DialStringBuilder.Length > 0; var textIsEntered = DialStringBuilder.Length > 0;
TriList.SetBool(UIBoolJoin.VCKeypadBackspaceVisible, textIsEntered); TriList.SetBool(UIBoolJoin.VCKeypadBackspaceVisible, textIsEntered);
@@ -962,19 +1005,48 @@ namespace PepperDash.Essentials.UIDrivers.VC
Parent.Keyboard.DisableGoButton(); Parent.Keyboard.DisableGoButton();
} }
/// <summary>
///
/// </summary>
void SearchPress() void SearchPress()
{ {
(Codec as IHasDirectory).SearchDirectory(SearchStringBuilder.ToString()); (Codec as IHasDirectory).SearchDirectory(SearchStringBuilder.ToString());
} }
void SearchKeypadPress(string i) /// <summary>
///
/// </summary>
/// <param name="i"></param>
void SearchKeyboardPress(string i)
{ {
SearchStringBuilder.Append(i); SearchStringBuilder.Append(i);
SearchStringFeedback.FireUpdate(); SearchStringFeedback.FireUpdate();
SearchStringKeypadCheckEnables(); SearchStringKeypadCheckEnables();
} }
/// <summary>
/// Does what it says
/// </summary>
void StartSearchBackspaceRepeat()
{
if (BackspaceTimer == null)
{
BackspaceTimer = new CTimer(o => SearchKeypadBackspacePress(), null, 0, 175);
}
}
/// <summary>
/// Does what it says
/// </summary>
void StopSearchBackspaceRepeat()
{
if (BackspaceTimer != null)
{
BackspaceTimer.Stop();
BackspaceTimer = null;
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>