Merged in bugfix/ecs-756 (pull request #1)

Bugfix/ecs 756
This commit is contained in:
Neil Dorin
2018-07-25 16:54:14 +00:00
committed by HeathV
11 changed files with 1544 additions and 1344 deletions

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "essentials-framework"] [submodule "essentials-framework"]
path = essentials-framework path = essentials-framework
url = https://hvolmer@bitbucket.org/Pepperdash_Products/essentials-framework.git url = https://bitbucket.org/Pepperdash_Products/essentials-framework.git

View File

@@ -79,9 +79,9 @@ namespace PepperDash.Essentials
string directoryPrefix; string directoryPrefix;
//directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory(); directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
#warning ^ For use with beta Include4.dat for XiO Edge
directoryPrefix = ""; //directoryPrefix = "";
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server)
{ {
@@ -207,6 +207,9 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void LoadDevices() public void LoadDevices()
{ {
// Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
foreach (var devConf in ConfigReader.ConfigObject.Devices) foreach (var devConf in ConfigReader.ConfigObject.Devices)
{ {
@@ -214,8 +217,15 @@ namespace PepperDash.Essentials
{ {
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}'", devConf.Key); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}'", devConf.Key);
// Skip this to prevent unnecessary warnings // Skip this to prevent unnecessary warnings
if (devConf.Key == "processor") if (devConf.Key == "processor")
continue; {
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
Debug.Console(0,
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
continue;
}
// Try local factory first // Try local factory first
var newDev = DeviceFactory.GetDevice(devConf); var newDev = DeviceFactory.GetDevice(devConf);
@@ -348,7 +358,7 @@ namespace PepperDash.Essentials
{ {
try try
{ {
LogoServer = new HttpLogoServer(8080, Global.FilePathPrefix + "html" + Global.DirectorySeparator + "logo"); LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo");
} }
catch (Exception) catch (Exception)
{ {

View File

@@ -44,9 +44,9 @@ namespace PepperDash.Essentials
// AV Driver // AV Driver
Debug.Console(0, panelController, "Adding huddle space AV driver"); Debug.Console(0, panelController, "Adding huddle space AV driver");
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
avDriver.DefaultRoomKey = props.DefaultRoomKey; avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver; mainDriver.AvDriver = avDriver;
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
// Environment Driver // Environment Driver
if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0) if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0)
@@ -113,9 +113,9 @@ namespace PepperDash.Essentials
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
avDriver.SetVideoCodecDriver(codecDriver); avDriver.SetVideoCodecDriver(codecDriver);
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
avDriver.DefaultRoomKey = props.DefaultRoomKey; avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver; mainDriver.AvDriver = avDriver;
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
// Environment Driver // Environment Driver
if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0) if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0)

View File

@@ -165,10 +165,11 @@
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLargeSetTopBoxGeneric.cs" /> <Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLargeSetTopBoxGeneric.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\LargeTouchpanelControllerBase.cs" /> <Compile Include="FOR REFERENCE UI\PageControllers\LargeTouchpanelControllerBase.cs" />
<Compile Include="FOR REFERENCE UI\Panels\SmartGraphicsTouchpanelControllerBase.cs" /> <Compile Include="FOR REFERENCE UI\Panels\SmartGraphicsTouchpanelControllerBase.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsLightingDriver.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsEnvironmentDriver.cs" /> <Compile Include="UIDrivers\Environment Drivers\EssentialsEnvironmentDriver.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsLightingDriver.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsShadeDriver.cs" /> <Compile Include="UIDrivers\Environment Drivers\EssentialsShadeDriver.cs" />
<Compile Include="UIDrivers\Essentials\EssentialsHeaderDriver.cs" /> <Compile Include="UIDrivers\Essentials\EssentialsHeaderDriver.cs" />
<Compile Include="UIDrivers\JoinedSigInterlock.cs" />
<Compile Include="UIDrivers\SigInterlock.cs" /> <Compile Include="UIDrivers\SigInterlock.cs" />
<Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddlePresentationUiDriver.cs" /> <Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddlePresentationUiDriver.cs" />
<Compile Include="UIDrivers\EssentialsHuddle\EssentialsHuddleTechPageDriver.cs" /> <Compile Include="UIDrivers\EssentialsHuddle\EssentialsHuddleTechPageDriver.cs" />
@@ -176,7 +177,6 @@
<Compile Include="UI\SmartObjectHeaderButtonList.cs" /> <Compile Include="UI\SmartObjectHeaderButtonList.cs" />
<Compile Include="UI\SubpageReferenceListCallStagingItem.cs" /> <Compile Include="UI\SubpageReferenceListCallStagingItem.cs" />
<Compile Include="UIDrivers\VC\EssentialsVideoCodecUiDriver.cs" /> <Compile Include="UIDrivers\VC\EssentialsVideoCodecUiDriver.cs" />
<Compile Include="UIDrivers\JoinedSigInterlock.cs" />
<Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddleVtc1PanelAvFunctionsDriver.cs" /> <Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddleVtc1PanelAvFunctionsDriver.cs" />
<Compile Include="UIDrivers\VolumeAndSourceChangeArgs.cs" /> <Compile Include="UIDrivers\VolumeAndSourceChangeArgs.cs" />
<Compile Include="UI\JoinConstants\UISmartObjectJoin.cs" /> <Compile Include="UI\JoinConstants\UISmartObjectJoin.cs" />

View File

@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")]
[assembly: AssemblyVersion("1.2.0.*")] [assembly: AssemblyVersion("1.2.4.*")]

View File

@@ -7,6 +7,7 @@ using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Net.Http; using Crestron.SimplSharp.Net.Http;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
@@ -64,10 +65,14 @@ namespace PepperDash.Essentials
void Server_OnHttpRequest(object sender, OnHttpRequestArgs args) void Server_OnHttpRequest(object sender, OnHttpRequestArgs args)
{ {
var path = args.Request.Path; var path = args.Request.Path;
if (File.Exists(FileDirectory + @"\" + path)) Debug.Console(2, "HTTP Request with path: '{0}'", args.Request.Path);
if (File.Exists(FileDirectory + path))
{ {
string filePath = path.Replace('/', '\\'); string filePath = path.Replace('/', '\\');
string localPath = string.Format(@"{0}{1}", FileDirectory, filePath); string localPath = string.Format(@"{0}{1}", FileDirectory, filePath);
Debug.Console(2, "HTTP Logo Server attempting to find file: '{0}'", localPath);
if (File.Exists(localPath)) if (File.Exists(localPath))
{ {
args.Response.Header.ContentType = GetContentType(new FileInfo(localPath).Extension); args.Response.Header.ContentType = GetContentType(new FileInfo(localPath).Extension);
@@ -75,10 +80,15 @@ namespace PepperDash.Essentials
} }
else else
{ {
Debug.Console(2, "HTTP Logo Server Cannot find file '{0}'", localPath);
args.Response.ContentString = string.Format("Not found: '{0}'", filePath); args.Response.ContentString = string.Format("Not found: '{0}'", filePath);
args.Response.Code = 404; args.Response.Code = 404;
} }
} }
else
{
Debug.Console(2, "HTTP Logo Server: '{0}' does not exist", FileDirectory + path);
}
} }
/// <summary> /// <summary>

View File

@@ -487,6 +487,30 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public const uint HeaderIcon5Press = 3955; public const uint HeaderIcon5Press = 3955;
/// 3960
/// </summary>
public const uint HeaderPopupCaretsSubpageVisibile = 3960;
/// <summary>
/// 3961
/// </summary>
public const uint HeaderCaret1Visible = 3961;
/// <summary>
/// 3962
/// </summary>
public const uint HeaderCaret2Visible = 3962;
/// <summary>
/// 3963
/// </summary>
public const uint HeaderCaret3Visible = 3963;
/// <summary>
/// 3964
/// </summary>
public const uint HeaderCaret4Visible = 3964;
/// <summary>
/// 3965
/// </summary>
public const uint HeaderCaret5Visible = 3965;
/// <summary> /// <summary>
/// 3999 /// 3999
/// </summary> /// </summary>

View File

@@ -45,15 +45,15 @@ namespace PepperDash.Essentials
Devices = new List<IKeyed>(); Devices = new List<IKeyed>();
DeviceSubDrivers = new List<PanelDriverBase>(); DeviceSubDrivers = new List<PanelDriverBase>();
Parent.AvDriver.PopupInterlock.IsShownFeedback.OutputChange += IsShownFeedback_OutputChange; Parent.AvDriver.PopupInterlock.StatusChanged += new EventHandler<StatusChangedEventArgs>(PopupInterlock_CurrentJoinChanged);
// Calculate the join offests for each device page and assign join actions for each button // Calculate the join offests for each device page and assign join actions for each button
} }
void IsShownFeedback_OutputChange(object sender, EventArgs e) void PopupInterlock_CurrentJoinChanged(object sender, StatusChangedEventArgs e)
{ {
// Hide this driver and all sub drivers if popup interlock is not shown // Hide this driver and all sub drivers if popup interlock is not shown
if (Parent.AvDriver.PopupInterlock.IsShownFeedback.BoolValue == false) if (!e.IsShown || e.NewJoin != BackgroundSubpageJoin)
{ {
foreach (var driver in DeviceSubDrivers) foreach (var driver in DeviceSubDrivers)
{ {
@@ -64,12 +64,17 @@ namespace PepperDash.Essentials
} }
} }
void IsShownFeedback_OutputChange(object sender, EventArgs e)
{
}
/// <summary> /// <summary>
/// Shows this driver and all sub drivers /// Shows this driver and all sub drivers
/// </summary> /// </summary>
public override void Show() public override void Show()
{ {
Parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(BackgroundSubpageJoin); Parent.AvDriver.PopupInterlock.ShowInterlocked(BackgroundSubpageJoin);
foreach (var driver in DeviceSubDrivers) foreach (var driver in DeviceSubDrivers)
{ {

View File

@@ -24,6 +24,12 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public class EssentialsHeaderDriver : PanelDriverBase public class EssentialsHeaderDriver : PanelDriverBase
{ {
uint EnvironmentCaretVisible;
uint CalendarCaretVisible;
uint CallCaretVisible;
JoinedSigInterlock CaretInterlock;
CrestronTouchpanelPropertiesConfig Config; CrestronTouchpanelPropertiesConfig Config;
/// <summary> /// <summary>
@@ -43,6 +49,7 @@ namespace PepperDash.Essentials
{ {
Config = config; Config = config;
Parent = parent; Parent = parent;
CaretInterlock = new JoinedSigInterlock(TriList);
} }
void SetUpGear(IAVDriver avDriver, EssentialsRoomBase currentRoom) void SetUpGear(IAVDriver avDriver, EssentialsRoomBase currentRoom)
@@ -55,9 +62,15 @@ namespace PepperDash.Essentials
() => () =>
{ {
if (currentRoom.OnFeedback.BoolValue) if (currentRoom.OnFeedback.BoolValue)
{
avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible);
CaretInterlock.ShowInterlocked(UIBoolJoin.HeaderCaret5Visible);
}
else else
{
avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible);
CaretInterlock.ShowInterlocked(UIBoolJoin.HeaderCaret5Visible);
}
}); });
TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () =>
avDriver.PopupInterlock.HideAndClear()); avDriver.PopupInterlock.HideAndClear());
@@ -72,9 +85,13 @@ namespace PepperDash.Essentials
TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton);
TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText);
if (roomConf.Help.ShowCallButton) if (roomConf.Help.ShowCallButton)
{
TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN
}
else else
{
TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress);
}
} }
else // older config else // older config
{ {
@@ -95,6 +112,7 @@ namespace PepperDash.Essentials
message = "Sorry, no help message available. No room connected."; message = "Sorry, no help message available. No room connected.";
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
Parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); Parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible);
CaretInterlock.ShowInterlocked(UIBoolJoin.HeaderCaret4Visible);
}); });
} }
@@ -102,8 +120,14 @@ namespace PepperDash.Essentials
{ {
if (environmentDriver != null) if (environmentDriver != null)
{ {
TriList.SetString(nextJoin, "Lights"); var tempJoin = nextJoin;
TriList.SetSigFalseAction(nextJoin, environmentDriver.Toggle); TriList.SetString(tempJoin, "Lights");
EnvironmentCaretVisible = tempJoin + 10;
TriList.SetSigFalseAction(tempJoin, () =>
{
environmentDriver.Toggle();
CaretInterlock.ShowInterlocked(EnvironmentCaretVisible);
});
nextJoin--; nextJoin--;
return nextJoin; return nextJoin;
} }
@@ -116,8 +140,14 @@ namespace PepperDash.Essentials
// Calendar button // Calendar button
if (avDriver.CurrentRoom.ScheduleSource != null) if (avDriver.CurrentRoom.ScheduleSource != null)
{ {
TriList.SetString(nextJoin, "Calendar"); var tempJoin = nextJoin;
TriList.SetSigFalseAction(nextJoin, avDriver.CalendarPress); TriList.SetString(tempJoin, "Calendar");
CalendarCaretVisible = tempJoin + 10;
TriList.SetSigFalseAction(tempJoin, () =>
{
avDriver.CalendarPress();
CaretInterlock.ShowInterlocked(CalendarCaretVisible);
});
nextJoin--; nextJoin--;
return nextJoin; return nextJoin;
@@ -129,9 +159,16 @@ namespace PepperDash.Essentials
uint SetUpCallButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin) uint SetUpCallButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin)
{ {
// Call button // Call button
TriList.SetString(nextJoin, "DND"); var tempJoin = nextJoin;
TriList.SetSigFalseAction(nextJoin, avDriver.ShowActiveCallsList); TriList.SetString(tempJoin, "DND");
HeaderCallButtonIconSig = TriList.StringInput[nextJoin]; CallCaretVisible = tempJoin + 10;
TriList.SetSigFalseAction(tempJoin, () =>
{
avDriver.ShowActiveCallsList();
if(avDriver.CurrentRoom.InCallFeedback.BoolValue)
CaretInterlock.ShowInterlocked(CallCaretVisible);
});
HeaderCallButtonIconSig = TriList.StringInput[tempJoin];
nextJoin--; nextJoin--;
return nextJoin; return nextJoin;
@@ -192,6 +229,10 @@ namespace PepperDash.Essentials
var roomConf = currentRoom.Config; var roomConf = currentRoom.Config;
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
Parent.AvDriver.PopupInterlock.StatusChanged += PopupInterlock_StatusChanged;
SetUpGear(avDriver, currentRoom); SetUpGear(avDriver, currentRoom);
SetUpHelpButton(roomConf); SetUpHelpButton(roomConf);
@@ -211,7 +252,13 @@ namespace PepperDash.Essentials
TriList.SetSigFalseAction(i, () => { }); TriList.SetSigFalseAction(i, () => { });
} }
TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress, avDriver.ShowActiveCallsList); TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress,
() =>
{
avDriver.ShowActiveCallsList();
if (avDriver.CurrentRoom.InCallFeedback.BoolValue)
CaretInterlock.ShowInterlocked(CallCaretVisible);
});
// Set Call Status Subpage Position // Set Call Status Subpage Position
@@ -244,6 +291,10 @@ namespace PepperDash.Essentials
var roomConf = currentRoom.Config; var roomConf = currentRoom.Config;
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
Parent.AvDriver.PopupInterlock.StatusChanged += PopupInterlock_StatusChanged;
SetUpGear(avDriver, currentRoom); SetUpGear(avDriver, currentRoom);
SetUpHelpButton(roomConf); SetUpHelpButton(roomConf);
@@ -262,5 +313,59 @@ namespace PepperDash.Essentials
HeaderButtonsAreSetUp = true; HeaderButtonsAreSetUp = true;
} }
///// <summary>
///// Whenever a popup is shown/hidden, show/hide the header carets subpage and set the visibility of the correct caret
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//void IsShownFeedback_OutputChange(object sender, EventArgs e)
//{
// var popupInterlockIsShown = Parent.AvDriver.PopupInterlock.IsShown;
// // Set the visible state for the HeaderPopupCaretsSubpage to match that of the PopupInterlock state
// TriList.SetBool(UIBoolJoin.HeaderPopupCaretsSubpageVisibile, popupInterlockIsShown);
// // Clear all caret visibility
// for (uint i = UIBoolJoin.HeaderCaret5Visible; i >= UIBoolJoin.HeaderCaret1Visible; i--)
// {
// TriList.SetBool(i, false);
// }
// // Set the current caret visible if the popup is still shown
// if (popupInterlockIsShown)
// TriList.SetBool(NextCaretVisible, true);
//}
/// <summary>
/// Whenever a popup is shown/hidden, show/hide the header carets subpage and set the visibility of the correct caret
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void PopupInterlock_StatusChanged(object sender, StatusChangedEventArgs e)
{
// Set the visible state for the HeaderPopupCaretsSubpage to match that of the PopupInterlock state
bool headerPopupShown = false;
// Check if the popup interlock is shown, and if one of the header popups is current, then show the carets subpage
if (e.IsShown)
{
if (e.NewJoin == Parent.EnvironmentDriver.BackgroundSubpageJoin)
headerPopupShown = true;
else if (e.NewJoin == UIBoolJoin.HeaderActiveCallsListVisible)
headerPopupShown = true;
else if (e.NewJoin == UIBoolJoin.HelpPageVisible)
headerPopupShown = true;
else if (e.NewJoin == UIBoolJoin.MeetingsOrContacMethodsListVisible)
headerPopupShown = true;
else if (e.NewJoin == UIBoolJoin.VolumesPagePowerOffVisible || e.NewJoin == UIBoolJoin.VolumesPageVisible)
headerPopupShown = true;
}
// Set the carets subpage visibility
TriList.SetBool(UIBoolJoin.HeaderPopupCaretsSubpageVisibile, headerPopupShown);
if (!e.IsShown)
CaretInterlock.HideAndClear();
}
} }
} }

View File

@@ -18,6 +18,8 @@ namespace PepperDash.Essentials
public BoolFeedback IsShownFeedback; public BoolFeedback IsShownFeedback;
public event EventHandler<StatusChangedEventArgs> StatusChanged;
bool _IsShown; bool _IsShown;
public bool IsShown public bool IsShown
@@ -48,12 +50,16 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void ShowInterlocked(uint join) public void ShowInterlocked(uint join)
{ {
var prevJoin = CurrentJoin;
var wasShown = _IsShown;
Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join); Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
if (CurrentJoin == join && TriList.BooleanInput[join].BoolValue) if (CurrentJoin == join && TriList.BooleanInput[join].BoolValue)
return; return;
SetButDontShow(join); SetButDontShow(join);
TriList.SetBool(CurrentJoin, true); TriList.SetBool(CurrentJoin, true);
IsShown = true; IsShown = true;
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
} }
/// <summary> /// <summary>
@@ -62,6 +68,9 @@ namespace PepperDash.Essentials
/// <param name="join"></param> /// <param name="join"></param>
public void ShowInterlockedWithToggle(uint join) public void ShowInterlockedWithToggle(uint join)
{ {
var prevJoin = CurrentJoin;
var wasShown = IsShown;
Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join); Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
if (CurrentJoin == join) if (CurrentJoin == join)
HideAndClear(); HideAndClear();
@@ -72,6 +81,8 @@ namespace PepperDash.Essentials
CurrentJoin = join; CurrentJoin = join;
TriList.BooleanInput[CurrentJoin].BoolValue = true; TriList.BooleanInput[CurrentJoin].BoolValue = true;
IsShown = true; IsShown = true;
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
} }
} }
/// <summary> /// <summary>
@@ -79,9 +90,13 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void HideAndClear() public void HideAndClear()
{ {
var prevJoin = CurrentJoin;
var wasShown = IsShown;
Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin); Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
Hide(); Hide();
CurrentJoin = 0; CurrentJoin = 0;
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
} }
/// <summary> /// <summary>
@@ -90,11 +105,15 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void Hide() public void Hide()
{ {
var prevJoin = CurrentJoin;
var wasShown = IsShown;
Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin); Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
if (CurrentJoin > 0) if (CurrentJoin > 0)
{ {
TriList.BooleanInput[CurrentJoin].BoolValue = false; TriList.BooleanInput[CurrentJoin].BoolValue = false;
IsShown = false; IsShown = false;
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
} }
} }
@@ -103,11 +122,16 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void Show() public void Show()
{ {
var prevJoin = CurrentJoin;
var wasShown = IsShown;
Debug.Console(2, "Trilist {0:X2}, interlock showing {1}", TriList.ID, CurrentJoin); Debug.Console(2, "Trilist {0:X2}, interlock showing {1}", TriList.ID, CurrentJoin);
if (CurrentJoin > 0) if (CurrentJoin > 0)
{ {
TriList.BooleanInput[CurrentJoin].BoolValue = true; TriList.BooleanInput[CurrentJoin].BoolValue = true;
IsShown = true; IsShown = true;
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
} }
} }
@@ -125,5 +149,27 @@ namespace PepperDash.Essentials
CurrentJoin = join; CurrentJoin = join;
} }
void OnStatusChange(uint prevJoin, uint newJoin, bool wasShown, bool isShown)
{
var handler = StatusChanged;
if (handler != null)
handler(this, new StatusChangedEventArgs(prevJoin, newJoin, wasShown, isShown));
}
}
public class StatusChangedEventArgs : EventArgs
{
public uint PreviousJoin { get; set; }
public uint NewJoin { get; set; }
public bool WasShown { get; set; }
public bool IsShown { get; set; }
public StatusChangedEventArgs(uint prevJoin, uint newJoin, bool wasShown, bool isShown)
{
PreviousJoin = prevJoin;
NewJoin = newJoin;
WasShown = wasShown;
IsShown = isShown;
}
} }
} }