private void InitializeControls() { // Splitter controls messagesSplitContainer.SplitterWidth = 16; sessionsSplitContainer.SplitterWidth = 16; deadletterSplitContainer.SplitterWidth = 16; messagesCustomPropertiesSplitContainer.SplitterWidth = 16; deadletterCustomPropertiesSplitContainer.SplitterWidth = 16; messageListTextPropertiesSplitContainer.SplitterWidth = 8; deadletterListTextPropertiesSplitContainer.SplitterWidth = 8; // Tabe pages DisablePage(MessagesTabPage); DisablePage(SessionsTabPage); DisablePage(DeadletterTabPage); // Set Grid style dataPointDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. dataPointDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); dataPointDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. dataPointDataGridView.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. dataPointDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; dataPointDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. dataPointDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; dataPointDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. dataPointBindingSource.DataSource = dataPointBindingList; dataPointDataGridView.AutoGenerateColumns = false; dataPointDataGridView.AutoSize = true; dataPointDataGridView.DataSource = dataPointBindingSource; dataPointDataGridView.ForeColor = SystemColors.WindowText; if (subscriptionWrapper != null && subscriptionWrapper.SubscriptionDescription != null) { MetricInfo.GetMetricInfoListAsync(serviceBusHelper.Namespace, SubscriptionEntity, string.Format(SubscriptionPathFormat, subscriptionWrapper.SubscriptionDescription.TopicPath, subscriptionWrapper.SubscriptionDescription.Name)).ContinueWith(t => metricsManualResetEvent.Set()); } if (dataPointDataGridView.Columns.Count == 0) { // Create the Metric column var metricColumn = new DataGridViewComboBoxColumn { DataSource = MetricInfo.EntityMetricDictionary.ContainsKey(SubscriptionEntity) ? MetricInfo.EntityMetricDictionary[SubscriptionEntity] : null, DataPropertyName = MetricProperty, DisplayMember = FriendlyNameProperty, ValueMember = NameProperty, Name = MetricProperty, Width = 144, DropDownWidth = 250, FlatStyle = FlatStyle.Flat, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; dataPointDataGridView.Columns.Add(metricColumn); // Create the Time Granularity column var timeGranularityColumn = new DataGridViewComboBoxColumn { DataSource = timeGranularityList, DataPropertyName = GranularityProperty, Name = GranularityProperty, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(timeGranularityColumn); // Create the Time Operator 1 column var operator1Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator1Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator1Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator1Column); // Create the Time Value 1 column var value1Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue1Name, HeaderText = TimeFilterValue, Name = TimeFilterValue1Name, Width = 136 }; dataPointDataGridView.Columns.Add(value1Column); // Create the Time Operator 1 column var operator2Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator2Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator2Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator2Column); // Create the Time Value 1 column var value2Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue2Name, HeaderText = TimeFilterValue, Name = TimeFilterValue2Name, Width = 136 }; dataPointDataGridView.Columns.Add(value2Column); // Create delete column var deleteButtonColumn = new DataGridViewButtonColumn { Name = DeleteName, CellTemplate = new DataGridViewDeleteButtonCell(), HeaderText = string.Empty, Width = 22 }; deleteButtonColumn.CellTemplate.ToolTipText = DeleteTooltip; deleteButtonColumn.UseColumnTextForButtonValue = true; dataPointDataGridView.Columns.Add(deleteButtonColumn); } if (subscriptionWrapper != null && subscriptionWrapper.TopicDescription != null && subscriptionWrapper.SubscriptionDescription != null) { // Tab pages if (serviceBusHelper.IsCloudNamespace) { EnablePage(MetricsTabPage); } else { DisablePage(MetricsTabPage); } // Initialize textboxes txtName.ReadOnly = true; txtName.BackColor = SystemColors.Window; txtName.GotFocus += textBox_GotFocus; txtFilter.ReadOnly = true; txtFilter.BackColor = SystemColors.Window; txtFilter.GotFocus += textBox_GotFocus; txtAction.ReadOnly = true; txtAction.BackColor = SystemColors.Window; txtAction.GotFocus += textBox_GotFocus; txtMessageText.ReadOnly = true; txtMessageText.BackColor = SystemColors.Window; txtMessageText.GotFocus += textBox_GotFocus; txtDeadletterText.ReadOnly = true; txtDeadletterText.BackColor = SystemColors.Window; txtDeadletterText.GotFocus += textBox_GotFocus; txtSessionState.ReadOnly = true; txtSessionState.BackColor = SystemColors.Window; txtSessionState.GotFocus += textBox_GotFocus; // Initialize groupers grouperDefaultRule.Visible = false; grouperSubscriptionSettings.Location = grouperDefaultRule.Location; grouperSubscriptionSettings.Size = new Size(grouperSubscriptionSettings.Size.Width, grouperSubscriptionSettings.Size.Height + grouperDefaultRule.Size.Height + 8); // Initialize Data InitializeData(); // Set Grid style messagesDataGridView.EnableHeadersVisualStyles = false; messagesDataGridView.AutoGenerateColumns = false; messagesDataGridView.AutoSize = true; // Create the MessageId column var textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = MessageId, Name = MessageId, Width = 120 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the SequenceNumber column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = SequenceNumberValue, Name = SequenceNumberName, Width = 52 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the Size column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = MessageSize, Name = MessageSize, Width = 52 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the Label column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = Label, Name = Label, Width = 120 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the EnqueuedTimeUtc column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = EnqueuedTimeUtc, Name = EnqueuedTimeUtc, Width = 120 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the ExpiresAtUtc column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = ExpiresAtUtc, Name = ExpiresAtUtc, Width = 120 }; messagesDataGridView.Columns.Add(textBoxColumn); // Set the selection background color for all the cells. messagesDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); messagesDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. messagesDataGridView.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. messagesDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; messagesDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //messagesDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //messagesDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. messagesDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); messagesDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; messagesDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); messagesDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set Grid style sessionsDataGridView.EnableHeadersVisualStyles = false; sessionsDataGridView.AutoGenerateColumns = false; sessionsDataGridView.AutoSize = true; // Create the SessionId column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = SessionId, Name = SessionId, Width = 120 }; sessionsDataGridView.Columns.Add(textBoxColumn); // Create the Path column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = Path, Name = Path, Width = 120 }; sessionsDataGridView.Columns.Add(textBoxColumn); // Create the Mode column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = Mode, Name = Mode, Width = 120 }; sessionsDataGridView.Columns.Add(textBoxColumn); // Create the BatchFlushInterval column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = BatchFlushInterval, Name = BatchFlushInterval, Width = 120 }; sessionsDataGridView.Columns.Add(textBoxColumn); // Set the selection background color for all the cells. sessionsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); sessionsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. sessionsDataGridView.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. sessionsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; sessionsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //sessionsDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //sessionsDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. sessionsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); sessionsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; sessionsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); sessionsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set Grid style deadletterDataGridView.EnableHeadersVisualStyles = false; deadletterDataGridView.AutoGenerateColumns = false; deadletterDataGridView.AutoSize = true; // Create the MessageId column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = MessageId, Name = MessageId, Width = 120 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the SequenceNumber column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = SequenceNumberValue, Name = SequenceNumberName, Width = 52 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the Size column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = MessageSize, Name = MessageSize, Width = 52 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the Label column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = Label, Name = Label, Width = 120 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the EnqueuedTimeUtc column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = EnqueuedTimeUtc, Name = EnqueuedTimeUtc, Width = 120 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the ExpiresAtUtc column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = ExpiresAtUtc, Name = ExpiresAtUtc, Width = 120 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Set the selection background color for all the cells. deadletterDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); deadletterDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. deadletterDataGridView.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. deadletterDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; deadletterDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //deadletterDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //deadletterDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. deadletterDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); deadletterDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; deadletterDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); deadletterDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; checkedListBox.ItemCheck += checkedListBox_ItemCheck; toolTip.SetToolTip(txtName, NameTooltip); toolTip.SetToolTip(txtUserMetadata, UserMetadataTooltip); toolTip.SetToolTip(txtForwardTo, ForwardToTooltip); toolTip.SetToolTip(txtForwardDeadLetteredMessagesTo, ForwardDeadLetteredMessagesToTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveDays, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveHours, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveMinutes, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveSeconds, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveMilliseconds, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtFilter, FilterExpressionTooltip); toolTip.SetToolTip(txtAction, FilterActionTooltip); toolTip.SetToolTip(txtLockDurationDays, LockDurationTooltip); toolTip.SetToolTip(txtLockDurationHours, LockDurationTooltip); toolTip.SetToolTip(txtLockDurationMinutes, LockDurationTooltip); toolTip.SetToolTip(txtLockDurationSeconds, LockDurationTooltip); toolTip.SetToolTip(txtLockDurationMilliseconds, LockDurationTooltip); toolTip.SetToolTip(txtMaxDeliveryCount, MaxDeliveryCountTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleDays, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleHours, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleMinutes, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleSeconds, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleMilliseconds, AutoDeleteOnIdleTooltip); } else { // Tab pages DisablePage(MetricsTabPage); // Initialize buttons btnCreateDelete.Text = CreateText; btnCancelUpdate.Text = CancelText; btnRefresh.Visible = false; btnChangeStatus.Visible = false; btnMessages.Visible = false; btnSessions.Visible = false; btnDeadletter.Visible = false; btnMetrics.Visible = false; btnCloseTabs.Visible = false; txtName.Focus(); } }
private void InitializeControls() { trackBarMaxTopicSize.Maximum = serviceBusHelper.IsCloudNamespace ? 5 : 11; // IsAnonymousAccessible if (serviceBusHelper.IsCloudNamespace) { if (checkedListBox.Items.Count > IsAnonymousAccessibleIndex) { checkedListBox.Items.RemoveAt(IsAnonymousAccessibleIndex); } } // Set Grid style authorizationRulesDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. authorizationRulesDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); authorizationRulesDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. authorizationRulesDataGridView.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. authorizationRulesDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; authorizationRulesDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. authorizationRulesDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.AutoGenerateColumns = false; if (authorizationRulesDataGridView.Columns.Count == 0) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "IssuerName", DataPropertyName = "IssuerName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewComboBoxColumn { Name = "ClaimType", DataPropertyName = "ClaimType", DataSource = claimTypes, FlatStyle = FlatStyle.Flat }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ClaimValue", DataPropertyName = "ClaimValue" }); if (serviceBusHelper.IsCloudNamespace) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "KeyName", DataPropertyName = "KeyName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "PrimaryKey", DataPropertyName = "PrimaryKey" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "SecondaryKey", DataPropertyName = "SecondaryKey" }); } authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Manage", DataPropertyName = "Manage", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Send", DataPropertyName = "Send", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Listen", DataPropertyName = "Listen", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "Revision", DataPropertyName = "Revision", Width = 50, ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "CreatedTime", DataPropertyName = "CreatedTime", ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ModifiedTime", DataPropertyName = "ModifiedTime", ReadOnly = true }); } // Set Grid style dataPointDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. dataPointDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); dataPointDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. dataPointDataGridView.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. dataPointDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; dataPointDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. dataPointDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; dataPointDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. dataPointBindingSource.DataSource = dataPointBindingList; dataPointDataGridView.AutoGenerateColumns = false; dataPointDataGridView.AutoSize = true; dataPointDataGridView.DataSource = dataPointBindingSource; dataPointDataGridView.ForeColor = SystemColors.WindowText; if (dataPointDataGridView.Columns.Count == 0) { // Create the Metric column var metricColumn = new DataGridViewComboBoxColumn { DataSource = MetricInfo.MetricInfos, DataPropertyName = MetricProperty, DisplayMember = FriendlyNameProperty, ValueMember = NameProperty, Name = MetricProperty, Width = 144, FlatStyle = FlatStyle.Flat, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; dataPointDataGridView.Columns.Add(metricColumn); // Create the Time Granularity column var timeGranularityColumn = new DataGridViewComboBoxColumn { DataSource = timeGranularityList, DataPropertyName = GranularityProperty, Name = GranularityProperty, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(timeGranularityColumn); // Create the Time Operator 1 column var operator1Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator1Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator1Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator1Column); // Create the Time Value 1 column var value1Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue1Name, HeaderText = TimeFilterValue, Name = TimeFilterValue1Name, Width = 136 }; dataPointDataGridView.Columns.Add(value1Column); // Create the Time Operator 1 column var operator2Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator2Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator2Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator2Column); // Create the Time Value 1 column var value2Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue2Name, HeaderText = TimeFilterValue, Name = TimeFilterValue2Name, Width = 136 }; dataPointDataGridView.Columns.Add(value2Column); } if (topicDescription != null) { // Tab pages if (serviceBusHelper.IsCloudNamespace) { EnablePage(MetricsTabPage); } else { DisablePage(MetricsTabPage); } // Initialize buttons btnCreateDelete.Text = DeleteText; btnCancelUpdate.Text = UpdateText; btnChangeStatus.Text = topicDescription.Status == EntityStatus.Active ? DisableText : EnableText; btnRefresh.Visible = true; btnChangeStatus.Visible = true; btnMetrics.Visible = serviceBusHelper.IsCloudNamespace; // Initialize textboxes txtPath.ReadOnly = true; txtPath.BackColor = SystemColors.Window; txtPath.GotFocus += textBox_GotFocus; trackBarMaxTopicSize.Enabled = false; // Initialize Data InitializeData(); checkedListBox.ItemCheck += checkedListBox_ItemCheck; toolTip.SetToolTip(txtPath, PathTooltip); toolTip.SetToolTip(txtUserMetadata, UserMetadataTooltip); toolTip.SetToolTip(trackBarMaxTopicSize, MaxTopicSizeTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveDays, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveHours, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveMinutes, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveSeconds, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveMilliseconds, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowDays, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowHours, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowMinutes, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowSeconds, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowMilliseconds, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleDays, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleHours, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleMinutes, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleSeconds, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleMilliseconds, AutoDeleteOnIdleTooltip); } else { // Tab pages DisablePage(MetricsTabPage); // Initialize buttons btnCreateDelete.Text = CreateText; btnCancelUpdate.Text = CancelText; btnRefresh.Visible = false; btnChangeStatus.Visible = false; btnMetrics.Visible = false; // Create BindingList for Authorization Rules var bindingList = new BindingList<AuthorizationRuleWrapper>(new List<AuthorizationRuleWrapper>()) { AllowEdit = true, AllowNew = true, AllowRemove = true }; bindingList.ListChanged += bindingList_ListChanged; authorizationRulesBindingSource.DataSource = bindingList; authorizationRulesDataGridView.DataSource = authorizationRulesBindingSource; if (!string.IsNullOrWhiteSpace(path)) { txtPath.Text = path; } txtPath.Focus(); } }
private void InitializeControls() { trackBarMaxQueueSize.Maximum = serviceBusHelper.IsCloudNamespace ? 5 : 11; // Splitter controls messagesSplitContainer.SplitterWidth = 16; sessionsSplitContainer.SplitterWidth = 16; deadletterSplitContainer.SplitterWidth = 16; messagesCustomPropertiesSplitContainer.SplitterWidth = 16; deadletterCustomPropertiesSplitContainer.SplitterWidth = 16; messageListTextPropertiesSplitContainer.SplitterWidth = 8; sessionListTextPropertiesSplitContainer.SplitterWidth = 8; deadletterListTextPropertiesSplitContainer.SplitterWidth = 8; // Tab pages DisablePage(MessagesTabPage); DisablePage(SessionsTabPage); DisablePage(DeadletterTabPage); // IsAnonymousAccessible if (serviceBusHelper.IsCloudNamespace) { if (checkedListBox.Items.Count > IsAnonymousAccessibleIndex) { checkedListBox.Items.RemoveAt(IsAnonymousAccessibleIndex); } } // Set Grid style authorizationRulesDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. authorizationRulesDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); authorizationRulesDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. authorizationRulesDataGridView.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. authorizationRulesDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; authorizationRulesDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. authorizationRulesDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.AutoGenerateColumns = false; if (authorizationRulesDataGridView.Columns.Count == 0) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "IssuerName", DataPropertyName = "IssuerName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewComboBoxColumn { Name = "ClaimType", DataPropertyName = "ClaimType", DataSource = claimTypes, FlatStyle = FlatStyle.Flat }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ClaimValue", DataPropertyName = "ClaimValue" }); if (serviceBusHelper.IsCloudNamespace) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "KeyName", DataPropertyName = "KeyName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "PrimaryKey", DataPropertyName = "PrimaryKey" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "SecondaryKey", DataPropertyName = "SecondaryKey" }); } authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Manage", DataPropertyName = "Manage", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Send", DataPropertyName = "Send", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Listen", DataPropertyName = "Listen", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "Revision", DataPropertyName = "Revision", Width = 50, ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "CreatedTime", DataPropertyName = "CreatedTime", ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ModifiedTime", DataPropertyName = "ModifiedTime", ReadOnly = true }); } // Set Grid style dataPointDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. dataPointDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); dataPointDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. dataPointDataGridView.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. dataPointDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; dataPointDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. dataPointDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; dataPointDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. dataPointBindingSource.DataSource = dataPointBindingList; dataPointDataGridView.AutoGenerateColumns = false; dataPointDataGridView.AutoSize = true; dataPointDataGridView.DataSource = dataPointBindingSource; dataPointDataGridView.ForeColor = SystemColors.WindowText; if (queueDescription != null) { MetricInfo.GetMetricInfoListAsync(serviceBusHelper.Namespace, QueueEntity, queueDescription.Path).ContinueWith(t => metricsManualResetEvent.Set()); } if (dataPointDataGridView.Columns.Count == 0) { // Create the Metric column var metricColumn = new DataGridViewComboBoxColumn { DataSource = MetricInfo.EntityMetricDictionary.ContainsKey(QueueEntity) ? MetricInfo.EntityMetricDictionary[QueueEntity] : null, DataPropertyName = MetricProperty, DisplayMember = FriendlyNameProperty, ValueMember = NameProperty, Name = MetricProperty, Width = 144, DropDownWidth = 250, FlatStyle = FlatStyle.Flat, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; dataPointDataGridView.Columns.Add(metricColumn); // Create the Time Granularity column var timeGranularityColumn = new DataGridViewComboBoxColumn { DataSource = timeGranularityList, DataPropertyName = GranularityProperty, Name = GranularityProperty, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(timeGranularityColumn); // Create the Time Operator 1 column var operator1Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator1Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator1Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator1Column); // Create the Time Value 1 column var value1Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue1Name, HeaderText = TimeFilterValue, Name = TimeFilterValue1Name, Width = 136 }; dataPointDataGridView.Columns.Add(value1Column); // Create the Time Operator 1 column var operator2Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator2Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator2Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator2Column); // Create the Time Value 1 column var value2Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue2Name, HeaderText = TimeFilterValue, Name = TimeFilterValue2Name, Width = 136 }; dataPointDataGridView.Columns.Add(value2Column); // Create delete column var deleteButtonColumn = new DataGridViewButtonColumn { Name = DeleteName, CellTemplate = new DataGridViewDeleteButtonCell(), HeaderText = string.Empty, Width = 22 }; deleteButtonColumn.CellTemplate.ToolTipText = DeleteTooltip; deleteButtonColumn.UseColumnTextForButtonValue = true; dataPointDataGridView.Columns.Add(deleteButtonColumn); } if (queueDescription != null) { // Tab pages if (serviceBusHelper.IsCloudNamespace) { EnablePage(MetricsTabPage); } else { DisablePage(MetricsTabPage); } // Initialize textboxes txtPath.ReadOnly = true; txtPath.BackColor = SystemColors.Window; txtPath.GotFocus += textBox_GotFocus; txtMessageText.ReadOnly = true; txtMessageText.BackColor = SystemColors.Window; txtMessageText.GotFocus += textBox_GotFocus; txtDeadletterText.ReadOnly = true; txtDeadletterText.BackColor = SystemColors.Window; txtDeadletterText.GotFocus += textBox_GotFocus; txtSessionState.ReadOnly = true; txtSessionState.BackColor = SystemColors.Window; txtSessionState.GotFocus += textBox_GotFocus; trackBarMaxQueueSize.Enabled = false; // Initialize Controls with Data InitializeData(); // Set Grid style messagesDataGridView.EnableHeadersVisualStyles = false; messagesDataGridView.AutoGenerateColumns = false; messagesDataGridView.AutoSize = true; // Create the MessageId column var textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = MessageId, Name = MessageId, Width = 120 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the SequenceNumber column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = SequenceNumberValue, Name = SequenceNumberName, Width = 52 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the Size column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = MessageSize, Name = MessageSize, Width = 52 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the Label column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = Label, Name = Label, Width = 120 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the EnqueuedTimeUtc column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = EnqueuedTimeUtc, Name = EnqueuedTimeUtc, Width = 120 }; messagesDataGridView.Columns.Add(textBoxColumn); // Create the ExpiresAtUtc column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = ExpiresAtUtc, Name = ExpiresAtUtc, Width = 120 }; messagesDataGridView.Columns.Add(textBoxColumn); // Set the selection background color for all the cells. messagesDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); messagesDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. messagesDataGridView.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. messagesDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; messagesDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //messagesDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //messagesDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. messagesDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); messagesDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; messagesDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); messagesDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set Grid style sessionsDataGridView.EnableHeadersVisualStyles = false; sessionsDataGridView.AutoGenerateColumns = false; sessionsDataGridView.AutoSize = true; // Create the SessionId column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = SessionId, Name = SessionId, Width = 120 }; sessionsDataGridView.Columns.Add(textBoxColumn); // Create the Path column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = Path, Name = Path, Width = 120 }; sessionsDataGridView.Columns.Add(textBoxColumn); // Create the Mode column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = Mode, Name = Mode, Width = 120 }; sessionsDataGridView.Columns.Add(textBoxColumn); // Create the BatchFlushInterval column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = BatchFlushInterval, Name = BatchFlushInterval, Width = 120 }; sessionsDataGridView.Columns.Add(textBoxColumn); // Set the selection background color for all the cells. sessionsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); sessionsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. sessionsDataGridView.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. sessionsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; sessionsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //sessionsDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //sessionsDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. sessionsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); sessionsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; sessionsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); sessionsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set Grid style deadletterDataGridView.EnableHeadersVisualStyles = false; deadletterDataGridView.AutoGenerateColumns = false; deadletterDataGridView.AutoSize = true; // Create the MessageId column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = MessageId, Name = MessageId, Width = 120 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the SequenceNumber column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = SequenceNumberValue, Name = SequenceNumberName, Width = 52 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the Size column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = MessageSize, Name = MessageSize, Width = 52 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the Label column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = Label, Name = Label, Width = 120 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the EnqueuedTimeUtc column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = EnqueuedTimeUtc, Name = EnqueuedTimeUtc, Width = 120 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Create the ExpiresAtUtc column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = ExpiresAtUtc, Name = ExpiresAtUtc, Width = 120 }; deadletterDataGridView.Columns.Add(textBoxColumn); // Set the selection background color for all the cells. deadletterDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); deadletterDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. deadletterDataGridView.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. deadletterDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; deadletterDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //deadletterDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //deadletterDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. deadletterDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); deadletterDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; deadletterDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); deadletterDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; checkedListBox.ItemCheck += checkedListBox_ItemCheck; toolTip.SetToolTip(txtPath, PathTooltip); toolTip.SetToolTip(txtUserMetadata, UserMetadataTooltip); toolTip.SetToolTip(txtForwardTo, ForwardToTooltip); toolTip.SetToolTip(txtForwardDeadLetteredMessagesTo, ForwardDeadLetteredMessagesToTooltip); toolTip.SetToolTip(trackBarMaxQueueSize, MaxQueueSizeTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveDays, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveHours, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveMinutes, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveSeconds, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDefaultMessageTimeToLiveMilliseconds, DefaultMessageTimeToLiveTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowDays, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowHours, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowMinutes, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowSeconds, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtDuplicateDetectionHistoryTimeWindowMilliseconds, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtLockDurationDays, LockDurationTooltip); toolTip.SetToolTip(txtLockDurationHours, LockDurationTooltip); toolTip.SetToolTip(txtLockDurationMinutes, LockDurationTooltip); toolTip.SetToolTip(txtLockDurationSeconds, LockDurationTooltip); toolTip.SetToolTip(txtLockDurationMilliseconds, LockDurationTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleDays, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleHours, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleMinutes, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleSeconds, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtAutoDeleteOnIdleMilliseconds, AutoDeleteOnIdleTooltip); toolTip.SetToolTip(txtMaxDeliveryCount, MaxDeliveryCountTooltip); } else { // Tab pages DisablePage(MetricsTabPage); // Initialize buttons btnCreateDelete.Text = CreateText; btnCancelUpdate.Text = CancelText; btnRefresh.Visible = false; btnChangeStatus.Visible = false; btnMessages.Visible = false; btnSessions.Visible = false; btnDeadletter.Visible = false; btnMetrics.Visible = false; btnCloseTabs.Visible = false; // Create BindingList for Authorization Rules var bindingList = new BindingList<AuthorizationRuleWrapper>(new List<AuthorizationRuleWrapper>()) { AllowEdit = true, AllowNew = true, AllowRemove = true }; bindingList.ListChanged += bindingList_ListChanged; authorizationRulesBindingSource.DataSource = bindingList; authorizationRulesDataGridView.DataSource = authorizationRulesBindingSource; if (!string.IsNullOrWhiteSpace(path)) { txtPath.Text = path; } txtPath.Focus(); } }
private void InitializeControls() { try { // Set Monitor Refresh Interval txtMonitorRefreshTimeout.Text = MainForm.SingletonMainForm.MonitorRefreshInterval.ToString(CultureInfo.InvariantCulture); // Set splitter width metricMonitorRuleSplitContainer.SplitterWidth = 16; // Set Grid style monitorRuleDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. monitorRuleDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); monitorRuleDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. monitorRuleDataGridView.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. monitorRuleDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; monitorRuleDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. monitorRuleDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); monitorRuleDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; monitorRuleDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); monitorRuleDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. monitorRuleBindingSource.DataSource = monitorRuleBindingList; monitorRuleDataGridView.AutoGenerateColumns = false; monitorRuleDataGridView.AutoSize = true; monitorRuleDataGridView.DataSource = monitorRuleBindingSource; monitorRuleDataGridView.ForeColor = SystemColors.WindowText; if (!existingEntity) { // Create the Entity column var entityColumn = new DataGridViewTextBoxColumn { Name = EntityProperty, DataPropertyName = EntityProperty, ReadOnly = true, Width = 100 }; monitorRuleDataGridView.Columns.Add(entityColumn); // Create the type column var typeColumn = new DataGridViewTextBoxColumn { Name = TypeProperty, DataPropertyName = TypeProperty, Width = 72, ReadOnly = true }; monitorRuleDataGridView.Columns.Add(typeColumn); } // Create the Monitor column var metricMonitorValueColumn = new DataGridViewComboBoxColumn { DataSource = MonitorInfo.MonitorInfos, DataPropertyName = MonitorProperty, DisplayMember = FriendlyNameProperty, ValueMember = NameProperty, Name = MonitorProperty, Width = 132, FlatStyle = FlatStyle.Flat, DropDownWidth = 148, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; monitorRuleDataGridView.Columns.Add(metricMonitorValueColumn); // Create the Warning Threshold column var warningThresholdValueColumn = new DataGridViewTextBoxColumn { Name = WarningProperty, DataPropertyName = WarningProperty, Width = 50 }; monitorRuleDataGridView.Columns.Add(warningThresholdValueColumn); // Create the type column var criticalThresholdValueColumn = new DataGridViewTextBoxColumn { Name = CriticalProperty, DataPropertyName = CriticalProperty, Width = 50 }; monitorRuleDataGridView.Columns.Add(criticalThresholdValueColumn); // Create the Current column var currentValueColumn = new DataGridViewTextBoxColumn { Name = CurrentProperty, DataPropertyName = CurrentProperty, ReadOnly = true, Width = 50 }; monitorRuleDataGridView.Columns.Add(currentValueColumn); // Create the State column var stateColumn = new DataGridViewImageColumn { Name = StateProperty, DataPropertyName = StateProperty, ImageLayout = DataGridViewImageCellLayout.Stretch, Width = 36, ReadOnly = true, DefaultCellStyle = { NullValue = null } }; monitorRuleDataGridView.Columns.Add(stateColumn); // Initialize combobox foreach (var item in Enum.GetValues(typeof(SeriesChartType))) { cboChartType.Items.Add(item); cboChartType.SelectedItem = SeriesChartType.FastLine; } // Set Grid style dataPointDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. dataPointDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); dataPointDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. dataPointDataGridView.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. dataPointDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; dataPointDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. dataPointDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; dataPointDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. dataPointBindingSource.DataSource = dataPointBindingList; dataPointDataGridView.AutoGenerateColumns = false; dataPointDataGridView.AutoSize = true; dataPointDataGridView.DataSource = dataPointBindingSource; dataPointDataGridView.ForeColor = SystemColors.WindowText; if (!existingEntity) { // Create the Entity column var entityColumn = new DataGridViewTextBoxColumn { Name = EntityProperty, DataPropertyName = EntityProperty, ReadOnly = true, Width = 100 }; dataPointDataGridView.Columns.Add(entityColumn); // Create the type column var typeColumn = new DataGridViewTextBoxColumn { Name = TypeProperty, DataPropertyName = TypeProperty, Width = 72, ReadOnly = true }; dataPointDataGridView.Columns.Add(typeColumn); } // Create the Metric column var metricColumn = new DataGridViewComboBoxColumn { DataSource = MetricInfo.MetricInfos, DataPropertyName = MetricProperty, DisplayMember = FriendlyNameProperty, ValueMember = NameProperty, Name = MetricProperty, Width = 132, FlatStyle = FlatStyle.Flat, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; dataPointDataGridView.Columns.Add(metricColumn); // Create the Time Granularity column var timeGranularityColumn = new DataGridViewComboBoxColumn { DataSource = timeGranularityList, DataPropertyName = GranularityProperty, Name = GranularityProperty, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(timeGranularityColumn); // Create the Time Operator 1 column var operator1Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator1Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator1Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator1Column); // Create the Time Value 1 column var value1Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue1Name, HeaderText = TimeFilterValue, Name = TimeFilterValue1Name, Width = 132 }; dataPointDataGridView.Columns.Add(value1Column); // Create the Time Operator 1 column var operator2Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator2Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator2Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator2Column); // Create the Time Value 1 column var value2Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue2Name, HeaderText = TimeFilterValue, Name = TimeFilterValue2Name, Width = 144 }; dataPointDataGridView.Columns.Add(value2Column); // Create graph column var graphColumn = new DataGridViewCheckBoxColumn { DataPropertyName = GraphName, HeaderText = GraphName, Name = GraphName, Width = 50 }; dataPointDataGridView.Columns.Add(graphColumn); } catch (Exception ex) { HandleException(ex); } }
private void InitializeControls() { // Set Grid style dataPointDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. dataPointDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); dataPointDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. dataPointDataGridView.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. dataPointDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; dataPointDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. dataPointDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; dataPointDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. dataPointBindingSource.DataSource = dataPointBindingList; dataPointDataGridView.AutoGenerateColumns = false; dataPointDataGridView.AutoSize = true; dataPointDataGridView.DataSource = dataPointBindingSource; dataPointDataGridView.ForeColor = SystemColors.WindowText; if (consumerGroupDescription != null) { MetricInfo.GetMetricInfoListAsync(serviceBusHelper.Namespace, ConsumerGroupEntity, string.Format(ConsumerGroupPathFormat, consumerGroupDescription.EventHubPath, consumerGroupDescription.Name)).ContinueWith(t => metricsManualResetEvent.Set()); } if (dataPointDataGridView.Columns.Count == 0) { // Create the Metric column var metricColumn = new DataGridViewComboBoxColumn { DataSource = MetricInfo.EntityMetricDictionary.ContainsKey(ConsumerGroupEntity) ? MetricInfo.EntityMetricDictionary[ConsumerGroupEntity] : null, DataPropertyName = MetricProperty, DisplayMember = DisplayNameProperty, ValueMember = NameProperty, Name = MetricProperty, Width = 144, DropDownWidth = 250, FlatStyle = FlatStyle.Flat, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; dataPointDataGridView.Columns.Add(metricColumn); // Create the Time Granularity column var timeGranularityColumn = new DataGridViewComboBoxColumn { DataSource = timeGranularityList, DataPropertyName = GranularityProperty, Name = GranularityProperty, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(timeGranularityColumn); // Create the Time Operator 1 column var operator1Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator1Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator1Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator1Column); // Create the Time Value 1 column var value1Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue1Name, HeaderText = TimeFilterValue, Name = TimeFilterValue1Name, Width = 136 }; dataPointDataGridView.Columns.Add(value1Column); // Create the Time Operator 1 column var operator2Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator2Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator2Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator2Column); // Create the Time Value 1 column var value2Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue2Name, HeaderText = TimeFilterValue, Name = TimeFilterValue2Name, Width = 136 }; dataPointDataGridView.Columns.Add(value2Column); // Create delete column var deleteButtonColumn = new DataGridViewButtonColumn { Name = DeleteName, CellTemplate = new DataGridViewDeleteButtonCell(), HeaderText = string.Empty, Width = 22 }; deleteButtonColumn.CellTemplate.ToolTipText = DeleteTooltip; deleteButtonColumn.UseColumnTextForButtonValue = true; dataPointDataGridView.Columns.Add(deleteButtonColumn); } if (consumerGroupDescription != null) { // Tab pages if (serviceBusHelper.IsCloudNamespace) { EnablePage(MetricsTabPage); } else { DisablePage(MetricsTabPage); } // Initialize buttons btnCreateDelete.Text = DeleteText; btnCancelUpdate.Text = UpdateText; btnRefresh.Visible = true; btnMetrics.Visible = true; btnCloseTabs.Visible = true; // Initialize textboxes txtName.ReadOnly = true; txtName.BackColor = SystemColors.Window; txtName.GotFocus += textBox_GotFocus; // Initialize Data InitializeData(); toolTip.SetToolTip(txtName, NameTooltip); toolTip.SetToolTip(txtUserMetadata, UserMetadataTooltip); propertyListView.ContextMenuStrip = entityInformationContextMenuStrip; } else { // Tab pages DisablePage(MetricsTabPage); // Initialize buttons btnCreateDelete.Text = CreateText; btnCancelUpdate.Text = CancelText; btnRefresh.Visible = false; btnMetrics.Visible = false; btnCloseTabs.Visible = false; } }
private void InitializeControls() { try { if (string.IsNullOrWhiteSpace(entity)) { return; } // Initialize labels and textboxes Text = string.Format(CaptionFormat, entity); lblFilterExpression.Text = string.Format(FilterExpressionLabelFormat, entity); if (!string.IsNullOrWhiteSpace(FilterExpression)) { txtFilterExpression.TextChanged -= txtFilterExpression_TextChanged; txtFilterExpression.Text = FilterExpression; txtFilterExpression.TextChanged += txtFilterExpression_TextChanged; } // Initialize filters; ReadFilterExpression(); bindingSource.DataSource = timeFilters; TimeFilterInfo.OnChange += WriteFilterExpression; // Initialize the DataGridView. timeFilterDataGridView.AutoGenerateColumns = false; timeFilterDataGridView.AutoSize = true; timeFilterDataGridView.DataSource = bindingSource; timeFilterDataGridView.ForeColor = SystemColors.WindowText; // Create the Property column var propertyColumn = new DataGridViewComboBoxColumn { DataSource = properties, DataPropertyName = TimeFilterProperty, Name = TimeFilterProperty, Width = 104, FlatStyle = FlatStyle.Flat }; timeFilterDataGridView.Columns.Add(propertyColumn); // Create the Operator column var operatorColumn = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator, Name = TimeFilterOperator, Width = 72, FlatStyle = FlatStyle.Flat }; timeFilterDataGridView.Columns.Add(operatorColumn); // Create the Value column var valueColumn = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue, Name = TimeFilterValue, Width = 136 }; timeFilterDataGridView.Columns.Add(valueColumn); // Set Grid style timeFilterDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. timeFilterDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); timeFilterDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. timeFilterDataGridView.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. timeFilterDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; timeFilterDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. timeFilterDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); timeFilterDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; timeFilterDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); timeFilterDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; if (String.Compare(entity, Subscription, StringComparison.OrdinalIgnoreCase) != 0) { return; } lblStartsWith.Visible = false; txtStartsWith.Visible = false; lblTimeFilters.Location = lblMessageCount.Location; timeFilterDataGridView.Location = cboMessageCountOperator.Location; timeFilterDataGridView.Size = new Size(timeFilterDataGridView.Size.Width, 216); lblMessageCount.Location = lblStartsWith.Location; cboMessageCountOperator.Location = txtStartsWith.Location; txtMessageCount.Location = new Point(txtMessageCount.Location.X, txtStartsWith.Location.Y); } catch (Exception ex) { MainForm.SingletonMainForm.HandleException(ex); } }
private void InitializeControls() { // Set Grid style partitionsDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. partitionsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); partitionsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. partitionsDataGridView.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. partitionsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; partitionsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. partitionsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); partitionsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; partitionsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); partitionsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. partitionsDataGridView.AutoGenerateColumns = true; partitionsDataGridView.AutoSize = true; partitionsDataGridView.ForeColor = SystemColors.WindowText; // Set Grid style dataPointDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. dataPointDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); dataPointDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. dataPointDataGridView.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. dataPointDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; dataPointDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. dataPointDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; dataPointDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. dataPointBindingSource.DataSource = dataPointBindingList; dataPointDataGridView.AutoGenerateColumns = false; dataPointDataGridView.AutoSize = true; dataPointDataGridView.DataSource = dataPointBindingSource; dataPointDataGridView.ForeColor = SystemColors.WindowText; if (consumerGroupDescription != null) { MetricInfo.GetMetricInfoListAsync(serviceBusHelper.Namespace, ConsumerGroupEntity, string.Format(ConsumerGroupPathFormat, consumerGroupDescription.EventHubPath, consumerGroupDescription.Name)).ContinueWith(t => metricsManualResetEvent.Set()); } if (dataPointDataGridView.Columns.Count == 0) { // Create the Metric column var metricColumn = new DataGridViewComboBoxColumn { DataSource = MetricInfo.EntityMetricDictionary.ContainsKey(ConsumerGroupEntity) ? MetricInfo.EntityMetricDictionary[ConsumerGroupEntity] : null, DataPropertyName = MetricProperty, DisplayMember = DisplayNameProperty, ValueMember = NameProperty, Name = MetricProperty, Width = 144, DropDownWidth = 250, FlatStyle = FlatStyle.Flat, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; dataPointDataGridView.Columns.Add(metricColumn); // Create the Time Granularity column var timeGranularityColumn = new DataGridViewComboBoxColumn { DataSource = timeGranularityList, DataPropertyName = GranularityProperty, Name = GranularityProperty, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(timeGranularityColumn); // Create the Time Operator 1 column var operator1Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator1Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator1Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator1Column); // Create the Time Value 1 column var value1Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue1Name, HeaderText = TimeFilterValue, Name = TimeFilterValue1Name, Width = 136 }; dataPointDataGridView.Columns.Add(value1Column); // Create the Time Operator 1 column var operator2Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator2Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator2Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator2Column); // Create the Time Value 1 column var value2Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue2Name, HeaderText = TimeFilterValue, Name = TimeFilterValue2Name, Width = 136 }; dataPointDataGridView.Columns.Add(value2Column); // Create delete column var deleteButtonColumn = new DataGridViewButtonColumn { Name = DeleteName, CellTemplate = new DataGridViewDeleteButtonCell(), HeaderText = string.Empty, Width = 22 }; deleteButtonColumn.CellTemplate.ToolTipText = DeleteTooltip; deleteButtonColumn.UseColumnTextForButtonValue = true; dataPointDataGridView.Columns.Add(deleteButtonColumn); } DisablePage(PartitionsTabPage); if (consumerGroupDescription != null) { // Tab pages if (serviceBusHelper.IsCloudNamespace) { EnablePage(MetricsTabPage); } else { DisablePage(MetricsTabPage); } // Initialize buttons btnCreateDelete.Text = DeleteText; btnCancelUpdate.Text = UpdateText; btnRefresh.Visible = true; btnMetrics.Visible = true; btnCloseTabs.Visible = true; btnGetPartitions.Visible = true; // Initialize textboxes txtName.ReadOnly = true; txtName.BackColor = SystemColors.Window; txtName.GotFocus += textBox_GotFocus; // Initialize Data InitializeData(); toolTip.SetToolTip(txtName, NameTooltip); toolTip.SetToolTip(txtUserMetadata, UserMetadataTooltip); propertyListView.ContextMenuStrip = entityInformationContextMenuStrip; } else { // Tab pages DisablePage(MetricsTabPage); // Initialize buttons btnCreateDelete.Text = CreateText; btnCancelUpdate.Text = CancelText; btnRefresh.Visible = false; btnMetrics.Visible = false; btnCloseTabs.Visible = false; btnGetPartitions.Visible = false; } }
private void InitializeControls() { // Set Grid style authorizationRulesDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. authorizationRulesDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); authorizationRulesDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. authorizationRulesDataGridView.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. authorizationRulesDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; authorizationRulesDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. authorizationRulesDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.AutoGenerateColumns = false; if (authorizationRulesDataGridView.Columns.Count == 0) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "IssuerName", DataPropertyName = "IssuerName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewComboBoxColumn { Name = "ClaimType", DataPropertyName = "ClaimType", DataSource = claimTypes, FlatStyle = FlatStyle.Flat }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ClaimValue", DataPropertyName = "ClaimValue" }); if (serviceBusHelper.IsCloudNamespace) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "KeyName", DataPropertyName = "KeyName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "PrimaryKey", DataPropertyName = "PrimaryKey" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "SecondaryKey", DataPropertyName = "SecondaryKey" }); } authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Manage", DataPropertyName = "Manage", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Send", DataPropertyName = "Send", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Listen", DataPropertyName = "Listen", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "Revision", DataPropertyName = "Revision", Width = 50, ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "CreatedTime", DataPropertyName = "CreatedTime", ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ModifiedTime", DataPropertyName = "ModifiedTime", ReadOnly = true }); } // Set Grid style dataPointDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. dataPointDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); dataPointDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. dataPointDataGridView.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. dataPointDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; dataPointDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. dataPointDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; dataPointDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. dataPointBindingSource.DataSource = dataPointBindingList; dataPointDataGridView.AutoGenerateColumns = false; dataPointDataGridView.AutoSize = true; dataPointDataGridView.DataSource = dataPointBindingSource; dataPointDataGridView.ForeColor = SystemColors.WindowText; if (eventHubDescription != null) { MetricInfo.GetMetricInfoListAsync(serviceBusHelper.Namespace, EventHubEntity, eventHubDescription.Path).ContinueWith(t => metricsManualResetEvent.Set()); } if (dataPointDataGridView.Columns.Count == 0) { // Create the Metric column var metricColumn = new DataGridViewComboBoxColumn { DataSource = MetricInfo.EntityMetricDictionary.ContainsKey(EventHubEntity) ? MetricInfo.EntityMetricDictionary[EventHubEntity] : null, DataPropertyName = MetricProperty, DisplayMember = DisplayNameProperty, ValueMember = NameProperty, Name = MetricProperty, Width = 144, DropDownWidth = 250, FlatStyle = FlatStyle.Flat, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; dataPointDataGridView.Columns.Add(metricColumn); // Create the Time Granularity column var timeGranularityColumn = new DataGridViewComboBoxColumn { DataSource = timeGranularityList, DataPropertyName = GranularityProperty, Name = GranularityProperty, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(timeGranularityColumn); // Create the Time Operator 1 column var operator1Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator1Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator1Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator1Column); // Create the Time Value 1 column var value1Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue1Name, HeaderText = TimeFilterValue, Name = TimeFilterValue1Name, Width = 136 }; dataPointDataGridView.Columns.Add(value1Column); // Create the Time Operator 1 column var operator2Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator2Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator2Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator2Column); // Create the Time Value 1 column var value2Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue2Name, HeaderText = TimeFilterValue, Name = TimeFilterValue2Name, Width = 136 }; dataPointDataGridView.Columns.Add(value2Column); // Create delete column var deleteButtonColumn = new DataGridViewButtonColumn { Name = DeleteName, CellTemplate = new DataGridViewDeleteButtonCell(), HeaderText = string.Empty, Width = 22 }; deleteButtonColumn.CellTemplate.ToolTipText = DeleteTooltip; deleteButtonColumn.UseColumnTextForButtonValue = true; dataPointDataGridView.Columns.Add(deleteButtonColumn); } if (eventHubDescription != null) { // Tab pages if (serviceBusHelper.IsCloudNamespace) { EnablePage(MetricsTabPage); } else { DisablePage(MetricsTabPage); } // Initialize buttons btnCreateDelete.Text = DeleteText; btnCancelUpdate.Text = UpdateText; btnChangeStatus.Text = eventHubDescription.Status == EntityStatus.Active ? DisableText : EnableText; btnRefresh.Visible = true; btnMetrics.Visible = true; btnCloseTabs.Visible = true; btnChangeStatus.Visible = true; // Initialize textboxes txtPath.ReadOnly = true; txtPath.BackColor = SystemColors.Window; txtPath.GotFocus += textBox_GotFocus; // TrackBar trackBarPartitionCount.Enabled = false; // Initialize Data InitializeData(); toolTip.SetToolTip(txtPath, PathTooltip); toolTip.SetToolTip(txtUserMetadata, UserMetadataTooltip); toolTip.SetToolTip(txtMessageRetentionInDays, MessageRetentionInDaysTooltip); toolTip.SetToolTip(trackBarPartitionCount, PartitionCountTooltip); propertyListView.ContextMenuStrip = entityInformationContextMenuStrip; } else { // Tab pages DisablePage(MetricsTabPage); // Set Defaults var eventHub = new EventHubDescription("DUMMY"); txtMessageRetentionInDays.Text = eventHub.MessageRetentionInDays.ToString(CultureInfo.InvariantCulture); trackBarPartitionCount.Value = eventHub.PartitionCount; // Initialize buttons btnCreateDelete.Text = CreateText; btnCancelUpdate.Text = CancelText; btnRefresh.Visible = false; btnChangeStatus.Visible = false; btnMetrics.Visible = false; btnCloseTabs.Visible = false; // Create BindingList for Authorization Rules var bindingList = new BindingList<AuthorizationRuleWrapper>(new List<AuthorizationRuleWrapper>()) { AllowEdit = true, AllowNew = true, AllowRemove = true }; bindingList.ListChanged += bindingList_ListChanged; authorizationRulesBindingSource.DataSource = bindingList; authorizationRulesDataGridView.DataSource = authorizationRulesBindingSource; txtPath.Focus(); } }
private void InitializeControls() { try { if (string.IsNullOrEmpty(entity)) { return; } // Initialize labels and textboxes Text = string.Format(CaptionFormat, entity); lblFilterExpression.Text = string.Format(FilterExpressionLabelFormat, entity); if (!string.IsNullOrEmpty(FilterExpression)) { txtFilterExpression.TextChanged -= txtFilterExpression_TextChanged; txtFilterExpression.Text = FilterExpression; txtFilterExpression.TextChanged += txtFilterExpression_TextChanged; } // Initialize filters; ReadFilterExpression(); bindingSource.DataSource = timeFilters; TimeFilterInfo.OnChange += WriteFilterExpression; // Initialize the DataGridView. timeFilterDataGridView.AutoGenerateColumns = false; timeFilterDataGridView.AutoSize = true; timeFilterDataGridView.DataSource = bindingSource; timeFilterDataGridView.ForeColor = SystemColors.WindowText; // Create the Property column var propertyColumn = new DataGridViewComboBoxColumn { DataSource = properties, DataPropertyName = TimeFilterProperty, Name = TimeFilterProperty, Width = 104, FlatStyle = FlatStyle.Flat }; timeFilterDataGridView.Columns.Add(propertyColumn); // Create the Operator column var operatorColumn = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator, Name = TimeFilterOperator, Width = 72, FlatStyle = FlatStyle.Flat }; timeFilterDataGridView.Columns.Add(operatorColumn); // Create the Value column var valueColumn = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue, Name = TimeFilterValue, Width = 104 }; timeFilterDataGridView.Columns.Add(valueColumn); // Set Grid style timeFilterDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. timeFilterDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); timeFilterDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. timeFilterDataGridView.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. timeFilterDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; timeFilterDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. timeFilterDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); timeFilterDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; timeFilterDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); timeFilterDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; if (String.Compare(entity, Subscription, StringComparison.OrdinalIgnoreCase) != 0) { return; } lblStartsWith.Visible = false; txtStartsWith.Visible = false; lblTimeFilters.Location = lblMessageCount.Location; timeFilterDataGridView.Location = cboMessageCountOperator.Location; timeFilterDataGridView.Size = new Size(timeFilterDataGridView.Size.Width, 216); lblMessageCount.Location = lblStartsWith.Location; cboMessageCountOperator.Location = txtStartsWith.Location; txtMessageCount.Location = new Point(txtMessageCount.Location.X, txtStartsWith.Location.Y); } catch (Exception ex) { MainForm.SingletonMainForm.HandleException(ex); } }
private void InitializeControls() { // Hide the test button btnSend.Enabled = mainTabControl.SelectedTab.Name != DescriptionPage; // Hide tab pages DisablePage(RegistrationsPage); // Hide caret txtGcmEndpoint.GotFocus += textBox_GotFocus; txtApnsEndpoint.GotFocus += textBox_GotFocus; txtMpnsCredentialCertificateThumbprint.GotFocus += textBox_GotFocus; txtApnsCredentialCertificateThumbprint.GotFocus += textBox_GotFocus; // Initialize bindingSource //registrationsBindingSource.DataSource = RegistrationInfo.Registrations; // Set Grid style authorizationRulesDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. authorizationRulesDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); authorizationRulesDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. authorizationRulesDataGridView.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. authorizationRulesDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; authorizationRulesDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. authorizationRulesDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.AutoGenerateColumns = false; if (authorizationRulesDataGridView.Columns.Count == 0) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "IssuerName", DataPropertyName = "IssuerName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewComboBoxColumn { Name = "ClaimType", DataPropertyName = "ClaimType", DataSource = claimTypes, FlatStyle = FlatStyle.Flat }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ClaimValue", DataPropertyName = "ClaimValue" }); if (serviceBusHelper.IsCloudNamespace) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "KeyName", DataPropertyName = "KeyName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "PrimaryKey", DataPropertyName = "PrimaryKey" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "SecondaryKey", DataPropertyName = "SecondaryKey" }); } authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Manage", DataPropertyName = "Manage", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Send", DataPropertyName = "Send", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Listen", DataPropertyName = "Listen", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "Revision", DataPropertyName = "Revision", Width = 50, ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "CreatedTime", DataPropertyName = "CreatedTime", ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ModifiedTime", DataPropertyName = "ModifiedTime", ReadOnly = true }); } // Set Grid style dataPointDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. dataPointDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); dataPointDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. dataPointDataGridView.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. dataPointDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; dataPointDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. dataPointDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; dataPointDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. dataPointBindingSource.DataSource = dataPointBindingList; dataPointDataGridView.AutoGenerateColumns = false; dataPointDataGridView.AutoSize = true; dataPointDataGridView.DataSource = dataPointBindingSource; dataPointDataGridView.ForeColor = SystemColors.WindowText; if (notificationHubDescription != null) { MetricInfo.GetMetricInfoListAsync(serviceBusHelper.Namespace, NotificationHubEntity, notificationHubDescription.Path).ContinueWith(t => metricsManualResetEvent.Set()); } if (dataPointDataGridView.Columns.Count == 0) { // Create the Metric column var metricColumn = new DataGridViewComboBoxColumn { DataSource = MetricInfo.EntityMetricDictionary.ContainsKey(NotificationHubEntity) ? MetricInfo.EntityMetricDictionary[NotificationHubEntity] : null, DataPropertyName = MetricProperty, DisplayMember = DisplayNameProperty, ValueMember = NameProperty, Name = MetricProperty, Width = 144, DropDownWidth = 250, FlatStyle = FlatStyle.Flat, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; dataPointDataGridView.Columns.Add(metricColumn); // Create the Time Granularity column var timeGranularityColumn = new DataGridViewComboBoxColumn { DataSource = timeGranularityList, DataPropertyName = GranularityProperty, Name = GranularityProperty, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(timeGranularityColumn); // Create the Time Operator 1 column var operator1Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator1Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator1Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator1Column); // Create the Time Value 1 column var value1Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue1Name, HeaderText = TimeFilterValue, Name = TimeFilterValue1Name, Width = 136 }; dataPointDataGridView.Columns.Add(value1Column); // Create the Time Operator 1 column var operator2Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator2Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator2Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator2Column); // Create the Time Value 1 column var value2Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue2Name, HeaderText = TimeFilterValue, Name = TimeFilterValue2Name, Width = 136 }; dataPointDataGridView.Columns.Add(value2Column); // Create delete column var deleteButtonColumn = new DataGridViewButtonColumn { Name = DeleteName, CellTemplate = new DataGridViewDeleteButtonCell(), HeaderText = string.Empty, Width = 22 }; deleteButtonColumn.CellTemplate.ToolTipText = DeleteTooltip; deleteButtonColumn.UseColumnTextForButtonValue = true; dataPointDataGridView.Columns.Add(deleteButtonColumn); } if (notificationHubDescription != null) { // Tab pages if (serviceBusHelper.IsCloudNamespace) { EnablePage(MetricsTabPage); } else { DisablePage(MetricsTabPage); } // Initialize buttons btnCreateDelete.Text = DeleteText; btnCancelUpdate.Text = UpdateText; btnRefresh.Enabled = true; btnRegistrations.Visible = true; btnMetrics.Visible = true; btnCloseTabs.Visible = true; // Initialize textboxes txtPath.ReadOnly = true; txtPath.BackColor = SystemColors.Window; txtPath.GotFocus += textBox_GotFocus; toolTip.SetToolTip(txtPath, PathTooltip); toolTip.SetToolTip(txtRegistrationTimeToLiveWindowDays, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtRegistrationTimeToLiveWindowHours, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtRegistrationTimeToLiveWindowMinutes, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtRegistrationTimeToLiveWindowSeconds, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtRegistrationTimeToLiveWindowMilliseconds, DuplicateDetectionHistoryTimeWindowTooltip); toolTip.SetToolTip(txtPackageSid, PackageSidTooltip); toolTip.SetToolTip(txtClientSecret, ClientSecretTooltip); toolTip.SetToolTip(txtMpnsCredentialCertificateThumbprint, MpnsCertificateThumbprintTooltip); toolTip.SetToolTip(txtApnsCredentialCertificateThumbprint, ApnsCertificateThumbprintTooltip); toolTip.SetToolTip(txtGcmApiKey, GcmApiKeyTooltip); toolTip.SetToolTip(txtUserMetadata, UserMetadataTooltip); // Hide Caret txtMpnsPayload.GotFocus += textBox_GotFocus; txtWnsPayload.GotFocus += textBox_GotFocus; // Initialize the DataGridView. registrationsDataGridView.AutoGenerateColumns = false; registrationsDataGridView.AutoSize = true; //registrationsDataGridView.DataSource = registrationsBindingSource; registrationsDataGridView.ForeColor = SystemColors.WindowText; // Create the ETag column var textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = ETagHeader, Name = ETagHeader, Width = 35 }; registrationsDataGridView.Columns.Add(textBoxColumn); // Create the RegistrationId column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = RegistrationIdHeader, Name = RegistrationIdHeader, Width = 100 }; registrationsDataGridView.Columns.Add(textBoxColumn); // Create the ChannelUri column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = ChannelUriValue, Name = ChannelUriHeader, Width = 200 }; registrationsDataGridView.Columns.Add(textBoxColumn); // Create the ExpirationTimeHeader column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = ExpirationTimeHeader, Name = ExpirationTimeHeader, Width = 110 }; registrationsDataGridView.Columns.Add(textBoxColumn); // Create the ChannelUri column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = PlatformTypeValue, Name = PlatformTypeHeader, Width = 100 }; registrationsDataGridView.Columns.Add(textBoxColumn); // Create the TagsHeader column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = TagsHeader, Name = TagsHeader, Width = 150 }; registrationsDataGridView.Columns.Add(textBoxColumn); // Set Grid style registrationsDataGridView.EnableHeadersVisualStyles = false; //registrationsDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. registrationsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); registrationsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. registrationsDataGridView.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. registrationsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; registrationsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. registrationsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); registrationsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; registrationsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); registrationsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource templatePropertiesBindingSource.DataSource = NotificationInfo.TemplateProperties; // Initialize the DataGridView. templateNotificationDataGridView.AutoGenerateColumns = false; templateNotificationDataGridView.AutoSize = true; templateNotificationDataGridView.DataSource = templatePropertiesBindingSource; templateNotificationDataGridView.ForeColor = SystemColors.WindowText; // Create the Name column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderName, Name = HeaderName, Width = 80 }; templateNotificationDataGridView.Columns.Add(textBoxColumn); // Create the Value column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderValue, Name = HeaderValue, Width = 150 }; templateNotificationDataGridView.Columns.Add(textBoxColumn); // Set Grid style templateNotificationDataGridView.EnableHeadersVisualStyles = false; //templateNotificationDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. templateNotificationDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); templateNotificationDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. templateNotificationDataGridView.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. templateNotificationDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; templateNotificationDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. templateNotificationDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); templateNotificationDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; templateNotificationDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); templateNotificationDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource templateHeadersBindingSource.DataSource = NotificationInfo.TemplateHeaders; // Initialize the DataGridView. templateHeadersDataGridView.AutoGenerateColumns = false; templateHeadersDataGridView.AutoSize = true; templateHeadersDataGridView.DataSource = templateHeadersBindingSource; templateHeadersDataGridView.ForeColor = SystemColors.WindowText; // Create the Name column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderName, Name = HeaderName, Width = 80 }; templateHeadersDataGridView.Columns.Add(textBoxColumn); // Create the Value column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderValue, Name = HeaderValue, Width = 150 }; templateHeadersDataGridView.Columns.Add(textBoxColumn); // Set Grid style templateHeadersDataGridView.EnableHeadersVisualStyles = false; //templateHeadersDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. templateHeadersDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); templateHeadersDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. templateHeadersDataGridView.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. templateHeadersDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; templateHeadersDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. templateHeadersDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); templateHeadersDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; templateHeadersDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); templateHeadersDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource templateTagsBindingSource.DataSource = NotificationInfo.TemplateTags; // Initialize the DataGridView. templateTagsDataGridView.AutoGenerateColumns = false; templateTagsDataGridView.AutoSize = true; templateTagsDataGridView.DataSource = templateTagsBindingSource; templateTagsDataGridView.ForeColor = SystemColors.WindowText; // Create the TagName column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = TagName, Name = TagName, Width = 228 }; templateTagsDataGridView.Columns.Add(textBoxColumn); // Set Grid style templateTagsDataGridView.EnableHeadersVisualStyles = false; //templateTagsDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. templateTagsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); templateTagsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowTagsDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. templateTagsDataGridView.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. templateTagsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; templateTagsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. templateTagsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); templateTagsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; templateTagsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); templateTagsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource wnsHeadersBindingSource.DataSource = NotificationInfo.WnsHeaders; // Initialize the DataGridView. wnsHeadersDataGridView.AutoGenerateColumns = false; wnsHeadersDataGridView.AutoSize = true; wnsHeadersDataGridView.DataSource = wnsHeadersBindingSource; wnsHeadersDataGridView.ForeColor = SystemColors.WindowText; // Create the Name column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderName, Name = HeaderName, Width = 80 }; wnsHeadersDataGridView.Columns.Add(textBoxColumn); // Create the Value column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderValue, Name = HeaderValue, Width = 150 }; wnsHeadersDataGridView.Columns.Add(textBoxColumn); // Set Grid style wnsHeadersDataGridView.EnableHeadersVisualStyles = false; //wnsHeadersDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. wnsHeadersDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); wnsHeadersDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. wnsHeadersDataGridView.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. wnsHeadersDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; wnsHeadersDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. wnsHeadersDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); wnsHeadersDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; wnsHeadersDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); wnsHeadersDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource wnsTagsBindingSource.DataSource = NotificationInfo.WnsTags; // Initialize the DataGridView. wnsTagsDataGridView.AutoGenerateColumns = false; wnsTagsDataGridView.AutoSize = true; wnsTagsDataGridView.DataSource = wnsTagsBindingSource; wnsTagsDataGridView.ForeColor = SystemColors.WindowText; // Create the TagName column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = TagName, Name = TagName, Width = 228 }; wnsTagsDataGridView.Columns.Add(textBoxColumn); // Set Grid style wnsTagsDataGridView.EnableHeadersVisualStyles = false; //wnsTagsDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. wnsTagsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); wnsTagsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowTagsDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. wnsTagsDataGridView.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. wnsTagsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; wnsTagsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. wnsTagsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); wnsTagsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; wnsTagsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); wnsTagsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource mpnsHeadersBindingSource.DataSource = NotificationInfo.MpnsHeaders; // Initialize the DataGridView. mpnsHeadersDataGridView.AutoGenerateColumns = false; mpnsHeadersDataGridView.AutoSize = true; mpnsHeadersDataGridView.DataSource = mpnsHeadersBindingSource; mpnsHeadersDataGridView.ForeColor = SystemColors.WindowText; // Create the Name column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderName, Name = HeaderName, Width = 80 }; mpnsHeadersDataGridView.Columns.Add(textBoxColumn); // Create the Value column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderValue, Name = HeaderValue, Width = 150 }; mpnsHeadersDataGridView.Columns.Add(textBoxColumn); // Set Grid style mpnsHeadersDataGridView.EnableHeadersVisualStyles = false; //mpnsHeadersDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. mpnsHeadersDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); mpnsHeadersDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. mpnsHeadersDataGridView.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. mpnsHeadersDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; mpnsHeadersDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. mpnsHeadersDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); mpnsHeadersDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; mpnsHeadersDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); mpnsHeadersDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource mpnsTagsBindingSource.DataSource = NotificationInfo.MpnsTags; // Initialize the DataGridView. mpnsTagsDataGridView.AutoGenerateColumns = false; mpnsTagsDataGridView.AutoSize = true; mpnsTagsDataGridView.DataSource = mpnsTagsBindingSource; mpnsTagsDataGridView.ForeColor = SystemColors.WindowText; // Create the TagName column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = TagName, Name = TagName, Width = 228 }; mpnsTagsDataGridView.Columns.Add(textBoxColumn); // Set Grid style mpnsTagsDataGridView.EnableHeadersVisualStyles = false; //mpnsTagsDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. mpnsTagsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); mpnsTagsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowTagsDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. mpnsTagsDataGridView.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. mpnsTagsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; mpnsTagsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. mpnsTagsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); mpnsTagsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; mpnsTagsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); mpnsTagsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource appleHeadersBindingSource.DataSource = NotificationInfo.ApnsHeaders; // Initialize the DataGridView. appleHeadersDataGridView.AutoGenerateColumns = false; appleHeadersDataGridView.AutoSize = true; appleHeadersDataGridView.DataSource = appleHeadersBindingSource; appleHeadersDataGridView.ForeColor = SystemColors.WindowText; // Create the Name column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderName, Name = HeaderName, Width = 80 }; appleHeadersDataGridView.Columns.Add(textBoxColumn); // Create the Value column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderValue, Name = HeaderValue, Width = 150 }; appleHeadersDataGridView.Columns.Add(textBoxColumn); // Set Grid style appleHeadersDataGridView.EnableHeadersVisualStyles = false; //appleHeadersDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. appleHeadersDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); appleHeadersDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. appleHeadersDataGridView.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. appleHeadersDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; appleHeadersDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. appleHeadersDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); appleHeadersDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; appleHeadersDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); appleHeadersDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource appleTagsBindingSource.DataSource = NotificationInfo.ApnsTags; // Initialize the DataGridView. appleTagsDataGridView.AutoGenerateColumns = false; appleTagsDataGridView.AutoSize = true; appleTagsDataGridView.DataSource = appleTagsBindingSource; appleTagsDataGridView.ForeColor = SystemColors.WindowText; // Create the TagName column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = TagName, Name = TagName, Width = 228 }; appleTagsDataGridView.Columns.Add(textBoxColumn); // Set Grid style appleTagsDataGridView.EnableHeadersVisualStyles = false; //appleTagsDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. appleTagsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); appleTagsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowTagsDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. appleTagsDataGridView.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. appleTagsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; appleTagsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. appleTagsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); appleTagsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; appleTagsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); appleTagsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; //-------------------------------- // Initialize bindingSource gcmHeadersBindingSource.DataSource = NotificationInfo.GcmHeaders; // Initialize the DataGridView. gcmHeadersDataGridView.AutoGenerateColumns = false; gcmHeadersDataGridView.AutoSize = true; gcmHeadersDataGridView.DataSource = gcmHeadersBindingSource; gcmHeadersDataGridView.ForeColor = SystemColors.WindowText; // Create the Name column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderName, Name = HeaderName, Width = 80 }; gcmHeadersDataGridView.Columns.Add(textBoxColumn); // Create the Value column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = HeaderValue, Name = HeaderValue, Width = 150 }; gcmHeadersDataGridView.Columns.Add(textBoxColumn); // Set Grid style gcmHeadersDataGridView.EnableHeadersVisualStyles = false; //gcmHeadersDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. gcmHeadersDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); gcmHeadersDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. gcmHeadersDataGridView.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. gcmHeadersDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; gcmHeadersDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. gcmHeadersDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); gcmHeadersDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; gcmHeadersDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); gcmHeadersDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize bindingSource gcmTagsBindingSource.DataSource = NotificationInfo.GcmTags; // Initialize the DataGridView. gcmTagsDataGridView.AutoGenerateColumns = false; gcmTagsDataGridView.AutoSize = true; gcmTagsDataGridView.DataSource = gcmTagsBindingSource; gcmTagsDataGridView.ForeColor = SystemColors.WindowText; // Create the TagName column textBoxColumn = new DataGridViewTextBoxColumn { DataPropertyName = TagName, Name = TagName, Width = 228 }; gcmTagsDataGridView.Columns.Add(textBoxColumn); // Set Grid style gcmTagsDataGridView.EnableHeadersVisualStyles = false; //gcmTagsDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; // Set the selection background color for all the cells. gcmTagsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); gcmTagsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowTagsDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. gcmTagsDataGridView.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. gcmTagsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; gcmTagsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. gcmTagsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); gcmTagsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; gcmTagsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); gcmTagsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set Grid style registrationsDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. registrationsDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); registrationsDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. registrationsDataGridView.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. registrationsDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; registrationsDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //sessionsDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //sessionsDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. registrationsDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); registrationsDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; registrationsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); registrationsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set splitter width templateSplitContainer.SplitterWidth = 16; registrationsSplitContainer.SplitterWidth = 16; templateSplitContainer1.SplitterWidth = 8; mpnsSplitContainer.SplitterWidth = 16; wnsSplitContainer.SplitterWidth = 16; appleSplitContainer.SplitterWidth = 8; gcmSplitContainer.SplitterWidth = 8; mpnsSplitContainer1.SplitterWidth = 8; wnsSplitContainer1.SplitterWidth = 8; appleLowerSplitContainer.SplitterWidth = 16; gcmLowerSplitContainer.SplitterWidth = 16; // Initialize cboMpnsNotificationTemplate ComboBox var mpnsType = typeof(WindowsPhoneNotificationXmlBuilder); var mpnsMethodInfos = mpnsType.GetMethods(BindingFlags.Public | BindingFlags.Static); mpnsMethodInfoList = new List<MethodInfo>(mpnsMethodInfos); cboMpnsNotificationTemplate.Items.Add(SelectNotificationTemplate); cboMpnsNotificationTemplate.Items.Add(ManualTemplate); foreach (var methodInfo in mpnsMethodInfos) { var parameters = methodInfo.GetParameters(); if (parameters.Any(p => (p.ParameterType != typeof(string) && p.ParameterType != typeof(bool)))) { continue; } cboMpnsNotificationTemplate.Items.Add(methodInfo.Name.StartsWith("Create") ? methodInfo.Name.Substring(6) : methodInfo.Name); } cboMpnsNotificationTemplate.SelectedIndex = 0; // Initialize cboWnsNotificationTemplate ComboBox var wnstype = typeof(WindowsNotificationXmlBuilder); var wnsMethodInfos = wnstype.GetMethods(BindingFlags.Public | BindingFlags.Static); wnsMethodInfoList = new List<MethodInfo>(wnsMethodInfos); cboWnsNotificationTemplate.Items.Add(SelectNotificationTemplate); cboWnsNotificationTemplate.Items.Add(ManualTemplate); foreach (var methodInfo in wnsMethodInfos) { var parameters = methodInfo.GetParameters(); if (parameters.Any(p => (p.ParameterType != typeof(string)))) { continue; } cboWnsNotificationTemplate.Items.Add(methodInfo.Name.StartsWith("Create") ? methodInfo.Name.Substring(6) : methodInfo.Name); } cboWnsNotificationTemplate.SelectedIndex = 0; // Initialize Data InitializeData(); } else { // Initialize buttons btnCreateDelete.Text = CreateText; btnCancelUpdate.Text = CancelText; btnRefresh.Enabled = false; btnRegistrations.Visible = false; btnMetrics.Visible = false; btnCloseTabs.Visible = false; txtPath.Focus(); // Disable test pages DisablePage(MetricsTabPage); DisablePage(TemplateNotificationPage); DisablePage(WindowsPhoneNativeNotificationPage); DisablePage(WindowsNativeNotificationPage); DisablePage(AppleNativeNotificationPage); DisablePage(GoogleNativeNotificationPage); // Create BindingList for Authorization Rules var bindingList = new BindingList<NotificationHubAuthorizationRuleWrapper>(new List<NotificationHubAuthorizationRuleWrapper>()) { AllowEdit = true, AllowNew = true, AllowRemove = true }; bindingList.ListChanged += bindingList_ListChanged; authorizationRulesBindingSource.DataSource = bindingList; authorizationRulesDataGridView.DataSource = authorizationRulesBindingSource; } }
// ReSharper disable once FunctionComplexityOverflow private void InitializeControls() { // RelayType if (cboRelayType.Items.Count == 0) { var values = Enum.GetNames(typeof (RelayType)); // ReSharper disable once CoVariantArrayConversion cboRelayType.Items.AddRange(values); } if (cboRelayType.Items.Count > 0) { cboRelayType.SelectedIndex = 0; } // IsAnonymousAccessible if (serviceBusHelper.IsCloudNamespace) { if (checkedListBox.Items.Count > IsAnonymousAccessibleIndex) { checkedListBox.Items.RemoveAt(IsAnonymousAccessibleIndex); } } // Set Grid style dataPointDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. dataPointDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); dataPointDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. dataPointDataGridView.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. dataPointDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; dataPointDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //filtersDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //filtersDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. dataPointDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; dataPointDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); dataPointDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; // Initialize the DataGridView. dataPointBindingSource.DataSource = dataPointBindingList; dataPointDataGridView.AutoGenerateColumns = false; dataPointDataGridView.AutoSize = true; dataPointDataGridView.DataSource = dataPointBindingSource; dataPointDataGridView.ForeColor = SystemColors.WindowText; if (relayDescription != null) { MetricInfo.GetMetricInfoListAsync(serviceBusHelper.Namespace, RelayEntity, relayDescription.Path).ContinueWith(t => metricsManualResetEvent.Set()); } if (dataPointDataGridView.Columns.Count == 0) { // Create the Metric column var metricColumn = new DataGridViewComboBoxColumn { DataSource = MetricInfo.EntityMetricDictionary.ContainsKey(RelayEntity) ? MetricInfo.EntityMetricDictionary[RelayEntity] : null, DataPropertyName = MetricProperty, DisplayMember = DisplayNameProperty, ValueMember = NameProperty, Name = MetricProperty, Width = 144, DropDownWidth = 250, FlatStyle = FlatStyle.Flat, DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton }; dataPointDataGridView.Columns.Add(metricColumn); // Create the Time Granularity column var timeGranularityColumn = new DataGridViewComboBoxColumn { DataSource = timeGranularityList, DataPropertyName = GranularityProperty, Name = GranularityProperty, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(timeGranularityColumn); // Create the Time Operator 1 column var operator1Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator1Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator1Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator1Column); // Create the Time Value 1 column var value1Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue1Name, HeaderText = TimeFilterValue, Name = TimeFilterValue1Name, Width = 136 }; dataPointDataGridView.Columns.Add(value1Column); // Create the Time Operator 1 column var operator2Column = new DataGridViewComboBoxColumn { DataSource = operators, DataPropertyName = TimeFilterOperator2Name, HeaderText = TimeFilterOperator, Name = TimeFilterOperator2Name, Width = 72, FlatStyle = FlatStyle.Flat }; dataPointDataGridView.Columns.Add(operator2Column); // Create the Time Value 1 column var value2Column = new DataGridViewDateTimePickerColumn { DataPropertyName = TimeFilterValue2Name, HeaderText = TimeFilterValue, Name = TimeFilterValue2Name, Width = 136 }; dataPointDataGridView.Columns.Add(value2Column); // Create delete column var deleteButtonColumn = new DataGridViewButtonColumn { Name = DeleteName, CellTemplate = new DataGridViewDeleteButtonCell(), HeaderText = string.Empty, Width = 22 }; deleteButtonColumn.CellTemplate.ToolTipText = DeleteTooltip; deleteButtonColumn.UseColumnTextForButtonValue = true; dataPointDataGridView.Columns.Add(deleteButtonColumn); } // Set Grid style authorizationRulesDataGridView.EnableHeadersVisualStyles = false; // Set the selection background color for all the cells. authorizationRulesDataGridView.DefaultCellStyle.SelectionBackColor = Color.FromArgb(92, 125, 150); authorizationRulesDataGridView.DefaultCellStyle.SelectionForeColor = SystemColors.Window; // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default // value won't override DataGridView.DefaultCellStyle.SelectionBackColor. authorizationRulesDataGridView.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. authorizationRulesDataGridView.RowsDefaultCellStyle.BackColor = SystemColors.Window; authorizationRulesDataGridView.RowsDefaultCellStyle.ForeColor = SystemColors.ControlText; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.White; //authorizationRulesDataGridView.AlternatingRowsDefaultCellStyle.ForeColor = SystemColors.ControlText; // Set the row and column header styles. authorizationRulesDataGridView.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.RowHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(215, 228, 242); authorizationRulesDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors.ControlText; authorizationRulesDataGridView.AutoGenerateColumns = false; if (authorizationRulesDataGridView.Columns.Count == 0) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "IssuerName", DataPropertyName = "IssuerName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewComboBoxColumn { Name = "ClaimType", DataPropertyName = "ClaimType", DataSource = claimTypes, FlatStyle = FlatStyle.Flat }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ClaimValue", DataPropertyName = "ClaimValue" }); if (serviceBusHelper.IsCloudNamespace) { authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "KeyName", DataPropertyName = "KeyName" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "PrimaryKey", DataPropertyName = "PrimaryKey" }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "SecondaryKey", DataPropertyName = "SecondaryKey" }); } authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Manage", DataPropertyName = "Manage", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Send", DataPropertyName = "Send", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewCheckBoxColumn { Name = "Listen", DataPropertyName = "Listen", Width = 50 }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "Revision", DataPropertyName = "Revision", Width = 50, ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "CreatedTime", DataPropertyName = "CreatedTime", ReadOnly = true }); authorizationRulesDataGridView.Columns.Add(new DataGridViewTextBoxColumn { Name = "ModifiedTime", DataPropertyName = "ModifiedTime", ReadOnly = true }); } if (relayDescription != null) { // Tab pages if (serviceBusHelper.IsCloudNamespace) { EnablePage(MetricsTabPage); } else { DisablePage(MetricsTabPage); } // Initialize buttons btnCreateDelete.Text = DeleteText; btnCancelUpdate.Text = UpdateText; btnRefresh.Visible = true; // Initialize textboxes txtPath.ReadOnly = true; txtPath.BackColor = SystemColors.Window; txtPath.ForeColor = SystemColors.ControlText; txtPath.GotFocus += textBox_GotFocus; // Initialize comboboxes cboRelayType.BackColor = SystemColors.Window; cboRelayType.Enabled = false; // EnableBatchedOperations checkedListBox.SetItemChecked(RequiresClientAuthorizationIndex, relayDescription.RequiresClientAuthorization); checkedListBox.SetItemChecked(RequiresTransportSecurityIndex, relayDescription.RequiresTransportSecurity); // Initialize Data InitializeData(); checkedListBox.ItemCheck += checkedListBox_ItemCheck; toolTip.SetToolTip(txtPath, PathTooltip); toolTip.SetToolTip(txtUserMetadata, UserMetadataTooltip); if (relayDescription.IsDynamic) { DisablePage(AuthorizationPage); txtUserMetadata.ReadOnly = true; txtUserMetadata.BackColor = SystemColors.Window; txtUserMetadata.GotFocus += textBox_GotFocus; btnCreateDelete.Visible = false; btnCancelUpdate.Visible = false; btnMetrics.Location = btnRefresh.Location; btnCloseTabs.Location = btnCreateDelete.Location; btnRefresh.Location = btnCancelUpdate.Location; } } else { // Initialize buttons btnCreateDelete.Text = CreateText; btnCancelUpdate.Text = CancelText; btnRefresh.Visible = false; checkedListBox.SetItemChecked(RequiresClientAuthorizationIndex, true); checkedListBox.SetItemChecked(RequiresTransportSecurityIndex, true); // Create BindingList for Authorization Rules var bindingList = new BindingList<AuthorizationRuleWrapper>(new List<AuthorizationRuleWrapper>()) { AllowEdit = true, AllowNew = true, AllowRemove = true }; bindingList.ListChanged += bindingList_ListChanged; authorizationRulesBindingSource.DataSource = bindingList; authorizationRulesDataGridView.DataSource = authorizationRulesBindingSource; if (!string.IsNullOrWhiteSpace(path)) { txtPath.Text = path; } txtPath.Focus(); } }