Наследование: System.Windows.Forms.Form
        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(ServiceBusHelper serviceBusHelper, MainForm mainForm, RelayDescription relayDescription)
        {
            try
            {
                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;

                testRelayControl = new TestRelayControl(mainForm, WriteToLog, StopLog, StartLog, relayDescription, new ServiceBusHelper(WriteToLog, serviceBusHelper))
                {
                    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
                };

                Text = string.Format(TestRelayFormat, relayDescription.Path);

                testRelayControl.btnCancel.Text = CloseLabel;
                testRelayControl.btnCancel.Click -= testRelayControl.btnCancel_Click;
                testRelayControl.btnCancel.Click += BtnCancelOnClick;
                testRelayControl.Focus();

                panelMain.HeaderText = string.Format(HeaderTextTestRelayFormat, relayDescription.Path);

                panelMain.Controls.Add(testRelayControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, FormTypeEnum formType, TopicDescription topicDescription, List<SubscriptionDescription> subscriptionList)
        {
            try
            {
                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;

                testTopicControl = new TestTopicControl(mainForm, WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), topicDescription, subscriptionList)
                                       {
                                           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 (formType == FormTypeEnum.Send)
                {
                    testTopicControl.mainTabControl.TabPages.RemoveAt(2);
                    testTopicControl.receiverEnabledCheckBox.Checked = false;
                    testTopicControl.senderEnabledCheckBox.Checked = true;
                    testTopicControl.senderEnabledCheckBox.Visible = false;
                    testTopicControl.grouperMessage.Location = new Point(testTopicControl.grouperMessage.Location.X, 8);
                    testTopicControl.grouperMessage.Size = new Size(testTopicControl.grouperMessage.Size.Width,
                                                                    testTopicControl.grouperMessage.Size.Height + 16);
                    testTopicControl.grouperSender.Location = new Point(testTopicControl.grouperSender.Location.X, 8);
                    testTopicControl.grouperSender.Size = new Size(testTopicControl.grouperSender.Size.Width,
                                                                   testTopicControl.grouperSender.Size.Height + 16);
                    Text = string.Format(SendMessagesFormat, topicDescription.Path);
                }
                else
                {
                    Text = string.Format(TestTopicFormat, topicDescription.Path);
                    logTraceListener = new LogTraceListener(WriteToLog);
                    Trace.Listeners.Add(logTraceListener);
                }

                testTopicControl.btnCancel.Text = CloseLabel;
                testTopicControl.btnCancel.Click -= testTopicControl.btnCancel_Click;
                testTopicControl.btnCancel.Click += BtnCancelOnClick;
                testTopicControl.Focus();

                panelMain.HeaderText = string.Format(HeaderTextTestTopicFormat, topicDescription.Path);
                panelMain.Controls.Add(testTopicControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, FormTypeEnum formType, SubscriptionWrapper subscriptionWrapper)
        {
            try
            {
                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;

                if (formType == FormTypeEnum.Listener)
                {
                    var listenerControl = new ListenerControl(WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), subscriptionWrapper.SubscriptionDescription)
                    {
                        Location = new Point(1, panelMain.HeaderHeight + 1),
                        Size = new Size(panelMain.Size.Width - 3, subscriptionWrapper.SubscriptionDescription.RequiresSession ? 544 : 520),
                        Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                    };
                    listenerControl.Focus();

                    Text = string.Format(SubscriptionListenerFormat, subscriptionWrapper.SubscriptionDescription.Name);
                    mainSplitContainer.SplitterDistance = subscriptionWrapper.SubscriptionDescription.RequiresSession ? 570 : listenerControl.Size.Height + 26;
                    panelMain.HeaderText = string.Format(HeaderTextSubscriptionListenerFormat, subscriptionWrapper.SubscriptionDescription.Name);
                    panelMain.Controls.Add(listenerControl);
                }
                else
                {
                    testSubscriptionControl = new TestSubscriptionControl(mainForm, WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), subscriptionWrapper)
                    {
                        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
                    };

                    testSubscriptionControl.btnCancel.Click -= testSubscriptionControl.btnCancel_Click;
                    testSubscriptionControl.btnCancel.Click += BtnCancelOnClick;
                    testSubscriptionControl.Focus();

                    Text = string.Format(TestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);

                    panelMain.HeaderText = string.Format(HeaderTextTestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);
                    panelMain.Controls.Add(testSubscriptionControl);
                }
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the MainForm class.
 /// </summary>
 public MainForm()
 {
     InitializeComponent();
     logTask = Task.Factory.StartNew(AsyncWriteToLog).ContinueWith(t =>
     {
         if (t.IsFaulted && t.Exception != null)
         {
             WriteToLog(t.Exception.Message);
         }
     });
     mainSplitterDistance = mainSplitContainer.SplitterDistance;
     splitterContainerDistance = splitContainer.SplitterDistance;
     treeViewFontSize = serviceBusTreeView.Font.Size;
     logFontSize = lstLog.Font.Size;
     Trace.Listeners.Add(new LogTraceListener());
     mainSingletonMainForm = this;
     serviceBusHelper = new ServiceBusHelper(WriteToLog);
     serviceBusHelper.OnCreate += serviceBusHelper_OnCreate;
     serviceBusHelper.OnDelete += serviceBusHelper_OnDelete;
     serviceBusTreeView.TreeViewNodeSorter = new TreeViewHelper();
     eventClickFieldInfo = typeof(ToolStripItem).GetField(EventClick, BindingFlags.NonPublic | BindingFlags.Static);
     eventsPropertyInfo = typeof(Component).GetProperty(EventsProperty, BindingFlags.NonPublic | BindingFlags.Instance);
     GetServiceBusNamespacesFromConfiguration();
     GetServiceBusNamespaceFromEnvironmentVariable();
     GetBrokeredMessageInspectorsFromConfiguration();
     GetEventDataInspectorsFromConfiguration();
     GetBrokeredMessageGeneratorsFromConfiguration();
     GetEventDataGeneratorsFromConfiguration();
     GetServiceBusNamespaceSettingsFromConfiguration();
     ReadEventHubPartitionCheckpointFile();
 }
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm)
        {
            try
            {
                InitializeComponent();
                logTask = 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 metricMonitorControl = new MetricMonitorControl(WriteToLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), null, null, null)
                {
                    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
                };


                Text = MetricsHeader;
                logTraceListener = new LogTraceListener(WriteToLog);
                Trace.Listeners.Add(logTraceListener);
                metricMonitorControl.Focus();

                panelMain.Controls.Add(metricMonitorControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
 public TestTopicControl(MainForm mainForm,
                         WriteToLogDelegate writeToLog,
                         Action stopAndRestartLog,
                         ServiceBusHelper serviceBusHelper, 
                         TopicDescription topic, 
                         List<SubscriptionDescription> subscriptionList)
 {
     this.mainForm = mainForm;
     this.writeToLog = writeToLog;
     this.stopAndRestartLog = stopAndRestartLog;
     this.serviceBusHelper = serviceBusHelper;
     this.topic = topic;
     this.subscriptionList = subscriptionList;
     InitializeComponent();
     InitializeControls();
 } 
Пример #8
0
        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();
            }
        }
 public TestRelayControl(MainForm mainForm, 
                         WriteToLogDelegate writeToLog,
                         Func<Task> stopLog,
                         Action startLog,
                         RelayDescription relayDescription, 
                         ServiceBusHelper serviceBusHelper)
 {
     this.mainForm = mainForm;
     this.writeToLog = writeToLog;
     this.stopLog = stopLog;
     this.startLog = startLog;
     this.relayDescription = relayDescription;
     this.serviceBusHelper = serviceBusHelper;
     InitializeComponent();
     InitializeControls();
 } 
Пример #10
0
 public TestQueueControl(MainForm mainForm,
                         WriteToLogDelegate writeToLog,
                         Action stopAndRestartLog,
                         ServiceBusHelper serviceBusHelper,
                         QueueDescription queueDescription)
 {
     this.mainForm = mainForm;
     this.writeToLog = writeToLog;
     this.stopAndRestartLog = stopAndRestartLog;
     this.serviceBusHelper = serviceBusHelper;
     this.queueDescription = queueDescription;
     InitializeComponent();
     InitializeControls();
 }
 public TestEventHubControl(MainForm mainForm,
                            WriteToLogDelegate writeToLog,
                            Func<Task> stopLog,
                            Action startLog,
                            ServiceBusHelper serviceBusHelper,
                            EventHubDescription eventHubDescription,
                            PartitionDescription partitionDescription)
 {
     this.mainForm = mainForm;
     this.writeToLog = writeToLog;
     this.stopLog = stopLog;
     this.startLog = startLog;
     this.serviceBusHelper = serviceBusHelper;
     this.eventHubDescription = eventHubDescription;
     this.partitionDescription = partitionDescription;
     InitializeComponent();
     InitializeControls();
 }
 public TestSubscriptionControl(MainForm mainForm,
                                WriteToLogDelegate writeToLog,
                                Action stopAndRestartLog,
                                ServiceBusHelper serviceBusHelper, 
                                SubscriptionWrapper subscriptionWrapper)
 {
     this.mainForm = mainForm;
     this.writeToLog = writeToLog;
     this.stopAndRestartLog = stopAndRestartLog;
     this.serviceBusHelper = serviceBusHelper;
     this.subscriptionWrapper = subscriptionWrapper;
     InitializeComponent();
     InitializeControls();
 } 
 public TestRelayServiceControl(MainForm mainForm, 
                                WriteToLogDelegate writeToLog,
                                Action stopAndRestartLog,
                                RelayServiceWrapper relayServiceWrapper, 
                                ServiceBusHelper serviceBusHelper)
 {
     this.mainForm = mainForm;
     this.writeToLog = writeToLog;
     this.stopAndRestartLog = stopAndRestartLog;
     this.relayServiceWrapper = relayServiceWrapper;
     this.serviceBusHelper = serviceBusHelper;
     InitializeComponent();
     InitializeControls();
 }