diff --git a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs index 1dc843a1..92ac2b9c 100644 --- a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs +++ b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs @@ -2,14 +2,12 @@ using System; using System.Collections.Generic; -using Crestron.SimplSharp; using System.Reflection; +using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.EthernetCommunication; - using Newtonsoft.Json; - using PepperDash.Core; using PepperDash.Essentials.Core.Config; using Serilog.Events; @@ -355,22 +353,22 @@ namespace PepperDash.Essentials.Core.Bridges /// public class EiscApiPropertiesConfig { - [JsonProperty("control")] /// /// Gets or sets the Control /// + [JsonProperty("control")] public EssentialsControlPropertiesConfig Control { get; set; } - [JsonProperty("devices")] /// /// Gets or sets the Devices /// + [JsonProperty("devices")] public List Devices { get; set; } - [JsonProperty("rooms")] /// /// Gets or sets the Rooms /// + [JsonProperty("rooms")] public List Rooms { get; set; } @@ -379,22 +377,22 @@ namespace PepperDash.Essentials.Core.Bridges /// public class ApiDevicePropertiesConfig { - [JsonProperty("deviceKey")] /// /// Gets or sets the DeviceKey /// + [JsonProperty("deviceKey")] public string DeviceKey { get; set; } - [JsonProperty("joinStart")] /// /// Gets or sets the JoinStart /// + [JsonProperty("joinStart")] public uint JoinStart { get; set; } - [JsonProperty("joinMapKey")] /// /// Gets or sets the JoinMapKey /// + [JsonProperty("joinMapKey")] public string JoinMapKey { get; set; } } @@ -403,22 +401,22 @@ namespace PepperDash.Essentials.Core.Bridges /// public class ApiRoomPropertiesConfig { - [JsonProperty("roomKey")] /// /// Gets or sets the RoomKey /// + [JsonProperty("roomKey")] public string RoomKey { get; set; } - [JsonProperty("joinStart")] /// /// Gets or sets the JoinStart /// + [JsonProperty("joinStart")] public uint JoinStart { get; set; } - [JsonProperty("joinMapKey")] /// /// Gets or sets the JoinMapKey /// + [JsonProperty("joinMapKey")] public string JoinMapKey { get; set; } } diff --git a/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs b/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs index 651f17aa..23063773 100644 --- a/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs @@ -18,41 +18,41 @@ namespace PepperDash.Essentials.Core.Config /// public class DeviceConfig { - [JsonProperty("key")] /// /// Gets or sets the Key /// + [JsonProperty("key")] public string Key { get; set; } - [JsonProperty("uid")] /// /// Gets or sets the Uid /// + [JsonProperty("uid")] public int Uid { get; set; } - [JsonProperty("name")] /// /// Gets or sets the Name /// + [JsonProperty("name")] public string Name { get; set; } - [JsonProperty("group")] /// /// Gets or sets the Group /// + [JsonProperty("group")] public string Group { get; set; } - [JsonProperty("type")] /// /// Gets or sets the Type /// + [JsonProperty("type")] public string Type { get; set; } - [JsonProperty("properties")] - [JsonConverter(typeof(DevicePropertiesConverter))] /// /// Gets or sets the Properties /// + [JsonProperty("properties")] + [JsonConverter(typeof(DevicePropertiesConverter))] public JToken Properties { get; set; } public DeviceConfig(DeviceConfig dc) @@ -68,7 +68,7 @@ namespace PepperDash.Essentials.Core.Config //Properties = JToken.FromObject(dc.Properties); } - public DeviceConfig() {} + public DeviceConfig() { } } /// diff --git a/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs b/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs index 91620c63..086301dc 100644 --- a/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs +++ b/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs @@ -1,14 +1,14 @@ using System; using System.Linq; - +using Crestron.SimplSharp; using PepperDash.Core; using Serilog.Events; namespace PepperDash.Essentials.Core { - /// - /// Defines the contract for IHasFeedback - /// + /// + /// Defines the contract for IHasFeedback + /// public interface IHasFeedback : IKeyed { /// @@ -19,47 +19,55 @@ namespace PepperDash.Essentials.Core } - + /// + /// Extension methods for IHasFeedback + /// public static class IHasFeedbackExtensions { + /// + /// Dumps the feedbacks to the console + /// + /// + /// public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates) { - Type t = source.GetType(); - // get the properties and set them into a new collection of NameType wrappers - var props = t.GetProperties().Select(p => new PropertyNameType(p, t)); + Type t = source.GetType(); + // get the properties and set them into a new collection of NameType wrappers + var props = t.GetProperties().Select(p => new PropertyNameType(p, t)); var feedbacks = source.Feedbacks; - if (feedbacks != null) + + if (feedbacks == null) { - Debug.LogMessage(LogEventLevel.Information, source, "\n\nAvailable feedbacks:"); - foreach (var f in feedbacks) - { - string val = ""; - string type = ""; - if (getCurrentStates) - { - if (f is BoolFeedback) - { - val = f.BoolValue.ToString(); - type = "boolean"; - } - else if (f is IntFeedback) - { - val = f.IntValue.ToString(); - type = "integer"; - } - else if (f is StringFeedback) - { - val = f.StringValue; - type = "string"; - } - } - Debug.LogMessage(LogEventLevel.Information, "{0,-12} {1, -25} {2}", type, - (string.IsNullOrEmpty(f.Key) ? "-no key-" : f.Key), val); - } + CrestronConsole.ConsoleCommandResponse("No available outputs\r\n"); + return; + } + + CrestronConsole.ConsoleCommandResponse("Available feedbacks:\r\n"); + foreach (var f in feedbacks) + { + string val = ""; + string type = ""; + if (getCurrentStates) + { + if (f is BoolFeedback) + { + val = f.BoolValue.ToString(); + type = "boolean"; + } + else if (f is IntFeedback) + { + val = f.IntValue.ToString(); + type = "integer"; + } + else if (f is StringFeedback) + { + val = f.StringValue; + type = "string"; + } + } + CrestronConsole.ConsoleCommandResponse($"{type,-12} {(string.IsNullOrEmpty(f.Key) ? "-no key-" : f.Key),-25} {val}\r\n"); } - else - Debug.LogMessage(LogEventLevel.Information, source, "No available outputs:"); } } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Room/Config/EssentialsRoomConfig.cs b/src/PepperDash.Essentials.Core/Room/Config/EssentialsRoomConfig.cs index 40810a89..b5584f93 100644 --- a/src/PepperDash.Essentials.Core/Room/Config/EssentialsRoomConfig.cs +++ b/src/PepperDash.Essentials.Core/Room/Config/EssentialsRoomConfig.cs @@ -9,11 +9,11 @@ using Serilog.Events; namespace PepperDash.Essentials.Room.Config { - /// - /// Represents a EssentialsRoomConfigHelper - /// - public class EssentialsRoomConfigHelper - { + /// + /// Represents a EssentialsRoomConfigHelper + /// + public class EssentialsRoomConfigHelper + { /// /// GetEmergency method /// @@ -31,100 +31,100 @@ namespace PepperDash.Essentials.Room.Config return null; } - /// - /// - /// - /// - /// - /// - /// - /// GetMicrophonePrivacy method - /// - public static MicrophonePrivacyController GetMicrophonePrivacy( - EssentialsRoomPropertiesConfig props, IPrivacy room) - { - var microphonePrivacy = props.MicrophonePrivacy; - if (microphonePrivacy == null) - { - Debug.LogMessage(LogEventLevel.Information, "Cannot create microphone privacy with null properties"); - return null; - } - // Get the MicrophonePrivacy device from the device manager - var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as MicrophonePrivacyController); - // Set this room as the IPrivacy device - if (mP == null) - { - Debug.LogMessage(LogEventLevel.Information, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey); - return null; - } - mP.SetPrivacyDevice(room); + /// + /// + /// + /// + /// + /// + /// + /// GetMicrophonePrivacy method + /// + public static MicrophonePrivacyController GetMicrophonePrivacy( + EssentialsRoomPropertiesConfig props, IPrivacy room) + { + var microphonePrivacy = props.MicrophonePrivacy; + if (microphonePrivacy == null) + { + Debug.LogMessage(LogEventLevel.Information, "Cannot create microphone privacy with null properties"); + return null; + } + // Get the MicrophonePrivacy device from the device manager + var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as MicrophonePrivacyController); + // Set this room as the IPrivacy device + if (mP == null) + { + Debug.LogMessage(LogEventLevel.Information, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey); + return null; + } + mP.SetPrivacyDevice(room); - var behaviour = props.MicrophonePrivacy.Behaviour.ToLower(); + var behaviour = props.MicrophonePrivacy.Behaviour.ToLower(); - if (behaviour == null) - { - Debug.LogMessage(LogEventLevel.Information, "WARNING: No behaviour defined for MicrophonePrivacyController"); - return null; - } - if (behaviour == "trackroomstate") - { - // Tie LED enable to room power state + if (behaviour == null) + { + Debug.LogMessage(LogEventLevel.Information, "WARNING: No behaviour defined for MicrophonePrivacyController"); + return null; + } + if (behaviour == "trackroomstate") + { + // Tie LED enable to room power state var essRoom = room as IEssentialsRoom; essRoom.OnFeedback.OutputChange += (o, a) => - { + { if (essRoom.OnFeedback.BoolValue) - mP.EnableLeds = true; - else - mP.EnableLeds = false; - }; + mP.EnableLeds = true; + else + mP.EnableLeds = false; + }; mP.EnableLeds = essRoom.OnFeedback.BoolValue; - } - else if (behaviour == "trackcallstate") - { - // Tie LED enable to room power state + } + else if (behaviour == "trackcallstate") + { + // Tie LED enable to room power state var inCallRoom = room as IHasInCallFeedback; inCallRoom.InCallFeedback.OutputChange += (o, a) => - { + { if (inCallRoom.InCallFeedback.BoolValue) - mP.EnableLeds = true; - else - mP.EnableLeds = false; - }; + mP.EnableLeds = true; + else + mP.EnableLeds = false; + }; mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue; - } + } - return mP; - } - - } + return mP; + } - /// - /// Represents a EssentialsRoomPropertiesConfig - /// - public class EssentialsRoomPropertiesConfig - { - [JsonProperty("addresses")] - public EssentialsRoomAddressPropertiesConfig Addresses { get; set; } + } - [JsonProperty("description")] - public string Description { get; set; } + /// + /// Represents a EssentialsRoomPropertiesConfig + /// + public class EssentialsRoomPropertiesConfig + { + [JsonProperty("addresses")] + public EssentialsRoomAddressPropertiesConfig Addresses { get; set; } - [JsonProperty("emergency")] - public EssentialsRoomEmergencyConfig Emergency { get; set; } + [JsonProperty("description")] + public string Description { get; set; } - [JsonProperty("help")] - /// - /// Gets or sets the Help - /// - public EssentialsHelpPropertiesConfig Help { get; set; } + [JsonProperty("emergency")] + public EssentialsRoomEmergencyConfig Emergency { get; set; } - [JsonProperty("helpMessage")] - /// - /// Gets or sets the HelpMessage - /// - public string HelpMessage { get; set; } + /// + /// Gets or sets the Help + /// + [JsonProperty("help")] + public EssentialsHelpPropertiesConfig Help { get; set; } + + /// + /// Gets or sets the HelpMessage + /// + [JsonProperty("helpMessage")] + public string HelpMessage { get; set; } /// /// Read this value to get the help message. It checks for the old and new config format. @@ -133,94 +133,94 @@ namespace PepperDash.Essentials.Room.Config { get { - if(Help != null && !string.IsNullOrEmpty(Help.Message)) + if (Help != null && !string.IsNullOrEmpty(Help.Message)) { return Help.Message; } else { - return HelpMessage; + return HelpMessage; } } } - [JsonProperty("environment")] - /// - /// Gets or sets the Environment - /// - public EssentialsEnvironmentPropertiesConfig Environment { get; set; } + /// + /// Gets or sets the Environment + /// + [JsonProperty("environment")] + public EssentialsEnvironmentPropertiesConfig Environment { get; set; } - [JsonProperty("logo")] - /// - /// Gets or sets the LogoLight - /// - public EssentialsLogoPropertiesConfig LogoLight { get; set; } + /// + /// Gets or sets the LogoLight + /// + [JsonProperty("logo")] + public EssentialsLogoPropertiesConfig LogoLight { get; set; } - [JsonProperty("logoDark")] /// /// Gets or sets the LogoDark /// + [JsonProperty("logoDark")] public EssentialsLogoPropertiesConfig LogoDark { get; set; } - - [JsonProperty("microphonePrivacy")] - /// - /// Gets or sets the MicrophonePrivacy - /// - public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; } - [JsonProperty("occupancy")] - /// - /// Gets or sets the Occupancy - /// - public EssentialsRoomOccSensorConfig Occupancy { get; set; } + /// + /// Gets or sets the MicrophonePrivacy + /// + [JsonProperty("microphonePrivacy")] + public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; } - [JsonProperty("oneButtonMeeting")] - /// - /// Gets or sets the OneButtonMeeting - /// - public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; } + /// + /// Gets or sets the Occupancy + /// + [JsonProperty("occupancy")] + public EssentialsRoomOccSensorConfig Occupancy { get; set; } - [JsonProperty("shutdownVacancySeconds")] - /// - /// Gets or sets the ShutdownVacancySeconds - /// - public int ShutdownVacancySeconds { get; set; } + /// + /// Gets or sets the OneButtonMeeting + /// + [JsonProperty("oneButtonMeeting")] + public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; } - [JsonProperty("shutdownPromptSeconds")] - /// - /// Gets or sets the ShutdownPromptSeconds - /// - public int ShutdownPromptSeconds { get; set; } + /// + /// Gets or sets the ShutdownVacancySeconds + /// + [JsonProperty("shutdownVacancySeconds")] + public int ShutdownVacancySeconds { get; set; } - [JsonProperty("tech")] - /// - /// Gets or sets the Tech - /// - public EssentialsRoomTechConfig Tech { get; set; } + /// + /// Gets or sets the ShutdownPromptSeconds + /// + [JsonProperty("shutdownPromptSeconds")] + public int ShutdownPromptSeconds { get; set; } - [JsonProperty("volumes")] - /// - /// Gets or sets the Volumes - /// - public EssentialsRoomVolumesConfig Volumes { get; set; } + /// + /// Gets or sets the Tech + /// + [JsonProperty("tech")] + public EssentialsRoomTechConfig Tech { get; set; } + + /// + /// Gets or sets the Volumes + /// + [JsonProperty("volumes")] + public EssentialsRoomVolumesConfig Volumes { get; set; } - [JsonProperty("fusion")] /// /// Gets or sets the Fusion /// + [JsonProperty("fusion")] public EssentialsRoomFusionConfig Fusion { get; set; } - [JsonProperty("essentialsRoomUiBehaviorConfig", NullValueHandling=NullValueHandling.Ignore)] /// /// Gets or sets the UiBehavior /// + [JsonProperty("essentialsRoomUiBehaviorConfig", NullValueHandling = NullValueHandling.Ignore)] public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; } - [JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")] - /// - /// Gets or sets the ZeroVolumeWhenSwtichingVolumeDevices - /// - public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; } + /// + /// Gets or sets the ZeroVolumeWhenSwtichingVolumeDevices + /// + [JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")] + public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; } /// /// Indicates if this room represents a combination of other rooms @@ -236,7 +236,7 @@ namespace PepperDash.Essentials.Room.Config LogoLight = new EssentialsLogoPropertiesConfig(); LogoDark = new EssentialsLogoPropertiesConfig(); } - } + } /// /// Represents a EssentialsRoomUiBehaviorConfig @@ -327,15 +327,15 @@ namespace PepperDash.Essentials.Room.Config } - /// - /// Represents a EssentialsEnvironmentPropertiesConfig - /// - public class EssentialsEnvironmentPropertiesConfig - { - /// - /// Gets or sets the Enabled - /// - public bool Enabled { get; set; } + /// + /// Represents a EssentialsEnvironmentPropertiesConfig + /// + public class EssentialsEnvironmentPropertiesConfig + { + /// + /// Gets or sets the Enabled + /// + public bool Enabled { get; set; } [JsonProperty("deviceKeys")] /// @@ -348,7 +348,7 @@ namespace PepperDash.Essentials.Room.Config DeviceKeys = new List(); } - } + } /// /// Represents a EssentialsRoomFusionConfig @@ -359,7 +359,7 @@ namespace PepperDash.Essentials.Room.Config { get { - try + try { return Convert.ToUInt32(IpId, 16); } @@ -367,7 +367,7 @@ namespace PepperDash.Essentials.Room.Config { throw new FormatException(string.Format("ERROR:Unable to convert IP ID: {0} to hex. Error:\n{1}", IpId)); } - + } } @@ -390,17 +390,17 @@ namespace PepperDash.Essentials.Room.Config /// public class EssentialsRoomMicrophonePrivacyConfig { - [JsonProperty("deviceKey")] - /// - /// Gets or sets the DeviceKey - /// - public string DeviceKey { get; set; } + [JsonProperty("deviceKey")] + /// + /// Gets or sets the DeviceKey + /// + public string DeviceKey { get; set; } - [JsonProperty("behaviour")] - /// - /// Gets or sets the Behaviour - /// - public string Behaviour { get; set; } + [JsonProperty("behaviour")] + /// + /// Gets or sets the Behaviour + /// + public string Behaviour { get; set; } } /// @@ -408,23 +408,23 @@ namespace PepperDash.Essentials.Room.Config /// public class EssentialsHelpPropertiesConfig { - [JsonProperty("message")] - /// - /// Gets or sets the Message - /// - public string Message { get; set; } + [JsonProperty("message")] + /// + /// Gets or sets the Message + /// + public string Message { get; set; } - [JsonProperty("showCallButton")] - public bool ShowCallButton { get; set; } - - /// + [JsonProperty("showCallButton")] + public bool ShowCallButton { get; set; } + + /// /// Defaults to "Call Help Desk" /// - [JsonProperty("callButtonText")] - /// - /// Gets or sets the CallButtonText - /// - public string CallButtonText { get; set; } + [JsonProperty("callButtonText")] + /// + /// Gets or sets the CallButtonText + /// + public string CallButtonText { get; set; } public EssentialsHelpPropertiesConfig() { @@ -437,23 +437,23 @@ namespace PepperDash.Essentials.Room.Config /// public class EssentialsOneButtonMeetingPropertiesConfig { - [JsonProperty("enable")] - /// - /// Gets or sets the Enable - /// - public bool Enable { get; set; } + [JsonProperty("enable")] + /// + /// Gets or sets the Enable + /// + public bool Enable { get; set; } } public class EssentialsRoomAddressPropertiesConfig { - [JsonProperty("phoneNumber")] - public string PhoneNumber { get; set; } + [JsonProperty("phoneNumber")] + public string PhoneNumber { get; set; } - [JsonProperty("sipAddress")] - /// - /// Gets or sets the SipAddress - /// - public string SipAddress { get; set; } + [JsonProperty("sipAddress")] + /// + /// Gets or sets the SipAddress + /// + public string SipAddress { get; set; } } @@ -462,14 +462,14 @@ namespace PepperDash.Essentials.Room.Config /// public class EssentialsLogoPropertiesConfig { - [JsonProperty("type")] - /// - /// Gets or sets the Type - /// - public string Type { get; set; } + [JsonProperty("type")] + /// + /// Gets or sets the Type + /// + public string Type { get; set; } - [JsonProperty("url")] - public string Url { get; set; } + [JsonProperty("url")] + public string Url { get; set; } /// /// GetLogoUrlLight method /// @@ -478,7 +478,7 @@ namespace PepperDash.Essentials.Room.Config if (Type == "url") return Url; if (Type == "system") - return string.Format("http://{0}:8080/logo.png", + return string.Format("http://{0}:8080/logo.png", CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0)); return null; } @@ -502,22 +502,22 @@ namespace PepperDash.Essentials.Room.Config /// public class EssentialsRoomOccSensorConfig { - [JsonProperty("deviceKey")] - /// - /// Gets or sets the DeviceKey - /// - public string DeviceKey { get; set; } + [JsonProperty("deviceKey")] + /// + /// Gets or sets the DeviceKey + /// + public string DeviceKey { get; set; } - [JsonProperty("timeoutMinutes")] - public int TimeoutMinutes { get; set; } + [JsonProperty("timeoutMinutes")] + public int TimeoutMinutes { get; set; } } - public class EssentialsRoomTechConfig - { - [JsonProperty("password")] - /// - /// Gets or sets the Password - /// - public string Password { get; set; } - } + public class EssentialsRoomTechConfig + { + [JsonProperty("password")] + /// + /// Gets or sets the Password + /// + public string Password { get; set; } + } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferencList/SubpageReferenceList.cs b/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferencList/SubpageReferenceList.cs index f955011a..e82c3a63 100644 --- a/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferencList/SubpageReferenceList.cs +++ b/src/PepperDash.Essentials.Core/SmartObjects/SubpageReferencList/SubpageReferenceList.cs @@ -14,14 +14,14 @@ using Serilog.Events; namespace PepperDash.Essentials.Core { - ////***************************************************************************** - /// - /// Base class for all subpage reference list controllers - /// - //public class SubpageReferenceListController - //{ - // public SubpageReferenceList TheList { get; protected set; } - //} + ////***************************************************************************** + ///// + ///// Base class for all subpage reference list controllers + ///// + //public class SubpageReferenceListController + //{ + // public SubpageReferenceList TheList { get; protected set; } + //} //***************************************************************************** /// @@ -34,26 +34,26 @@ namespace PepperDash.Essentials.Core public ushort Count { get { return SetNumberOfItemsSig.UShortValue; } - set { SetNumberOfItemsSig.UShortValue = value; } + set { SetNumberOfItemsSig.UShortValue = value; } } public ushort MaxDefinedItems { get; private set; } - /// - /// Gets or sets the ScrollToItemSig - /// + /// + /// Gets or sets the ScrollToItemSig + /// public UShortInputSig ScrollToItemSig { get; private set; } UShortInputSig SetNumberOfItemsSig; - /// - /// Gets or sets the BoolIncrement - /// + /// + /// Gets or sets the BoolIncrement + /// public uint BoolIncrement { get; protected set; } - /// - /// Gets or sets the UShortIncrement - /// + /// + /// Gets or sets the UShortIncrement + /// public uint UShortIncrement { get; protected set; } - /// - /// Gets or sets the StringIncrement - /// + /// + /// Gets or sets the StringIncrement + /// public uint StringIncrement { get; protected set; } protected readonly SmartObject SRL; @@ -87,8 +87,8 @@ namespace PepperDash.Essentials.Core SRL.SigChange += new SmartObjectSigChangeEventHandler(SRL_SigChange); } else - Debug.LogMessage(LogEventLevel.Information, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded", - triList.ID, smartObjectId); + Debug.LogMessage(LogEventLevel.Information, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded", + triList.ID, smartObjectId); } /// @@ -96,17 +96,17 @@ namespace PepperDash.Essentials.Core /// DOES NOT adjust Count /// /// - /// - /// AddItem method - /// + /// + /// AddItem method + /// public void AddItem(SubpageReferenceListItem item) { Items.Add(item); } - /// - /// Clear method - /// + /// + /// Clear method + /// public void Clear() { // If a line item needs to disconnect an CueActionPair or do something to release RAM @@ -116,12 +116,12 @@ namespace PepperDash.Essentials.Core // Clean up the SRL Count = 1; - ScrollToItemSig.UShortValue = 1; + ScrollToItemSig.UShortValue = 1; } - /// - /// Refresh method - /// + /// + /// Refresh method + /// public void Refresh() { foreach (var item in Items) item.Refresh(); @@ -157,7 +157,7 @@ namespace PepperDash.Essentials.Core public UShortOutputSig GetUShortOutputSig(uint index, uint sigNum) { if (sigNum > UShortIncrement) return null; - return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetUShortOutputSigName(index, sigNum))); + return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetUShortOutputSigName(index, sigNum))); } /// @@ -172,7 +172,7 @@ namespace PepperDash.Essentials.Core public StringOutputSig GetStringOutputSig(uint index, uint sigNum) { if (sigNum > StringIncrement) return null; - return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetStringOutputSigName(index, sigNum))); + return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetStringOutputSigName(index, sigNum))); } /// @@ -263,9 +263,9 @@ namespace PepperDash.Essentials.Core /// /// /// - /// - /// SRL_SigChange method - /// + /// + /// SRL_SigChange method + /// public static void SRL_SigChange(GenericBase currentDevice, SmartObjectEventArgs args) { var uo = args.Sig.UserObject; diff --git a/src/PepperDash.Essentials.Core/Touchpanels/ModalDialog.cs b/src/PepperDash.Essentials.Core/Touchpanels/ModalDialog.cs index 65249df4..e094aebb 100644 --- a/src/PepperDash.Essentials.Core/Touchpanels/ModalDialog.cs +++ b/src/PepperDash.Essentials.Core/Touchpanels/ModalDialog.cs @@ -6,9 +6,9 @@ using Serilog.Events; namespace PepperDash.Essentials.Core { - /// - /// Represents a ModalDialog - /// + /// + /// Represents a ModalDialog + /// public class ModalDialog { /// @@ -19,10 +19,10 @@ namespace PepperDash.Essentials.Core /// Bool press 3992 /// public const uint Button2Join = 3992; - /// - /// 3993 - /// - public const uint CancelButtonJoin = 3993; + /// + /// 3993 + /// + public const uint CancelButtonJoin = 3993; /// ///For visibility of single button. Bool feedback 3994 /// @@ -35,19 +35,19 @@ namespace PepperDash.Essentials.Core /// Shows the timer guage if in use. Bool feedback 3996 /// public const uint TimerVisibleJoin = 3996; - /// - /// Visibility join to show "X" button 3997 - /// - public const uint CancelVisibleJoin = 3997; + /// + /// Visibility join to show "X" button 3997 + /// + public const uint CancelVisibleJoin = 3997; /// /// Shows the modal subpage. Boolean feeback join 3999 /// public const uint ModalVisibleJoin = 3999; - /// - /// The seconds value of the countdown timer. Ushort join 3991 - /// - //public const uint TimerSecondsJoin = 3991; + ///// + ///// The seconds value of the countdown timer. Ushort join 3991 + ///// + //public const uint TimerSecondsJoin = 3991; /// /// The full ushort value of the countdown timer for a gauge. Ushort join 3992 /// @@ -77,15 +77,15 @@ namespace PepperDash.Essentials.Core /// /// Returns true when modal is showing /// - public bool ModalIsVisible - { - get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; } + public bool ModalIsVisible + { + get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; } } - /// - /// - /// - public bool CanCancel { get; private set; } + /// + /// + /// + public bool CanCancel { get; private set; } BasicTriList TriList; @@ -103,10 +103,10 @@ namespace PepperDash.Essentials.Core TriList = triList; // Attach actions to buttons - triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1)); + triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1)); triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2)); - triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); }); - CanCancel = true; + triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); }); + CanCancel = true; } /// @@ -117,7 +117,7 @@ namespace PepperDash.Essentials.Core /// If the progress bar gauge needs to count down instead of up /// The action to run when the dialog is dismissed. Parameter will be 1 or 2 if button pressed, or 0 if dialog times out /// True when modal is created. - public bool PresentModalDialog(uint numberOfButtons, string title, string iconName, + public bool PresentModalDialog(uint numberOfButtons, string title, string iconName, string message, string button1Text, string button2Text, bool showGauge, bool showCancel, Action completeAction) { @@ -151,15 +151,15 @@ namespace PepperDash.Essentials.Core TriList.StringInput[Button2TextJoin].StringValue = button2Text; } // Show/hide guage - TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge; - - CanCancel = showCancel; - TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel; + TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge; + + CanCancel = showCancel; + TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel; //Reveal and activate TriList.BooleanInput[ModalVisibleJoin].BoolValue = true; - WakePanel(); + WakePanel(); return true; } @@ -167,48 +167,48 @@ namespace PepperDash.Essentials.Core return false; } - /// - /// WakePanel method - /// - public void WakePanel() - { - try - { - var panel = TriList as TswFt5Button; - - if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue) - panel.ExtenderSystemReservedSigs.BacklightOn(); - } - catch - { - Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?"); - } - } - - /// - /// CancelDialog method - /// - public void CancelDialog() + /// + /// WakePanel method + /// + public void WakePanel() { - OnModalComplete(0); + try + { + var panel = TriList as TswFt5Button; + + if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue) + panel.ExtenderSystemReservedSigs.BacklightOn(); + } + catch + { + Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?"); + } } - /// - /// Hides dialog. Fires no action - /// - public void HideDialog() - { - TriList.BooleanInput[ModalVisibleJoin].BoolValue = false; - } + /// + /// CancelDialog method + /// + public void CancelDialog() + { + OnModalComplete(0); + } + + /// + /// Hides dialog. Fires no action + /// + public void HideDialog() + { + TriList.BooleanInput[ModalVisibleJoin].BoolValue = false; + } // When the modal is cleared or times out, clean up the various bits void OnModalComplete(uint buttonNum) { TriList.BooleanInput[ModalVisibleJoin].BoolValue = false; - var action = ModalCompleteAction; - if (action != null) - action(buttonNum); + var action = ModalCompleteAction; + if (action != null) + action(buttonNum); } }