Added none source to share list

This commit is contained in:
Heath Volmer
2017-09-28 13:53:16 -06:00
parent b57582feea
commit 0f41f3ce50
8 changed files with 95 additions and 130 deletions

View File

@@ -26,11 +26,14 @@ namespace PepperDash.Essentials.Core
}
/// <summary>
///
/// StatusUnknown = 0, IsOk = 1, InWarning = 2, InError = 3
/// </summary>
public enum MonitorStatus
{
IsOk, InWarning, InError, StatusUnknown
StatusUnknown = 0,
IsOk = 1,
InWarning = 2,
InError = 3
}
public class MonitorStatusChangeEventArgs : EventArgs

View File

@@ -217,7 +217,6 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SigHelper.cs" />
<Compile Include="REMOVE SigId.cs" />
<Compile Include="SmartObjects\SubpageReferencList\DeviceStatusListController.cs" />
<Compile Include="SmartObjects\SubpageReferencList\SubpageReferenceList.cs" />
<Compile Include="SmartObjects\SubpageReferencList\SubpageReferenceListItem.cs" />
<None Include="app.config" />

View File

@@ -1,111 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.UI;
//namespace PepperDash.Essentials.Core
//{
// /// <summary>
// /// Controls the device/tech status list - links in to the first 10, 1, 5 statuses in an item's StatusProperties
// /// </summary>
// public class DeviceStatusListController : SubpageReferenceListController
// {
// Dictionary<uint, Device> Items = new Dictionary<uint, Device>();
// public DeviceStatusListController(SmartObject list)
// {
// TheList = new SubpageReferenceList(list, 10, 1, 5);
// }
// /// <summary>
// /// Attaches an item's StatusProperties to the list item.
// /// THIS METHOD MAY BE BETTER ABSORBED INTO SOME OTHER CONTROLLER CLASS AS A
// /// PSIG -> LIST ITEM ADAPTER
// /// </summary>
// /// <param name="index">List position</param>
// /// <param name="device"></param>
// public void AddItem(uint listIndex, Device device)
// {
// if (device == null) throw new ArgumentNullException("device");
// Items[listIndex] = device;
// // Feedback - read the status properties and if there is room for them on the list sigs
// // link them up.
// //foreach (PValue statusPsig in device.StatusProperties)
// //{
// // uint num = statusPsig.Number;
// // Sig listSig = null;
// // switch (statusPsig.Type) // Switch on the PSig type and whether the PSig number is within the increment range
// // {
// // case eSigType.Bool:
// // if (num > TheList.BoolIncrement) return;
// // listSig = TheList.BoolInputSig(listIndex, num); // Pull the appropriate list sig.
// // break;
// // case eSigType.String:
// // if (num > TheList.StringIncrement) return;
// // listSig = TheList.StringInputSig(listIndex, num);
// // break;
// // case eSigType.UShort:
// // if (num > TheList.UShortIncrement) return;
// // listSig = TheList.UShortInputSig(listIndex, num);
// // break;
// // default:
// // return;
// // }
// // if (listSig != null) // If we got a sig, plug it into the PSig for updates.
// // statusPsig.AddLinkedSig(listSig, true);
// //}
// // Press/other handlers - read the Commands and if there is room, add them as Sig handlers.
// //foreach (var id in device.Commands.Keys)
// //{
// // var pValueNumber = id.Number;
// // Sig listSig = null;
// // // Switch on type of a command and if it's in range, get it's list Sig.
// // switch (id.Type)
// // {
// // case eSigType.Bool:
// // if (pValueNumber > TheList.BoolIncrement) return;
// // listSig = TheList.BoolFeedbackSig(listIndex, pValueNumber);
// // break;
// // case eSigType.String:
// // if (pValueNumber > TheList.StringIncrement) return;
// // listSig = TheList.StringOutputSig(listIndex, pValueNumber);
// // break;
// // case eSigType.UShort:
// // if (pValueNumber > TheList.UShortIncrement) return;
// // listSig = TheList.UShortOutputSig(listIndex, pValueNumber);
// // break;
// // default:
// // return;
// // }
// // if (listSig != null) // If we got a sig, add the command to its ChangeAction
// // SigToAction.GetSigToActionUserObjectForSig(listSig).SigChangeAction += device.Commands[id];
// // // This will need to be undone when detached MAKE A HELPER!!!!
// //}
// // "Custom things" below
// // Set the name on sig 1 - just an assignment. Don't
// var nameSig = TheList.StringInputSig(listIndex, 1);
// if (nameSig != null)
// nameSig.StringValue = device.Key;
// // Map IsOnline bool to a 0 / 1 state analog icon
// // Add an action to the online PValue that maps to a ushort sig on the list POTENTIAL LEAK HERE IF
// // this isn't cleaned up on disconnect
// var onlineSig = TheList.UShortInputSig(listIndex, 1);
// //var onlinePValue = device.StatusProperties[Device.JoinIsOnline];
// //if (onlineSig != null && onlinePValue != null)
// // onlinePValue.AddChangeAction(pv => onlineSig.UShortValue = (ushort)(onlinePValue.BoolValue ? 1 : 0));
// // //OR onlinePValue.AddLinkedSig(onlineSig, true);
// // Set the list length based on largest key
// TheList.Count = (ushort)Items.Keys.DefaultIfEmpty().Max(); // The count will be the largest key or 0
// }
// }
//}

View File

@@ -33,6 +33,10 @@
/// 3901 The Tech page menu list
/// </summary>
public const uint TechMenuList = 3901;
/// <summary>
/// 3902 Tech page statuses
/// </summary>
public const uint TechStatusList = 3902;
}
}

View File

@@ -16,10 +16,34 @@ namespace PepperDash.Essentials.UIDrivers
{
public class EssentialsHuddleTechPageDriver : PanelDriverBase
{
/// <summary>
///
/// </summary>
SmartObjectDynamicList MenuList;
/// <summary>
///
/// </summary>
SubpageReferenceList StatusList;
/// <summary>
/// References lines in the list against device instances
/// </summary>
Dictionary<ICommunicationMonitor, uint> StatusListDeviceIndexes;
/// <summary>
///
/// </summary>
IAVDriver Parent;
/// <summary>
///
/// </summary>
JoinedSigInterlock PagesInterlock;
/// <summary>
/// 1
/// </summary>
public const uint JoinText = 1;
/// <summary>
///
/// </summary>
@@ -45,21 +69,25 @@ namespace PepperDash.Essentials.UIDrivers
MenuList.SetFeedback(1, true);
});
MenuList.SetItemMainText(2, "Panel Setup");
MenuList.SetItemMainText(2, "Display Controls");
MenuList.SetItemButtonAction(2, b => {
if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechPanelSetupVisible);
MenuList.SetFeedback(2, true);
});
MenuList.SetItemMainText(3, "System Status");
MenuList.SetItemButtonAction(3, b => {
if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechDisplayControlsVisible);
MenuList.SetFeedback(2, true);
});
MenuList.SetItemMainText(3, "Panel Setup");
MenuList.SetItemButtonAction(3, b => {
if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechPanelSetupVisible);
MenuList.SetFeedback(3, true);
});
MenuList.Count = 3;
}
BuildStatusList();
}
/// <summary>
///
/// </summary>
public override void Show()
{
TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, true);
@@ -67,11 +95,53 @@ namespace PepperDash.Essentials.UIDrivers
base.Show();
}
/// <summary>
///
/// </summary>
public override void Hide()
{
TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, false);
PagesInterlock.Hide();
base.Hide();
}
/// <summary>
///
/// </summary>
void BuildStatusList()
{
StatusList = new SubpageReferenceList(TriList, UISmartObjectJoin.TechStatusList, 3, 3, 3);
StatusListDeviceIndexes = new Dictionary<ICommunicationMonitor, uint>();
uint i = 0;
foreach (var d in DeviceManager.AllDevices)
{
// make sure it is both ICommunicationMonitor and a Device
var sd = d as ICommunicationMonitor;
if (sd == null)
continue;
var dd = sd as Device;
if(dd == null)
continue;
i++;
StatusList.StringInputSig(i, 1).StringValue = dd.Name;
StatusList.UShortInputSig(i, 1).UShortValue = (ushort)sd.CommunicationMonitor.Status;
StatusListDeviceIndexes.Add(sd, i);
sd.CommunicationMonitor.StatusChange += CommunicationMonitor_StatusChange ;
}
StatusList.Count = (ushort)i;
}
/// <summary>
///
/// </summary>
void CommunicationMonitor_StatusChange(object sender, MonitorStatusChangeEventArgs e)
{
var c = sender as ICommunicationMonitor;
if (StatusListDeviceIndexes.ContainsKey(c))
{
var i = StatusListDeviceIndexes[c];
StatusList.UShortInputSig(i, 1).UShortValue = (ushort)e.Status;
}
}
}
}

View File

@@ -750,13 +750,13 @@ namespace PepperDash.Essentials
if (!srcConfig.IncludeInSourceList) // Skip sources marked this way
continue;
var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device;
if (actualSource == null)
{
Debug.Console(1, "Cannot assign missing source '{0}' to source UI list",
srcConfig.SourceKey);
continue;
}
//var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device;
//if (actualSource == null)
//{
// Debug.Console(1, "Cannot assign missing source '{0}' to source UI list",
// srcConfig.SourceKey);
// continue;
//}
var routeKey = kvp.Key;
var item = new SubpageReferenceListSourceItem(i++, SourceStagingSrl, srcConfig,
b => { if (!b) UiSelectSource(routeKey); });