private void ShowPartition(PartitionDescription partition)
        {
            HandlePartitionControl partitionControl = null;

            try
            {
                panelMain.SuspendDrawing();
                foreach (var userControl in panelMain.Controls.OfType<UserControl>())
                {
                    userControl.Dispose();
                }
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                if (string.IsNullOrWhiteSpace(partition.LastEnqueuedOffset))
                {
                    var consumerGroup = serviceBusTreeView.SelectedNode.Parent.Parent.Tag as ConsumerGroupDescription;
                    var consumerGroupName = consumerGroup != null ? consumerGroup.Name : null;
                    partition = serviceBusHelper.GetPartition(partition.EventHubPath,
                                                              consumerGroupName,
                                                              partition.PartitionId);
                }
                partitionControl = new HandlePartitionControl(WriteToLog, serviceBusHelper, partition);
                partitionControl.SuspendDrawing();
                partitionControl.Location = new Point(1, panelLog.HeaderHeight + 1);
                panelMain.Controls.Add(partitionControl);
                partitionControl.OnRefresh += MainForm_OnRefresh;
                SetControlSize(partitionControl);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            finally
            {
                panelMain.ResumeDrawing();
                if (partitionControl != null)
                {
                    partitionControl.ResumeDrawing();
                }
            }
        }
Beispiel #2
0
        private void ShowPartition(PartitionDescription partition)
        {
            HandlePartitionControl partitionControl = null;

            try
            {
                panelMain.SuspendDrawing();
                foreach (var userControl in panelMain.Controls.OfType<UserControl>())
                {
                    userControl.Dispose();
                }
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;
                partitionControl = new HandlePartitionControl(WriteToLog, serviceBusHelper, partition);
                partitionControl.SuspendDrawing();
                partitionControl.Location = new Point(1, panelLog.HeaderHeight + 1);
                panelMain.Controls.Add(partitionControl);
                partitionControl.OnRefresh += MainForm_OnRefresh;
                SetControlSize(partitionControl);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            finally
            {
                panelMain.ResumeDrawing();
                if (partitionControl != null)
                {
                    partitionControl.ResumeDrawing();
                }
            }
        }