public ManagerImageReference(CMConfigurationSection config)
 {
     TemplateFields = new DispatchedObservableCollection <ManagerTemplateField>();
     Config         = config;
     IndexOffset    = 0;
     ImageVariants  = new List <ImageVariant>();
 }
        public WorkerContext()
        {
            _config = (CMConfigurationSection)ConfigurationManager.GetSection("CMConfiguration");

            #region INPUTS
            // Open Connection to INBOUND MQ
            foreach (InputConfiguration input in _config.InputConfigurations)
            {
                switch (input.Type.ToUpper())
                {
                case "MQ":
                {
                    var amquri           = input.MQUri;
                    var amqinQueue       = input.MQQueue;
                    var dataInConnection = new AMQQueueConsumer(amquri, amqinQueue, this);
                    dataInConnection.ConnectAsync();
                    // TODO Catch hand handle connection exceptions and reconnect

                    _disposables.Add(dataInConnection);
                }
                break;
                    //case "HTTP":
                    //    {
                    //        var httpBindIp = input.BindIp;
                    //        var httpBindPort = input.BindPort;
                    //        var dataInHttpServer = new CMHttpServer(httpBindIp, httpBindPort, this);
                    //        dataInHttpServer.Start();

                    //        _disposables.Add(dataInHttpServer);
                    //    }
                    //    break;
                    // TODO Handle and log default
                }
            }

            #endregion INPUTS

            #region OUTPUTS
            // Open Connection to OUTBOUND MQ if enabled and URI defined
            var amqDispatchUri = _config.OutputConfiguration.DispatchMQConfiguration.MQUri;
            if (_config.OutputConfiguration.EnableDataDispatchMQ && !string.IsNullOrEmpty(amqDispatchUri))
            {
                var amqoutqueue       = _config.OutputConfiguration.DispatchMQConfiguration.MQQueue;
                var dataOutConnection = new AMQQueuePublisher(amqDispatchUri, amqoutqueue);
                dataOutConnection.ConnectAsync();
                _publishers.Add(dataOutConnection);
                // TODO Catch hand handle connection exceptions and reconnect

                _disposables.Add(dataOutConnection);
            }
            #endregion OUTPUTS
        }