Fixed issue with Output type on DMPS3-4K-150-C when assigning name. Also adds protection if config incorrectly defiines inputs or outputs that don't exist.

This commit is contained in:
Neil Dorin
2019-11-19 19:07:19 -07:00
parent db08b1fcd9
commit 11a01c707c

View File

@@ -121,10 +121,18 @@ namespace PepperDash.Essentials.DM
// Set input and output names from config
if (InputNames != null)
foreach (var kvp in InputNames)
(Dmps.SwitcherInputs[kvp.Key] as DMInput).Name.StringValue = kvp.Value;
{
var input = (Dmps.SwitcherInputs[kvp.Key] as DMInput);
if(input != null)
input.Name.StringValue = kvp.Value;
}
if (OutputNames != null)
foreach (var kvp in OutputNames)
(Dmps.SwitcherOutputs[kvp.Key] as Card.Dmps3OutputBase).Name.StringValue = kvp.Value;
{
var output = (Dmps.SwitcherOutputs[kvp.Key] as DMOutput);
if(output != null)
output.Name.StringValue = kvp.Value;
}
// Subscribe to events
Dmps.DMInputChange += new DMInputEventHandler(Dmps_DMInputChange);