public HandlePartitionControl(WriteToLogDelegate writeToLog, ServiceBusHelper serviceBusHelper, PartitionDescription partitionDescription)
 {
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.partitionDescription = partitionDescription;
     InitializeComponent();
     InitializeData();
 } 
 public HandleConsumerGroupControl(WriteToLogDelegate writeToLog, ServiceBusHelper serviceBusHelper, ConsumerGroupDescription consumerGroupDescription, string eventHubName)
 {
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.consumerGroupDescription = consumerGroupDescription;
     this.eventHubName = eventHubName;
     InitializeComponent();
     InitializeControls();
 } 
 public HandleRuleControl(WriteToLogDelegate writeToLog, ServiceBusHelper serviceBusHelper, RuleWrapper ruleWrapper, bool? isFirstRule)
 {
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.ruleWrapper = ruleWrapper;
     this.isFirstRule = isFirstRule;
     InitializeComponent();
     InitializeData();
 } 
예제 #4
0
        public ConnectForm(ServiceBusHelper serviceBusHelper)
        {
            InitializeComponent();
            this.serviceBusHelper = serviceBusHelper;
            cboServiceBusNamespace.Items.Add(SelectServiceBusNamespace);
            cboServiceBusNamespace.Items.Add(EnterConnectionString);
            if (serviceBusHelper.ServiceBusNamespaces != null)
            {
                // ReSharper disable CoVariantArrayConversion
                cboServiceBusNamespace.Items.AddRange(serviceBusHelper.ServiceBusNamespaces.Keys.OrderBy(s=>s).ToArray());
                // ReSharper restore CoVariantArrayConversion
            }

            ConnectivityMode = ServiceBusHelper.ConnectivityMode;
            cboConnectivityMode.DataSource = Enum.GetValues(typeof(ConnectivityMode));
            cboConnectivityMode.SelectedItem = ConnectivityMode;

            cboTransportType.DataSource = Enum.GetValues(typeof(TransportType));
            var settings = new MessagingFactorySettings();
            cboTransportType.SelectedItem = settings.TransportType;

            cboServiceBusNamespace.SelectedIndex = connectionStringIndex > 0 ? connectionStringIndex : 0;
            if (cboServiceBusNamespace.Text == EnterConnectionString)
            {
                txtUri.Text = connectionString;
            }

            txtQueueFilterExpression.Text = FilterExpressionHelper.QueueFilterExpression;
            txtTopicFilterExpression.Text = FilterExpressionHelper.TopicFilterExpression;
            txtSubscriptionFilterExpression.Text = FilterExpressionHelper.SubscriptionFilterExpression;
            btnOk.Enabled = cboServiceBusNamespace.SelectedIndex > 1 || (cboServiceBusNamespace.Text == EnterConnectionString && !string.IsNullOrWhiteSpace(connectionString));

            foreach (var item in MainForm.SingletonMainForm.Entities)
            {
                cboSelectedEntities.Items.Add(item);
            }

            foreach (var item in MainForm.SingletonMainForm.SelectedEntities)
            {
                cboSelectedEntities.CheckBoxItems[item].Checked = true;
            }
        }
 public MetricMonitorControl(WriteToLogDelegate writeToLog, 
                             ServiceBusHelper serviceBusHelper, 
                             IList<MetricDataPoint> dataPoints, 
                             string entityName, 
                             string entityType)
 {
     monitorRuleBindingList = new BindingList<MonitorRule>();
     dataPointBindingList = dataPoints != null
                       ? new BindingList<MetricDataPoint>(dataPoints)
                       {
                           AllowNew = true,
                           AllowEdit = true,
                           AllowRemove = true
                       }
                       : new BindingList<MetricDataPoint>
                       {
                           AllowNew = true,
                           AllowEdit = true,
                           AllowRemove = true
                       };
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.entityName = entityName;
     this.entityType = entityType;
     var regex = new Regex(RegularExpression);
     existingEntity = !string.IsNullOrWhiteSpace(entityName) && 
                      !string.IsNullOrWhiteSpace(entityType) && 
                      regex.IsMatch(entityType);
     InitializeComponent();
     InitializeControls();
 }
 public HandleSubscriptionControl(WriteToLogDelegate writeToLog, ServiceBusHelper serviceBusHelper, SubscriptionWrapper subscriptionWrapper)
 {
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.subscriptionWrapper = subscriptionWrapper;
     dataPointBindingList = new BindingList<MetricDataPoint>
     {
         AllowNew = true,
         AllowEdit = true,
         AllowRemove = true
     };
     InitializeComponent();
     InitializeControls();
 } 
예제 #7
0
        public MessageForm(BrokeredMessage brokeredMessage, ServiceBusHelper serviceBusHelper, WriteToLogDelegate writeToLog)
        {
            this.brokeredMessage = brokeredMessage;
            this.serviceBusHelper = serviceBusHelper;
            this.writeToLog = writeToLog;
            InitializeComponent();

            cboBodyType.SelectedIndex = 0;

            messagePropertyGrid.SelectedObject = brokeredMessage;
            BodyType bodyType;
            txtMessageText.Text = XmlHelper.Indent(serviceBusHelper.GetMessageText(brokeredMessage, out bodyType));

            // Initialize the DataGridView.
            bindingSource.DataSource = new BindingList<MessagePropertyInfo>(brokeredMessage.Properties.Select(p => new MessagePropertyInfo(p.Key, 
                                                                                                      p.Value.GetType().ToString().Substring(7),
                                                                                                      p.Value)).ToList());
            propertiesDataGridView.AutoGenerateColumns = false;
            propertiesDataGridView.AutoSize = true;
            propertiesDataGridView.DataSource = bindingSource;
            propertiesDataGridView.ForeColor = SystemColors.WindowText;

            // Create the Name column
            var textBoxColumn = new DataGridViewTextBoxColumn
            {
                DataPropertyName = PropertyKey,
                Name = PropertyKey,
                Width = 138
            };
            propertiesDataGridView.Columns.Add(textBoxColumn);

            // Create the Type column
            var comboBoxColumn = new DataGridViewComboBoxColumn
            {
                DataSource = types,
                DataPropertyName = PropertyType,
                Name = PropertyType,
                Width = 90,
                FlatStyle = FlatStyle.Flat
            };
            propertiesDataGridView.Columns.Add(comboBoxColumn);

            // Create the Value column
            textBoxColumn = new DataGridViewTextBoxColumn
            {
                DataPropertyName = PropertyValue,
                Name = PropertyValue,
                Width = 138
            };
            propertiesDataGridView.Columns.Add(textBoxColumn);

            // Set Grid style
            propertiesDataGridView.EnableHeadersVisualStyles = false;

            // Set the selection background color for all the cells.
            propertiesDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150);
            propertiesDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window;

            // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default 
            // value won't override DataGridView.DefaultCellStyle.SelectionBackColor.
            propertiesDataGridView.RowHeadersDefaultCellStyle.SelectionBackColor = Color.FromArgb(153, 180, 209);

            // Set the background color for all rows and for alternating rows.  
            // The value for alternating rows overrides the value for all rows. 
            propertiesDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window;
            propertiesDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText;
            //propertiesDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White;
            //propertiesDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText;

            // Set the row and column header styles.
            propertiesDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242);
            propertiesDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText;
            propertiesDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242);
            propertiesDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText;

            // Get Brokered Message Inspector classes
            cboSenderInspector.Items.Add(SelectBrokeredMessageInspector);
            cboSenderInspector.SelectedIndex = 0;

            if (serviceBusHelper.BrokeredMessageInspectors == null)
            {
                return;
            }
            foreach (var key in serviceBusHelper.BrokeredMessageInspectors.Keys)
            {
                cboSenderInspector.Items.Add(key);
            }
        }
 public HandleEventHubControl(WriteToLogDelegate writeToLog, ServiceBusHelper serviceBusHelper, EventHubDescription eventHubDescription)
 {
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.eventHubDescription = eventHubDescription;
     InitializeComponent();
     InitializeControls();
 } 
 public PartitionListenerControl(WriteToLogDelegate writeToLog,
                                 Func<Task> stopLog,
                                 Action startLog,
                                 string iotHubConnectionString,
                                 string consumerGroupName)
 {
     Task.Factory.StartNew(AsyncTrackEventData).ContinueWith(t =>
     {
         if (t.IsFaulted && t.Exception != null)
         {
             writeToLog(t.Exception.Message);
         }
     });
     this.iotHubConnectionString = iotHubConnectionString;
     this.writeToLog = writeToLog;
     this.stopLog = stopLog;
     this.startLog = startLog;
     serviceBusHelper = new ServiceBusHelper(writeToLog);
     eventHubClient = EventHubClient.CreateFromConnectionString(iotHubConnectionString, "messages/events");
     consumerGroup = string.Compare(consumerGroupName,
                                    DefaultConsumerGroupName,
                                    StringComparison.InvariantCultureIgnoreCase) == 0
                                    ? eventHubClient.GetDefaultConsumerGroup()
                                    : eventHubClient.GetConsumerGroup(consumerGroupName);
     IList<string> partitionIdList = new List<string>(eventHubClient.GetRuntimeInformation().PartitionIds);
     foreach (var id in partitionIdList)
     {
         partitionRuntumeInformationList.Add(eventHubClient.GetPartitionRuntimeInformation(id));
     }
     partitionCount = partitionRuntumeInformationList.Count;
     InitializeComponent();
     InitializeControls();
     Disposed += ListenerControl_Disposed;
 }
 public PartitionListenerControl(WriteToLogDelegate writeToLog,
                                 Action stopAndRestartLog,
                                 ServiceBusHelper serviceBusHelper, 
                                 ConsumerGroupDescription consumerGroupDescription,
                                 IEnumerable<PartitionDescription> partitionDescriptions)
 {
     Task.Factory.StartNew(AsyncTrackEventData).ContinueWith(t =>
     {
         if (t.IsFaulted && t.Exception != null)
         {
             writeToLog(t.Exception.Message);
         }
     });
     this.writeToLog = writeToLog;
     this.stopAndRestartLog = stopAndRestartLog;
     this.serviceBusHelper = serviceBusHelper;
     this.consumerGroupDescription = consumerGroupDescription;
     var descriptions = partitionDescriptions as IList<PartitionDescription> ?? partitionDescriptions.ToList();
     this.partitionDescriptions = descriptions;
     partitionCount = partitionDescriptions == null || descriptions.Count == 0? 0 : descriptions.Count;
     eventHubDescription = serviceBusHelper.NamespaceManager.GetEventHub(consumerGroupDescription.EventHubPath);    
     InitializeComponent();
     InitializeControls();
     checkBoxCheckpoint_CheckedChanged(null, null);
     Disposed += ListenerControl_Disposed;
 }
 public HandleEventHubControl(WriteToLogDelegate writeToLog, ServiceBusHelper serviceBusHelper, EventHubDescription eventHubDescription)
 {
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.eventHubDescription = eventHubDescription;
     dataPointBindingList = new BindingList<MetricDataPoint>
     {
         AllowNew = true,
         AllowEdit = true,
         AllowRemove = true
     };
     InitializeComponent();
     InitializeControls();
 } 
 public HandleTopicControl(WriteToLogDelegate writeToLog, ServiceBusHelper serviceBusHelper, TopicDescription topicDescription, string path)
 {
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.topicDescription = topicDescription;
     this.path = path;
     dataPointBindingList = new BindingList<MetricDataPoint>
     {
         AllowNew = true,
         AllowEdit = true,
         AllowRemove = true
     };
     InitializeComponent();
     InitializeControls();
 } 
 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();
 } 
 public ListenerControl(WriteToLogDelegate writeToLog,
                        Func<Task> stopLog,
                        Action startLog,
                        ServiceBusHelper serviceBusHelper, 
                        EntityDescription entityDescription)
 {
     this.logStopped = false;
     Task.Factory.StartNew(AsyncTrackMessage).ContinueWith(t =>
     {
         if (t.IsFaulted && t.Exception != null)
         {
             writeToLog(t.Exception.Message);
         }
     });
     this.writeToLog = writeToLog;
     this.stopLog = stopLog;
     this.startLog = startLog;
     this.serviceBusHelper = serviceBusHelper;
     this.entityDescription = entityDescription;
     var element = new BinaryMessageEncodingBindingElement();
     var encoderFactory = element.CreateMessageEncoderFactory();
     encoder = encoderFactory.Encoder;
     InitializeComponent();
     InitializeControls();
     Disposed += ListenerControl_Disposed;
     if (entityDescription is SubscriptionDescription)
     {
         grouperEntityInformation.GroupTitle = "Subscription Information";
     }
 }
 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 HandleNotificationHubControl(WriteToLogDelegate writeToLog, 
                                     ServiceBusHelper serviceBusHelper, 
                                     NotificationHubDescription notificationHubDescription)
 {
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.notificationHubDescription = notificationHubDescription;
     
     InitializeComponent();
     InitializeControls();
 } 
예제 #17
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();
 }
예제 #18
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();
 }
예제 #19
0
        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();
            }
        }
예제 #20
0
 /// <summary>
 /// Initializes a new instance of the ServiceBusHelper class.
 /// </summary>
 /// <param name="writeToLog">WriteToLog method.</param>
 /// <param name="serviceBusHelper">Base ServiceBusHelper.</param>
 public ServiceBusHelper(WriteToLogDelegate writeToLog, ServiceBusHelper serviceBusHelper)
 {
     this.writeToLog = writeToLog;
     traceEnabled = serviceBusHelper.TraceEnabled;
     AtomFeedUri = serviceBusHelper.AtomFeedUri;
     IssuerName = serviceBusHelper.IssuerName;
     IssuerSecret = serviceBusHelper.IssuerSecret;
     MessageDeferProviderType = serviceBusHelper.MessageDeferProviderType;
     connectionString = serviceBusHelper.ConnectionString;
     namespaceManager = serviceBusHelper.NamespaceManager;
     MessagingFactory = serviceBusHelper.MessagingFactory;
     Namespace = serviceBusHelper.Namespace;
     NamespaceUri = serviceBusHelper.NamespaceUri;
     IssuerSecret = serviceBusHelper.IssuerSecret;
     MessageDeferProviderType = serviceBusHelper.MessageDeferProviderType;
     MessagingFactory = serviceBusHelper.MessagingFactory;
     Namespace = serviceBusHelper.Namespace;
     Scheme = serviceBusHelper.Scheme;
     ServiceBusNamespaces = serviceBusHelper.ServiceBusNamespaces;
     BrokeredMessageInspectors = serviceBusHelper.BrokeredMessageInspectors;
     EventDataInspectors = serviceBusHelper.EventDataInspectors;
     BrokeredMessageGenerators = serviceBusHelper.BrokeredMessageGenerators;
     EventDataGenerators = serviceBusHelper.EventDataGenerators;
     ServicePath = serviceBusHelper.ServicePath;
     TokenProvider = serviceBusHelper.TokenProvider;
     TraceEnabled = serviceBusHelper.TraceEnabled;
 }
예제 #21
0
        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 PartitionListenerControl(WriteToLogDelegate writeToLog,
                                 Func<Task> stopLog,
                                 Action startLog,
                                 ServiceBusHelper serviceBusHelper,
                                 ConsumerGroupDescription consumerGroupDescription,
                                 IEnumerable<PartitionDescription> partitionDescriptions)
 {
     Task.Factory.StartNew(AsyncTrackEventData).ContinueWith(t =>
     {
         if (t.IsFaulted && t.Exception != null)
         {
             writeToLog(t.Exception.Message);
         }
     });
     this.writeToLog = writeToLog;
     this.stopLog = stopLog;
     this.startLog = startLog;
     this.serviceBusHelper = serviceBusHelper;
     eventHubDescription = serviceBusHelper.NamespaceManager.GetEventHub(consumerGroupDescription.EventHubPath);
     eventHubClient = EventHubClient.CreateFromConnectionString(GetAmqpConnectionString(serviceBusHelper.ConnectionString),
                                                                                        consumerGroupDescription.EventHubPath);
     consumerGroup = string.Compare(consumerGroupDescription.Name,
                                    DefaultConsumerGroupName,
                                    StringComparison.InvariantCultureIgnoreCase) == 0
                                    ? eventHubClient.GetDefaultConsumerGroup()
                                    : eventHubClient.GetConsumerGroup(consumerGroupDescription.Name);
     IList<string> partitionIdList = partitionDescriptions.Select(pd => pd.PartitionId).ToList();
     foreach (var id in partitionIdList)
     {
         partitionRuntumeInformationList.Add(eventHubClient.GetPartitionRuntimeInformation(id));
     }
     partitionCount = partitionRuntumeInformationList.Count;
     InitializeComponent();
     InitializeControls();
     Disposed += ListenerControl_Disposed;
 }
 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();
 } 
예제 #24
0
        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 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();
 }
예제 #26
0
        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();
            }
        }
 public HandleConsumerGroupControl(WriteToLogDelegate writeToLog, ServiceBusHelper serviceBusHelper, ConsumerGroupDescription consumerGroupDescription, string eventHubName)
 {
     this.writeToLog = writeToLog;
     this.serviceBusHelper = serviceBusHelper;
     this.consumerGroupDescription = consumerGroupDescription;
     this.eventHubName = eventHubName;
     dataPointBindingList = new BindingList<MetricDataPoint>
     {
         AllowNew = true,
         AllowEdit = true,
         AllowRemove = true
     };
     InitializeComponent();
     InitializeControls();
 } 
예제 #28
0
        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();
            }
        }
예제 #29
0
 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();
 }