private static bool TestOutputRange(ControlSystem.eDmps34K150COutputs Output)
 {
     if (Output >= ControlSystem.eDmps34K150COutputs.DmHdmiAnalogOutput && Output <= ControlSystem.eDmps34K150COutputs.DmHdmiAnalogOutput)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        //factory to prevent duplicate instansiations.
        public static DMPS4K150C_DM_Output GetDMOutput(ControlSystem ControlSystem, ControlSystem.eDmps34K150COutputs Output)
        {
            if (TestOutputRange(Output))
            {
                switch (Output)
                {
                case Crestron.SimplSharpPro.CrestronControlSystem.eDmps34K150COutputs.DmHdmiAnalogOutput:
                    return(DMOutput1 ?? (DMOutput1 = new DMPS4K150C_DM_Output(ControlSystem, Output)));

                default:
                    return(null);
                }
            }
            else
            {
                throw new IndexOutOfRangeException();
            }
        }
        private DMPS4K150C_DM_Output(ControlSystem ControlSystem, ControlSystem.eDmps34K150COutputs Output)
        {
            //this.DMOutputPort = Output.ToString();
            this.DMOutputPort = "DM1Out";

            TestControlSystemType.isDMPS4K150C(ControlSystem, "This Module is for a DMPS4K150C Control System");

            _ControlSystem  = ControlSystem;
            _SwitcherOutput = DMPS4K150C_SwitcherOutput.GetDMPS4K150C_SwitcherOutput(_ControlSystem);
            _DMOutput       = _ControlSystem.SwitcherOutputs[(uint)Output] as Card.Dmps3DmHdmiAudioOutput;

            _SwitcherOutput.DmpsDmHdmiOutputStreamChanged += new DMPS4K150C_SwitcherOutput.SwitcherOutputEventHandler(_SwitcherOutput_DMHDMIOutputStreamChanged);
            _SwitcherOutput.HdmiOutputStreamChanged       += new DMPS4K150C_SwitcherOutput.SwitcherOutputEventHandler(_SwitcherOutput_HdmiOutputStreamChanged);
            _SwitcherOutput.DmOutputStreamChanged         += new DMPS4K150C_SwitcherOutput.SwitcherOutputEventHandler(_SwitcherOutput_DmOutputStreamChanged);
            _SwitcherOutput.DMOutputChanged += new DMPS4K150C_SwitcherOutput.SwitcherOutputEventHandler(_SwitcherOutput_DMOutputChanged);

            _DMOutput.DmOutputPort.StreamCec.CecChange += new CecChangeEventHandler(DMStreamCec_CecChange);
            _DMOutput.DmOutputPort.ConnectedDevice.DeviceInformationChange += new ConnectedDeviceChangeEventHandler(DMConnectedDevice_DeviceInformationChange);

            _DMOutput.HdmiOutputPort.StreamCec.CecChange += new CecChangeEventHandler(HDMIStreamCec_CecChange);
            _DMOutput.HdmiOutputPort.ConnectedDevice.DeviceInformationChange += new ConnectedDeviceChangeEventHandler(HDMIConnectedDevice_DeviceInformationChange);
        }