public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, ConsumerGroupDescription consumerGroupDescription, IEnumerable<PartitionDescription> partitionDescriptions)
        {
            try
            {
                var descriptions = partitionDescriptions as IList<PartitionDescription> ?? partitionDescriptions.ToList();
                if (partitionDescriptions == null || !descriptions.Any())
                {
                    return;
                }
                InitializeComponent();
                Task.Factory.StartNew(AsyncWriteToLog).ContinueWith(t =>
                {
                    if (t.IsFaulted && t.Exception != null)
                    {
                        WriteToLog(t.Exception.Message);
                    }
                });
                this.mainForm = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                var partitionListenerControl = new PartitionListenerControl(WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), consumerGroupDescription, descriptions)
                {
                    Location = new Point(1, panelMain.HeaderHeight + 1),
                    Size = new Size(panelMain.Size.Width - 3, panelMain.Size.Height - 26),
                    Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                };

                if (descriptions.Count == 1)
                {
                    Text = string.Format(PartitionListenerFormat, descriptions[0].PartitionId, consumerGroupDescription.Name);
                    panelMain.HeaderText = string.Format(HeaderTextPartitionListenerFormat, descriptions[0].PartitionId);
                }
                else
                {
                    Text = string.Format(ConsumerGroupListenerFormat, consumerGroupDescription.Name);
                    panelMain.HeaderText = string.Format(HeaderTextConsumerGroupListenerFormat, consumerGroupDescription.Name);
                }                
                partitionListenerControl.Focus();
                panelMain.Controls.Add(partitionListenerControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
        public ContainerForm(MainForm mainForm, string connectionString, string consumerGroup)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(connectionString) || string.IsNullOrWhiteSpace(consumerGroup))
                {
                    return;
                }
                InitializeComponent();
                Task.Factory.StartNew(AsyncWriteToLog).ContinueWith(t =>
                {
                    if (t.IsFaulted && t.Exception != null)
                    {
                        WriteToLog(t.Exception.Message);
                    }
                });
                this.mainForm = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                var partitionListenerControl = new PartitionListenerControl(WriteToLog, StopLog, StartLog, connectionString, consumerGroup)
                {
                    Location = new Point(1, panelMain.HeaderHeight + 1),
                    Size = new Size(panelMain.Size.Width - 3, panelMain.Size.Height - 26),
                    Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                };
                var match = Regex.Match(connectionString, @"HostName=([A-Za-z0-9_-]+)", RegexOptions.IgnoreCase);
                var ioTHubName = match.Success ? match.Groups[1].Value : string.Empty;
                Text = string.Format(IoTHubListenerFormat, consumerGroup, ioTHubName);
                panelMain.HeaderText = string.Format(HeaderTextIoTHubListenerFormat, ioTHubName);
                partitionListenerControl.Focus();
                panelMain.Controls.Add(partitionListenerControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                if (panelMain != null)
                {
                    panelMain.ResumeDrawing();
                }
                ResumeLayout();
            }
        }