From 89d2aed0ae77106bca407a892170564ef620b049 Mon Sep 17 00:00:00 2001 From: Erik Mogensen Date: Tue, 9 Jan 2024 20:41:39 +0100 Subject: [PATCH 1/4] Method name change, added DataGridViewHelper.cs --- .../Controls/HandleQueueControl.Designer.cs | 4 +- .../Controls/HandleQueueControl.cs | 107 +++++++++++------- .../UIHelpers/DataGridViewHelper.cs | 41 +++++++ 3 files changed, 107 insertions(+), 45 deletions(-) create mode 100644 src/ServiceBusExplorer/UIHelpers/DataGridViewHelper.cs diff --git a/src/ServiceBusExplorer/Controls/HandleQueueControl.Designer.cs b/src/ServiceBusExplorer/Controls/HandleQueueControl.Designer.cs index 0d950d7e..52d32e5c 100644 --- a/src/ServiceBusExplorer/Controls/HandleQueueControl.Designer.cs +++ b/src/ServiceBusExplorer/Controls/HandleQueueControl.Designer.cs @@ -2232,14 +2232,14 @@ private void InitializeComponent() this.deleteSelectedMessageToolStripMenuItem.Name = "deleteSelectedMessageToolStripMenuItem"; this.deleteSelectedMessageToolStripMenuItem.Size = new System.Drawing.Size(305, 22); this.deleteSelectedMessageToolStripMenuItem.Text = "Delete Selected Message"; - this.deleteSelectedMessageToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedMessageToolStripMenuItem_Click); + this.deleteSelectedMessageToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedDeadLetterMessageToolStripMenuItem_Click); // // deleteSelectedMessagesToolStripMenuItem // this.deleteSelectedMessagesToolStripMenuItem.Name = "deleteSelectedMessagesToolStripMenuItem"; this.deleteSelectedMessagesToolStripMenuItem.Size = new System.Drawing.Size(305, 22); this.deleteSelectedMessagesToolStripMenuItem.Text = "Delete Selected Messages"; - this.deleteSelectedMessagesToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedMessagesToolStripMenuItem_Click); + this.deleteSelectedMessagesToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedDeadLetterMessagesToolStripMenuItem_Click); // // btnPurgeMessages // diff --git a/src/ServiceBusExplorer/Controls/HandleQueueControl.cs b/src/ServiceBusExplorer/Controls/HandleQueueControl.cs index 48c644fe..2e8ae96a 100644 --- a/src/ServiceBusExplorer/Controls/HandleQueueControl.cs +++ b/src/ServiceBusExplorer/Controls/HandleQueueControl.cs @@ -37,6 +37,7 @@ using System.ComponentModel; using System.Configuration; using System.Diagnostics; +using System.Diagnostics.Eventing.Reader; using System.Drawing; using System.Globalization; using System.IO; @@ -681,14 +682,14 @@ private void InitializeControls(bool initialCall) if (queueDescription != null) { - if (duplicateQueue) - { - ConfigureDuplicateUserInterface(); - } - else - { - ConfigureReadUserInterface(); - } + if (duplicateQueue) + { + ConfigureDuplicateUserInterface(); + } + else + { + ConfigureReadUserInterface(); + } } else { @@ -1049,7 +1050,7 @@ private void ConfigureDuplicateUserInterface() // special handling for max size if partitioning is enabled trackBarMaxQueueSize.Maximum = serviceBusHelper.IsCloudNamespace ? 5 : 11; - trackBarMaxQueueSize.Value = queueDescription.EnablePartitioning ? queueDescription.MaxSizeInGigabytes() / 16 + trackBarMaxQueueSize.Value = queueDescription.EnablePartitioning ? queueDescription.MaxSizeInGigabytes() / 16 : queueDescription.MaxSizeInGigabytes(); ConfigureCreateUserInterface(); @@ -1467,7 +1468,7 @@ private void ReadMessagesOneAtTheTime(bool peek, bool all, int count, IBrokeredM else { var messageReceiver = BuildMessageReceiver(ReceiveMode.ReceiveAndDelete, fromSession); - + var totalRetrieved = 0; int retrieved; do @@ -3197,7 +3198,7 @@ private void deadletterDataGridView_CellDoubleClick(object sender, DataGridViewC { if (messageForm.RemovedSequenceNumbers != null && messageForm.RemovedSequenceNumbers.Any()) { - RemoveDeadletterDataGridRows(messageForm.RemovedSequenceNumbers); + DataGridViewHelper.RemoveDataGridRowsUsingSequenceNumbers(deadletterDataGridView, messageForm.RemovedSequenceNumbers); } } finally @@ -3374,12 +3375,12 @@ private void ResubmitSelectedMessages() } } - void deleteSelectedMessageToolStripMenuItem_Click(object sender, EventArgs e) + void deleteSelectedDeadLetterMessageToolStripMenuItem_Click(object sender, EventArgs e) { - deleteSelectedMessagesToolStripMenuItem_Click(sender, e); + deleteSelectedDeadLetterMessagesToolStripMenuItem_Click(sender, e); } - async void deleteSelectedMessagesToolStripMenuItem_Click(object sender, EventArgs e) + async void deleteSelectedDeadLetterMessagesToolStripMenuItem_Click(object sender, EventArgs e) { if (deadletterDataGridView.SelectedRows.Count <= 0) { @@ -3422,7 +3423,7 @@ async void deleteSelectedMessagesToolStripMenuItem_Click(object sender, EventArg var messagesDeleteCount = sequenceNumbersToDelete.Count; var result = await deadLetterMessageHandler.DeleteMessages(sequenceNumbersToDelete); - RemoveDeadletterDataGridRows(result.DeletedSequenceNumbers); + DataGridViewHelper.RemoveDataGridRowsUsingSequenceNumbers(deadletterDataGridView, result.DeletedSequenceNumbers); if (messagesDeleteCount > result.DeletedSequenceNumbers.Count) { @@ -3452,6 +3453,7 @@ private void deadletterDataGridView_CellMouseDown(object sender, DataGridViewCel { return; } + deadletterDataGridView.Rows[e.RowIndex].Selected = true; var multipleSelectedRows = deadletterDataGridView.SelectedRows.Count > 1; @@ -3475,6 +3477,7 @@ private void transferDeadletterDataGridView_CellMouseDown(object sender, DataGri { return; } + transferDeadletterDataGridView.Rows[e.RowIndex].Selected = true; var multipleSelectedRows = transferDeadletterDataGridView.SelectedRows.Count > 1; repairAndResubmitDeadletterToolStripMenuItem.Visible = !multipleSelectedRows; @@ -3488,37 +3491,54 @@ private void transferDeadletterDataGridView_CellMouseDown(object sender, DataGri private void repairAndResubmitDeadletterMessageToolStripMenuItem_Click(object sender, EventArgs e) { - deadletterDataGridView_CellDoubleClick(deadletterDataGridView, - new DataGridViewCellEventArgs(0, currentDeadletterMessageRowIndex)); + DataGridView dataGridView = GetActiveDeadletterGridView(); + + int currentRowIndex; + + if (dataGridView == deadletterDataGridView) + { + currentRowIndex = currentDeadletterMessageRowIndex; + } + else if (dataGridView == transferDeadletterDataGridView) + { + currentRowIndex = currentTransferDeadletterMessageRowIndex; + } + else + { + throw new InvalidOperationException("Unexpected DataGridView"); + } + + deadletterDataGridView_CellDoubleClick(dataGridView, + new DataGridViewCellEventArgs(0, currentRowIndex)); } private async void resubmitDeadletterMessageToolStripMenuItem_Click(object sender, EventArgs e) { - await ResubmitSelectedDeadletterMessages(); + await ResubmitSelectedDeadletterMessages(GetActiveDeadletterGridView()); } private async void resubmitSelectedDeadletterMessagesInBatchModeToolStripMenuItem_Click(object sender, EventArgs e) { - await ResubmitSelectedDeadletterMessages(); + await ResubmitSelectedDeadletterMessages(GetActiveDeadletterGridView()); } - async Task ResubmitSelectedDeadletterMessages() + async Task ResubmitSelectedDeadletterMessages(DataGridView dataGridView) { try { - if (deadletterDataGridView.SelectedRows.Count <= 0) + if (dataGridView.SelectedRows.Count <= 0) { return; } - using (var form = new MessageForm(queueDescription, deadletterDataGridView.SelectedRows.Cast() + using (var form = new MessageForm(queueDescription, dataGridView.SelectedRows.Cast() .Select(r => (BrokeredMessage)r.DataBoundItem), serviceBusHelper, writeToLog)) { form.ShowDialog(); if (form.RemovedSequenceNumbers != null && form.RemovedSequenceNumbers.Any()) { - RemoveDeadletterDataGridRows(form.RemovedSequenceNumbers); + DataGridViewHelper.RemoveDataGridRowsUsingSequenceNumbers(dataGridView, form.RemovedSequenceNumbers); } } } @@ -4140,6 +4160,7 @@ private void saveSelectedDeadletteredMessageToolStripMenuItem_Click(object sende { return; } + var bindingList = deadletterBindingSource.DataSource as BindingList; if (bindingList == null) { @@ -4275,6 +4296,7 @@ void saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem_Click(object se var messages = deadletterDataGridView.SelectedRows.Cast() .Select(r => r.DataBoundItem as BrokeredMessage); IEnumerable brokeredMessages = messages as BrokeredMessage[] ?? messages.ToArray(); + if (!brokeredMessages.Any()) { return; @@ -4285,6 +4307,7 @@ void saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem_Click(object se saveFileDialog.DefaultExt = TxtExtension; saveFileDialog.Filter = AllFilesFilter; saveFileDialog.FileName = CreateFileNameAutoRecognize(); + if (saveFileDialog.ShowDialog() != DialogResult.OK || string.IsNullOrWhiteSpace(saveFileDialog.FileName)) { @@ -4294,6 +4317,7 @@ void saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem_Click(object se var bodies = brokeredMessages.Select(bm => serviceBusHelper.GetMessageText(bm, MainForm.SingletonMainForm.UseAscii, out _)); var count = 0; + foreach (var body in bodies) { count++; @@ -4302,6 +4326,7 @@ void saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem_Click(object se fileNameParts.RemoveAt(fileNameParts.IndexOf(fileExtension)); fileNameParts.Add($"({count}).{fileExtension}"); var fileName = string.Join(".", fileNameParts); + if (File.Exists(fileName)) { File.Delete(fileName); @@ -4533,31 +4558,27 @@ private async void btnPurgeDeadletterQueueMessages_Click(object sender, EventArg await PurgeDeadletterQueueMessagesAsync(); } - void RemoveDeadletterDataGridRows(IEnumerable sequenceNumbersToRemove) - { - var rowsToRemove = new List(sequenceNumbersToRemove.Count()); - foreach (DataGridViewRow row in deadletterDataGridView.Rows) - { - var message = (BrokeredMessage)row.DataBoundItem; + #endregion - if (sequenceNumbersToRemove.Contains(message.SequenceNumber)) - { - rowsToRemove.Add(row); - if (rowsToRemove.Count >= sequenceNumbersToRemove.Count()) - { - break; - } - } - } + #region DataGridView methods - for (var rowIndex = rowsToRemove.Count - 1; rowIndex >= 0; --rowIndex) + // Returns either the plain deadletter grid view or the transfer deadletter grid view, + // depending on which tab is selected. + DataGridView GetActiveDeadletterGridView() + { + if (mainTabControl.SelectedTab == mainTabControl.TabPages[DeadletterTabPage]) { - var row = rowsToRemove[rowIndex]; - deadletterDataGridView.Rows.Remove(row); + return deadletterDataGridView; + } + else if (mainTabControl.SelectedTab == mainTabControl.TabPages[TransferDeadletterTabPage]) + { + return transferDeadletterDataGridView; + } + else + { + throw new InvalidOperationException("Unexpected tab selected."); } - - deadletterDataGridView.ClearSelection(); } #endregion } diff --git a/src/ServiceBusExplorer/UIHelpers/DataGridViewHelper.cs b/src/ServiceBusExplorer/UIHelpers/DataGridViewHelper.cs new file mode 100644 index 00000000..3c275a7d --- /dev/null +++ b/src/ServiceBusExplorer/UIHelpers/DataGridViewHelper.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +using Microsoft.ServiceBus.Messaging; + +namespace ServiceBusExplorer.UIHelpers +{ + internal static class DataGridViewHelper + { + static public void RemoveDataGridRowsUsingSequenceNumbers(DataGridView dataGridView, + IEnumerable sequenceNumbersToRemove) + { + var rowsToRemove = new List(sequenceNumbersToRemove.Count()); + + foreach (DataGridViewRow row in dataGridView.Rows) + { + var message = (BrokeredMessage)row.DataBoundItem; + + if (sequenceNumbersToRemove.Contains(message.SequenceNumber)) + { + rowsToRemove.Add(row); + + if (rowsToRemove.Count >= sequenceNumbersToRemove.Count()) + { + break; + } + } + } + + for (var rowIndex = rowsToRemove.Count - 1; rowIndex >= 0; --rowIndex) + { + var row = rowsToRemove[rowIndex]; + dataGridView.Rows.Remove(row); + } + + dataGridView.ClearSelection(); + } + } +} From 5fffc315634d23bde059f9917467418a849c577e Mon Sep 17 00:00:00 2001 From: Erik Mogensen Date: Sun, 11 Feb 2024 15:12:21 +0100 Subject: [PATCH 2/4] Added support for deleting transfer DLQ messages --- .../Helpers/DeadLetterMessageHandler.cs | 20 +- .../Controls/HandleQueueControl.cs | 693 ++++++------------ .../Controls/HandleSubscriptionControl.cs | 2 +- src/ServiceBusExplorer/Forms/MessageForm.cs | 25 +- 4 files changed, 265 insertions(+), 475 deletions(-) diff --git a/src/Common/Helpers/DeadLetterMessageHandler.cs b/src/Common/Helpers/DeadLetterMessageHandler.cs index a86cfd5e..1330ad20 100644 --- a/src/Common/Helpers/DeadLetterMessageHandler.cs +++ b/src/Common/Helpers/DeadLetterMessageHandler.cs @@ -87,7 +87,8 @@ public DeadLetterMessageHandler(WriteToLogDelegate writeToLog, ServiceBusHelper #endregion #region Public methods - public async Task DeleteMessages(List sequenceNumbers) + public async Task DeleteMessages(List sequenceNumbers, + bool TransferDLQ) { var sequenceNumbersToDeleteList = new List(); foreach (var number in sequenceNumbers) @@ -96,7 +97,7 @@ public async Task DeleteMessages(List sequenceN } var timedOut = false; - var dlqEntityPath = GetDlqEntityPath(); + var dlqEntityPath = TransferDLQ ? GetTransferDlqEntityPath() : GetDlqEntityPath(); var messageReceiver = await serviceBusHelper.MessagingFactory.CreateMessageReceiverAsync( dlqEntityPath, @@ -185,7 +186,7 @@ public async Task DeleteMessages(List sequenceN public async Task MoveMessages(MessageSender messageSender, - List sequenceNumbers, List messagesToSend = null) + List sequenceNumbers, bool transferDLQ, List messagesToSend = null) { if (messagesToSend != null) { @@ -196,7 +197,7 @@ public async Task MoveMessages(MessageSender messageSe } } - var dlqEntityPath = GetDlqEntityPath(); + var dlqEntityPath = transferDLQ ? GetTransferDlqEntityPath() : GetDlqEntityPath(); var messageReceiver = serviceBusHelper.MessagingFactory.CreateMessageReceiver( dlqEntityPath, @@ -368,6 +369,17 @@ string GetDlqEntityPath() sourceSubscriptionWrapper.SubscriptionDescription.TopicPath, sourceSubscriptionWrapper.SubscriptionDescription.Name); } + + string GetTransferDlqEntityPath() + { + if (sourceQueueDescription != null) + { + return QueueClient.FormatTransferDeadLetterPath(sourceQueueDescription.Path); + } + + throw new Exception("It is currently not supported getting a Transfer Dead-letter queue for a subscription."); + } + void WriteToLog(string message) { if (writeToLog != null && !string.IsNullOrWhiteSpace(message)) diff --git a/src/ServiceBusExplorer/Controls/HandleQueueControl.cs b/src/ServiceBusExplorer/Controls/HandleQueueControl.cs index 2e8ae96a..087e48e8 100644 --- a/src/ServiceBusExplorer/Controls/HandleQueueControl.cs +++ b/src/ServiceBusExplorer/Controls/HandleQueueControl.cs @@ -24,20 +24,10 @@ #region Using Directives #nullable enable -using Microsoft.ServiceBus.Messaging; - -using ServiceBusExplorer.Forms; -using ServiceBusExplorer.Helpers; -using ServiceBusExplorer.ServiceBus.Helpers; -using ServiceBusExplorer.UIHelpers; -using ServiceBusExplorer.Utilities.Helpers; - using System; using System.Collections.Generic; using System.ComponentModel; -using System.Configuration; using System.Diagnostics; -using System.Diagnostics.Eventing.Reader; using System.Drawing; using System.Globalization; using System.IO; @@ -45,6 +35,14 @@ using System.Threading.Tasks; using System.Windows.Forms; +using Microsoft.ServiceBus.Messaging; + +using ServiceBusExplorer.Forms; +using ServiceBusExplorer.Helpers; +using ServiceBusExplorer.ServiceBus.Helpers; +using ServiceBusExplorer.UIHelpers; +using ServiceBusExplorer.Utilities.Helpers; + #endregion // ReSharper disable once CheckNamespace @@ -1091,8 +1089,6 @@ private void ConfigureCreateUserInterface() txtPath.Focus(); } - - private void bindingList_ListChanged(object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemDeleted) @@ -1756,7 +1752,7 @@ private void GetTransferDeadletterMessages(bool peek, bool all, int count, IBrok { AllowEdit = false, AllowNew = false, - AllowRemove = false + AllowRemove = true }; transferDeadletterBindingSource.DataSource = transferDeadletterBindingList; @@ -3172,7 +3168,8 @@ private void messagesDataGridView_CellDoubleClick(object sender, DataGridViewCel { return; } - using (var messageForm = new MessageForm(queueDescription, bindingList[e.RowIndex], serviceBusHelper, writeToLog)) + using (var messageForm = new MessageForm(queueDescription, + MessageForm.SubqueueType.NotASubqueue, bindingList[e.RowIndex], serviceBusHelper, writeToLog)) { messageForm.ShowDialog(); } @@ -3180,49 +3177,12 @@ private void messagesDataGridView_CellDoubleClick(object sender, DataGridViewCel private void deadletterDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.RowIndex < 0) - { - return; - } - var bindingList = deadletterBindingSource.DataSource as BindingList; - if (bindingList == null) - { - return; - } - using (var messageForm = new MessageForm(queueDescription, bindingList[e.RowIndex], serviceBusHelper, writeToLog)) - { - messageForm.ShowDialog(); - - Application.UseWaitCursor = true; - try - { - if (messageForm.RemovedSequenceNumbers != null && messageForm.RemovedSequenceNumbers.Any()) - { - DataGridViewHelper.RemoveDataGridRowsUsingSequenceNumbers(deadletterDataGridView, messageForm.RemovedSequenceNumbers); - } - } - finally - { - Application.UseWaitCursor = false; - } - } + RepairAndResubmitSharedDeadletterMessage(e); } private void transferDeadletterDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.RowIndex < 0) - { - return; - } - var bindingList = transferDeadletterBindingSource.DataSource as BindingList; - if (bindingList == null) - { - return; - } - using (var messageForm = new MessageForm(queueDescription, bindingList[e.RowIndex], serviceBusHelper, writeToLog)) - { - messageForm.ShowDialog(); - } + RepairAndResubmitSharedDeadletterMessage(e); } private void messagesDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) @@ -3356,51 +3316,51 @@ private void resubmitSelectedMessagesInBatchModeToolStripMenuItem_Click(object s private void ResubmitSelectedMessages() { - try + if (messagesDataGridView.SelectedRows.Count <= 0) { - if (messagesDataGridView.SelectedRows.Count <= 0) - { - return; - } - - using (var form = new MessageForm(queueDescription, messagesDataGridView.SelectedRows.Cast() - .Select(r => (BrokeredMessage)r.DataBoundItem), serviceBusHelper, writeToLog)) - { - form.ShowDialog(); - } + return; } - catch (Exception ex) + + using (var form = new MessageForm( + queueDescription, + MessageForm.SubqueueType.NotASubqueue, + messagesDataGridView.SelectedRows.Cast() + .Select(r => (BrokeredMessage)r.DataBoundItem), + serviceBusHelper, writeToLog)) { - HandleException(ex); + form.ShowDialog(); } } - void deleteSelectedDeadLetterMessageToolStripMenuItem_Click(object sender, EventArgs e) + void deleteSelectedSharedDeadLetterMessageToolStripMenuItem_Click(object sender, EventArgs e) { - deleteSelectedDeadLetterMessagesToolStripMenuItem_Click(sender, e); + deleteSelectedSharedDeadLetterMessagesToolStripMenuItem_Click(sender, e); } - async void deleteSelectedDeadLetterMessagesToolStripMenuItem_Click(object sender, EventArgs e) + async void deleteSelectedSharedDeadLetterMessagesToolStripMenuItem_Click(object sender, EventArgs e) { - if (deadletterDataGridView.SelectedRows.Count <= 0) + var dataGridView = GetActiveDeadletterGridView(); + + if (dataGridView.SelectedRows.Count <= 0) { return; } - var messages = deadletterDataGridView.SelectedRows.Cast() + var messages = dataGridView.SelectedRows.Cast() .Select(r => r.DataBoundItem as BrokeredMessage); string confirmationText; + var transferText = dataGridView == transferDeadletterDataGridView ? "transfer " : string.Empty; if (messages.Count() == 1) { confirmationText = "Are you sure you want to delete the selected message from the " + - $"dead-letter subqueue for the {queueDescription.Path} queue?"; + $"{transferText}dead-letter subqueue for the {queueDescription.Path} queue?"; } else { confirmationText = $"Are you sure you want to delete {messages.Count()} messages from the " + - $"dead-letter subqueue for {queueDescription.Path} queue?"; + $"{transferText}dead-letter subqueue for {queueDescription.Path} queue?"; } using (var deleteForm = new DeleteForm(confirmationText)) @@ -3422,8 +3382,10 @@ async void deleteSelectedDeadLetterMessagesToolStripMenuItem_Click(object sender stopwatch.Start(); var messagesDeleteCount = sequenceNumbersToDelete.Count; - var result = await deadLetterMessageHandler.DeleteMessages(sequenceNumbersToDelete); - DataGridViewHelper.RemoveDataGridRowsUsingSequenceNumbers(deadletterDataGridView, result.DeletedSequenceNumbers); + var result = await deadLetterMessageHandler.DeleteMessages(sequenceNumbersToDelete, + TransferDLQ : dataGridView == transferDeadletterDataGridView ? true : false); + + DataGridViewHelper.RemoveDataGridRowsUsingSequenceNumbers(dataGridView, result.DeletedSequenceNumbers); if (messagesDeleteCount > result.DeletedSequenceNumbers.Count) { @@ -3448,76 +3410,32 @@ async void deleteSelectedDeadLetterMessagesToolStripMenuItem_Click(object sender } private void deadletterDataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) - { - if (e.Button != MouseButtons.Right || e.RowIndex == -1) - { - return; - } - - deadletterDataGridView.Rows[e.RowIndex].Selected = true; - var multipleSelectedRows = deadletterDataGridView.SelectedRows.Count > 1; - - repairAndResubmitDeadletterToolStripMenuItem.Visible = !multipleSelectedRows; - resubmitDeadletterToolStripMenuItem.Visible = !multipleSelectedRows; - saveSelectedDeadletteredMessageToolStripMenuItem.Visible = !multipleSelectedRows; - saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem.Visible = !multipleSelectedRows; - deleteSelectedMessageToolStripMenuItem.Visible = !multipleSelectedRows; - - resubmitSelectedDeadletterInBatchModeToolStripMenuItem.Visible = multipleSelectedRows; - saveSelectedDeadletteredMessagesToolStripMenuItem.Visible = multipleSelectedRows; - saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem.Visible = multipleSelectedRows; - deleteSelectedMessagesToolStripMenuItem.Visible = multipleSelectedRows; - - deadletterContextMenuStrip.Show(Cursor.Position); + { + ShowAppropriateSharedDeadletterMenuItems(e); } private void transferDeadletterDataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { - if (e.Button != MouseButtons.Right || e.RowIndex == -1) - { - return; - } - - transferDeadletterDataGridView.Rows[e.RowIndex].Selected = true; - var multipleSelectedRows = transferDeadletterDataGridView.SelectedRows.Count > 1; - repairAndResubmitDeadletterToolStripMenuItem.Visible = !multipleSelectedRows; - saveSelectedDeadletteredMessageToolStripMenuItem.Visible = !multipleSelectedRows; - saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem.Visible = !multipleSelectedRows; - resubmitSelectedDeadletterInBatchModeToolStripMenuItem.Visible = multipleSelectedRows; - saveSelectedDeadletteredMessagesToolStripMenuItem.Visible = multipleSelectedRows; - saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem.Visible = multipleSelectedRows; - transferDeadletterContextMenuStrip.Show(Cursor.Position); + ShowAppropriateSharedDeadletterMenuItems(e); } - private void repairAndResubmitDeadletterMessageToolStripMenuItem_Click(object sender, EventArgs e) + private void repairAndResubmitSharedDeadletterMessageToolStripMenuItem_Click(object sender, EventArgs e) { - DataGridView dataGridView = GetActiveDeadletterGridView(); + var dataGridView = GetActiveDeadletterGridView(); - int currentRowIndex; + var currentRowIndex = dataGridView == deadletterDataGridView + ? currentDeadletterMessageRowIndex + : currentTransferDeadletterMessageRowIndex; - if (dataGridView == deadletterDataGridView) - { - currentRowIndex = currentDeadletterMessageRowIndex; - } - else if (dataGridView == transferDeadletterDataGridView) - { - currentRowIndex = currentTransferDeadletterMessageRowIndex; - } - else - { - throw new InvalidOperationException("Unexpected DataGridView"); - } - - deadletterDataGridView_CellDoubleClick(dataGridView, - new DataGridViewCellEventArgs(0, currentRowIndex)); + RepairAndResubmitSharedDeadletterMessage(new DataGridViewCellEventArgs(0, currentRowIndex)); } - private async void resubmitDeadletterMessageToolStripMenuItem_Click(object sender, EventArgs e) + private async void resubmitSharedDeadletterMessageToolStripMenuItem_Click(object sender, EventArgs e) { await ResubmitSelectedDeadletterMessages(GetActiveDeadletterGridView()); } - private async void resubmitSelectedDeadletterMessagesInBatchModeToolStripMenuItem_Click(object sender, + private async void resubmitSelectedSharedDeadletterMessagesInBatchModeToolStripMenuItem_Click(object sender, EventArgs e) { await ResubmitSelectedDeadletterMessages(GetActiveDeadletterGridView()); @@ -3532,8 +3450,14 @@ async Task ResubmitSelectedDeadletterMessages(DataGridView dataGridView) return; } - using (var form = new MessageForm(queueDescription, dataGridView.SelectedRows.Cast() - .Select(r => (BrokeredMessage)r.DataBoundItem), serviceBusHelper, writeToLog)) + using (var form = new MessageForm( + queueDescription, + dataGridView == deadletterDataGridView + ? MessageForm.SubqueueType.Deadletter + : MessageForm.SubqueueType.TransferDeadletter, + dataGridView.SelectedRows.Cast() + .Select(r => (BrokeredMessage)r.DataBoundItem), + serviceBusHelper, writeToLog)) { form.ShowDialog(); if (form.RemovedSequenceNumbers != null && form.RemovedSequenceNumbers.Any()) @@ -3553,33 +3477,6 @@ async Task ResubmitSelectedDeadletterMessages(DataGridView dataGridView) await MainForm.SingletonMainForm.RefreshTopics(); } - private void repairAndResubmitTransferDeadletterMessageToolStripMenuItem_Click(object sender, EventArgs e) - { - transferDeadletterDataGridView_CellDoubleClick(transferDeadletterDataGridView, - new DataGridViewCellEventArgs(0, currentTransferDeadletterMessageRowIndex)); - } - - private void resubmitSelectedTransferDeadletterMessagesInBatchModeToolStripMenuItem_Click(object sender, - EventArgs e) - { - try - { - if (transferDeadletterDataGridView.SelectedRows.Count <= 0) - { - return; - } - using (var form = new MessageForm(queueDescription, transferDeadletterDataGridView.SelectedRows.Cast() - .Select(r => (BrokeredMessage)r.DataBoundItem), serviceBusHelper, writeToLog)) - { - form.ShowDialog(); - } - } - catch (Exception ex) - { - HandleException(ex); - } - } - private void pictFindMessages_Click(object sender, EventArgs e) { try @@ -3962,7 +3859,7 @@ protected override void Dispose(bool disposing) #region Save Messages - private void saveSelectedMessageToolStripMenuItem_Click(object sender, EventArgs e) + void saveSelectedMessageToolStripMenuItem_Click(object sender, EventArgs e) { try { @@ -4051,8 +3948,7 @@ void saveSelectedMessageBodyAsFileToolStripMenuItem_Click(object sender, EventAr } } - - private void saveSelectedMessagesToolStripMenuItem_Click(object sender, EventArgs e) + void saveSelectedMessagesToolStripMenuItem_Click(object sender, EventArgs e) { try { @@ -4152,317 +4048,151 @@ void saveSelectedMessagesBodyAsFileToolStripMenuItem_Click(object sender, EventA } } - private void saveSelectedDeadletteredMessageToolStripMenuItem_Click(object sender, EventArgs e) + void saveSelectedSharedDeadletteredMessageToolStripMenuItem_Click(object sender, EventArgs e) { - try - { - if (currentDeadletterMessageRowIndex < 0) - { - return; - } + SaveSelectedMessage(SaveInJsonFormat: true); + } - var bindingList = deadletterBindingSource.DataSource as BindingList; - if (bindingList == null) - { - return; - } - if (string.IsNullOrWhiteSpace(txtDeadletterText.Text)) - { - return; - } - saveFileDialog.RestoreDirectory = true; - saveFileDialog.Title = SaveAsTitle; - saveFileDialog.DefaultExt = JsonExtension; - saveFileDialog.Filter = JsonFilter; - saveFileDialog.FileName = CreateFileName(); - if (saveFileDialog.ShowDialog() != DialogResult.OK || - string.IsNullOrWhiteSpace(saveFileDialog.FileName)) - { - return; - } - if (File.Exists(saveFileDialog.FileName)) - { - File.Delete(saveFileDialog.FileName); - } - using (var writer = new StreamWriter(saveFileDialog.FileName)) - { - writer.Write(MessageSerializationHelper.Serialize(bindingList[currentDeadletterMessageRowIndex], txtDeadletterText.Text)); - } - } - catch (Exception ex) - { - HandleException(ex); - } + void saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveSelectedMessage(SaveInJsonFormat: false); } - void saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem_Click(object sender, EventArgs e) + void saveSelectedSharedDeadletteredMessagesToolStripMenuItem_Click(object sender, EventArgs e) { - try - { - if (currentDeadletterMessageRowIndex < 0) - { - return; - } + SaveSelectedMessages(SaveInJsonFormat: true); + } - var bindingList = deadletterBindingSource.DataSource as BindingList; - if (bindingList == null) - { - return; - } + void saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveSelectedMessages(SaveInJsonFormat: false); + } - if (string.IsNullOrWhiteSpace(txtDeadletterText.Text)) - { - return; - } - saveFileDialog.RestoreDirectory = true; - saveFileDialog.Title = SaveAsTitle; - saveFileDialog.DefaultExt = TxtExtension; - saveFileDialog.Filter = AllFilesFilter; - saveFileDialog.FileName = CreateFileNameAutoRecognize(); - if (saveFileDialog.ShowDialog() != DialogResult.OK || - string.IsNullOrWhiteSpace(saveFileDialog.FileName)) - { - return; - } + void SaveSelectedMessage(bool SaveInJsonFormat) + { + var activeGridView = GetActiveDeadletterGridView(); - if (File.Exists(saveFileDialog.FileName)) - { - File.Delete(saveFileDialog.FileName); - } + var currentRowIndex = activeGridView == deadletterDataGridView + ? currentDeadletterMessageRowIndex + : currentTransferDeadletterMessageRowIndex; - using (var writer = new StreamWriter(saveFileDialog.FileName)) - { - writer.Write(txtDeadletterText.Text); - } + if (currentRowIndex < 0) + { + return; } - catch (Exception ex) + + var bindingSource = activeGridView == deadletterDataGridView + ? deadletterBindingSource + : transferDeadletterBindingSource; + + var bindingList = bindingSource.DataSource as BindingList; + + if (bindingList == null) { - HandleException(ex); + return; } - } - private void saveSelectedDeadletteredMessagesToolStripMenuItem_Click(object sender, EventArgs e) - { - try + var text = activeGridView == deadletterDataGridView + ? txtDeadletterText.Text + : txtTransferDeadletterText.Text; + + if (string.IsNullOrWhiteSpace(text)) + { + return; + } + + saveFileDialog.RestoreDirectory = true; + saveFileDialog.Title = SaveAsTitle; + + if (SaveInJsonFormat) { - if (deadletterDataGridView.SelectedRows.Count <= 0) - { - return; - } - var messages = deadletterDataGridView.SelectedRows.Cast() - .Select(r => r.DataBoundItem as BrokeredMessage); - IEnumerable brokeredMessages = messages as BrokeredMessage[] ?? messages.ToArray(); - if (!brokeredMessages.Any()) - { - return; - } - saveFileDialog.RestoreDirectory = true; - saveFileDialog.Title = SaveAsTitle; saveFileDialog.DefaultExt = JsonExtension; saveFileDialog.Filter = JsonFilter; saveFileDialog.FileName = CreateFileName(); - if (saveFileDialog.ShowDialog() != DialogResult.OK || - string.IsNullOrWhiteSpace(saveFileDialog.FileName)) - { - return; - } - if (File.Exists(saveFileDialog.FileName)) - { - File.Delete(saveFileDialog.FileName); - } - using (var writer = new StreamWriter(saveFileDialog.FileName)) - { - var bodies = brokeredMessages.Select(bm => serviceBusHelper.GetMessageText(bm, - MainForm.SingletonMainForm.UseAscii, out _)); - writer.Write(MessageSerializationHelper.Serialize(brokeredMessages, bodies, doNotSerializeBody: true)); - } } - catch (Exception ex) + else { - HandleException(ex); + saveFileDialog.DefaultExt = TxtExtension; + saveFileDialog.Filter = AllFilesFilter; + saveFileDialog.FileName = CreateFileNameAutoRecognize(); } - } - void saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem_Click(object sender, EventArgs e) - { - try + if (saveFileDialog.ShowDialog() != DialogResult.OK || + string.IsNullOrWhiteSpace(saveFileDialog.FileName)) { - if (deadletterDataGridView.SelectedRows.Count <= 0) - { - return; - } + return; + } - var messages = deadletterDataGridView.SelectedRows.Cast() - .Select(r => r.DataBoundItem as BrokeredMessage); - IEnumerable brokeredMessages = messages as BrokeredMessage[] ?? messages.ToArray(); + if (File.Exists(saveFileDialog.FileName)) + { + File.Delete(saveFileDialog.FileName); + } - if (!brokeredMessages.Any()) + using (var writer = new StreamWriter(saveFileDialog.FileName)) + { + if (SaveInJsonFormat) { - return; + writer.Write(MessageSerializationHelper.Serialize(bindingList[currentRowIndex], text)); } - - saveFileDialog.RestoreDirectory = true; - saveFileDialog.Title = SaveAsTitle; - saveFileDialog.DefaultExt = TxtExtension; - saveFileDialog.Filter = AllFilesFilter; - saveFileDialog.FileName = CreateFileNameAutoRecognize(); - - if (saveFileDialog.ShowDialog() != DialogResult.OK || - string.IsNullOrWhiteSpace(saveFileDialog.FileName)) + else { - return; + writer.Write(txtDeadletterText.Text); } + } + } - var bodies = brokeredMessages.Select(bm => serviceBusHelper.GetMessageText(bm, - MainForm.SingletonMainForm.UseAscii, out _)); - var count = 0; - - foreach (var body in bodies) - { - count++; - var fileNameParts = saveFileDialog.FileName.Split('.').ToList(); - var fileExtension = fileNameParts.Last(); - fileNameParts.RemoveAt(fileNameParts.IndexOf(fileExtension)); - fileNameParts.Add($"({count}).{fileExtension}"); - var fileName = string.Join(".", fileNameParts); + void SaveSelectedMessages(bool SaveInJsonFormat) + { + var activeGridView = GetActiveDeadletterGridView(); - if (File.Exists(fileName)) - { - File.Delete(fileName); - } + var currentRowIndex = activeGridView == deadletterDataGridView + ? currentDeadletterMessageRowIndex + : currentTransferDeadletterMessageRowIndex; - using (var writer = new StreamWriter(fileName)) - { - writer.Write(body); - } - } + if (activeGridView.SelectedRows.Count <= 0) + { + return; } - catch (Exception ex) + + var messages = activeGridView.SelectedRows.Cast() + .Select(r => r.DataBoundItem as BrokeredMessage); + IEnumerable brokeredMessages = messages as BrokeredMessage[] ?? messages.ToArray(); + + if (!brokeredMessages.Any()) { - HandleException(ex); + return; } - } - private void saveSelectedTransferDeadletteredMessageToolStripMenuItem_Click(object sender, EventArgs e) - { - try + saveFileDialog.RestoreDirectory = true; + saveFileDialog.Title = SaveAsTitle; + + if (SaveInJsonFormat) { - if (currentTransferDeadletterMessageRowIndex < 0) - { - return; - } - var bindingList = transferDeadletterBindingSource.DataSource as BindingList; - if (bindingList == null) - { - return; - } - if (string.IsNullOrWhiteSpace(txtTransferDeadletterText.Text)) - { - return; - } - saveFileDialog.RestoreDirectory = true; - saveFileDialog.Title = SaveAsTitle; saveFileDialog.DefaultExt = JsonExtension; saveFileDialog.Filter = JsonFilter; saveFileDialog.FileName = CreateFileName(); - if (saveFileDialog.ShowDialog() != DialogResult.OK || - string.IsNullOrWhiteSpace(saveFileDialog.FileName)) - { - return; - } - if (File.Exists(saveFileDialog.FileName)) - { - File.Delete(saveFileDialog.FileName); - } - using (var writer = new StreamWriter(saveFileDialog.FileName)) - { - writer.Write(MessageSerializationHelper.Serialize(bindingList[currentTransferDeadletterMessageRowIndex], - txtTransferDeadletterText.Text)); - } } - catch (Exception ex) - { - HandleException(ex); - } - } - - void saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem_Click(object sender, EventArgs e) - { - try + else { - if (currentTransferDeadletterMessageRowIndex < 0) - { - return; - } - - var bindingList = transferDeadletterBindingSource.DataSource as BindingList; - if (bindingList == null) - { - return; - } - - if (string.IsNullOrWhiteSpace(txtTransferDeadletterText.Text)) - { - return; - } - - saveFileDialog.RestoreDirectory = true; - saveFileDialog.Title = SaveAsTitle; saveFileDialog.DefaultExt = TxtExtension; saveFileDialog.Filter = AllFilesFilter; saveFileDialog.FileName = CreateFileNameAutoRecognize(); - if (saveFileDialog.ShowDialog() != DialogResult.OK || - string.IsNullOrWhiteSpace(saveFileDialog.FileName)) - { - return; - } - - if (File.Exists(saveFileDialog.FileName)) - { - File.Delete(saveFileDialog.FileName); - } + } - using (var writer = new StreamWriter(saveFileDialog.FileName)) - { - writer.Write(txtTransferDeadletterText.Text); - } + if (saveFileDialog.ShowDialog() != DialogResult.OK || + string.IsNullOrWhiteSpace(saveFileDialog.FileName)) + { + return; } - catch (Exception ex) + + if (File.Exists(saveFileDialog.FileName)) { - HandleException(ex); + File.Delete(saveFileDialog.FileName); } - } - private void saveSelectedTransferDeadletteredMessagesToolStripMenuItem_Click(object sender, EventArgs e) - { - try + if (SaveInJsonFormat) { - if (transferDeadletterDataGridView.SelectedRows.Count <= 0) - { - return; - } - var messages = transferDeadletterDataGridView.SelectedRows.Cast() - .Select(r => r.DataBoundItem as BrokeredMessage); - IEnumerable brokeredMessages = messages as BrokeredMessage[] ?? messages.ToArray(); - if (!brokeredMessages.Any()) - { - return; - } - saveFileDialog.RestoreDirectory = true; - saveFileDialog.Title = SaveAsTitle; - saveFileDialog.DefaultExt = JsonExtension; - saveFileDialog.Filter = JsonFilter; - saveFileDialog.FileName = CreateFileName(); - if (saveFileDialog.ShowDialog() != DialogResult.OK || - string.IsNullOrWhiteSpace(saveFileDialog.FileName)) - { - return; - } - if (File.Exists(saveFileDialog.FileName)) - { - File.Delete(saveFileDialog.FileName); - } using (var writer = new StreamWriter(saveFileDialog.FileName)) { var bodies = brokeredMessages.Select(bm => serviceBusHelper.GetMessageText(bm, @@ -4470,43 +4200,12 @@ private void saveSelectedTransferDeadletteredMessagesToolStripMenuItem_Click(obj writer.Write(MessageSerializationHelper.Serialize(brokeredMessages, bodies, doNotSerializeBody: true)); } } - catch (Exception ex) - { - HandleException(ex); - } - } - - void saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem_Click(object sender, EventArgs e) - { - try + else { - if (transferDeadletterDataGridView.SelectedRows.Count <= 0) - { - return; - } - - var messages = transferDeadletterDataGridView.SelectedRows.Cast() - .Select(r => r.DataBoundItem as BrokeredMessage); - IEnumerable brokeredMessages = messages as BrokeredMessage[] ?? messages.ToArray(); - if (!brokeredMessages.Any()) - { - return; - } - - saveFileDialog.RestoreDirectory = true; - saveFileDialog.Title = SaveAsTitle; - saveFileDialog.DefaultExt = TxtExtension; - saveFileDialog.Filter = AllFilesFilter; - saveFileDialog.FileName = CreateFileNameAutoRecognize(); - if (saveFileDialog.ShowDialog() != DialogResult.OK || - string.IsNullOrWhiteSpace(saveFileDialog.FileName)) - { - return; - } - var bodies = brokeredMessages.Select(bm => serviceBusHelper.GetMessageText(bm, MainForm.SingletonMainForm.UseAscii, out _)); var count = 0; + foreach (var body in bodies) { count++; @@ -4526,14 +4225,8 @@ void saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem_Click(o } } } - catch (Exception ex) - { - HandleException(ex); - } } - #endregion Save Messages - private string CreateFileName() { return string.Format(MessageFileFormat, @@ -4547,6 +4240,7 @@ private string CreateFileNameAutoRecognize() CultureInfo.CurrentCulture.TextInfo.ToTitleCase(serviceBusHelper.Namespace), DateTime.Now.ToString(CultureInfo.InvariantCulture).Replace('/', '-').Replace(':', '-')); } + #endregion Save Messages private async void btnPurgeMessages_Click(object sender, EventArgs e) { @@ -4558,11 +4252,6 @@ private async void btnPurgeDeadletterQueueMessages_Click(object sender, EventArg await PurgeDeadletterQueueMessagesAsync(); } - - #endregion - - #region DataGridView methods - // Returns either the plain deadletter grid view or the transfer deadletter grid view, // depending on which tab is selected. DataGridView GetActiveDeadletterGridView() @@ -4580,6 +4269,76 @@ DataGridView GetActiveDeadletterGridView() throw new InvalidOperationException("Unexpected tab selected."); } } - #endregion + + void ShowAppropriateSharedDeadletterMenuItems(DataGridViewCellMouseEventArgs e) + { + if (e.Button != MouseButtons.Right || e.RowIndex == -1) + { + return; + } + + var activeGridView = GetActiveDeadletterGridView(); + + activeGridView.Rows[e.RowIndex].Selected = true; + var multipleSelectedRows = activeGridView.SelectedRows.Count > 1; + + repairAndResubmitSharedDeadletterToolStripMenuItem.Visible = !multipleSelectedRows; + resubmitSharedDeadletterToolStripMenuItem.Visible = !multipleSelectedRows; + saveSelectedSharedDeadletteredMessageToolStripMenuItem.Visible = !multipleSelectedRows; + saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem.Visible = !multipleSelectedRows; + deleteSelectedSharedDeadLetterMessageToolStripMenuItem.Visible = !multipleSelectedRows; + + resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem.Visible = multipleSelectedRows; + saveSelectedSharedDeadletteredMessagesToolStripMenuItem.Visible = multipleSelectedRows; + saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem.Visible = multipleSelectedRows; + deleteSelectedSharedDeadLetterMessagesToolStripMenuItem.Visible = multipleSelectedRows; + + sharedDeadletterContextMenuStrip.Show(Cursor.Position); + } + + void RepairAndResubmitSharedDeadletterMessage(DataGridViewCellEventArgs e) + { + if (e.RowIndex < 0) + { + return; + } + + var activeGridView = GetActiveDeadletterGridView(); + + var bindingList = activeGridView == deadletterDataGridView + ? deadletterBindingSource.DataSource as BindingList + : transferDeadletterBindingSource.DataSource as BindingList; + + if (bindingList == null) + { + return; + } + + using (var messageForm = new MessageForm(queueDescription, + activeGridView == deadletterDataGridView + ? MessageForm.SubqueueType.Deadletter + : MessageForm.SubqueueType.TransferDeadletter, + bindingList[e.RowIndex], + serviceBusHelper, + writeToLog)) + { + messageForm.ShowDialog(); + + Application.UseWaitCursor = true; + + try + { + if (messageForm.RemovedSequenceNumbers != null && messageForm.RemovedSequenceNumbers.Any()) + { + DataGridViewHelper.RemoveDataGridRowsUsingSequenceNumbers(activeGridView, messageForm.RemovedSequenceNumbers); + } + } + finally + { + Application.UseWaitCursor = false; + } + } + } } + #endregion } diff --git a/src/ServiceBusExplorer/Controls/HandleSubscriptionControl.cs b/src/ServiceBusExplorer/Controls/HandleSubscriptionControl.cs index c1c5c1fd..3c20a5a2 100644 --- a/src/ServiceBusExplorer/Controls/HandleSubscriptionControl.cs +++ b/src/ServiceBusExplorer/Controls/HandleSubscriptionControl.cs @@ -2383,7 +2383,7 @@ async void deleteSelectedMessagesToolStripMenuItem_Click(object sender, EventArg stopwatch.Start(); var messagesDeleteCount = sequenceNumbersToDelete.Count; - var result = await deadLetterMessageHandler.DeleteMessages(sequenceNumbersToDelete); + var result = await deadLetterMessageHandler.DeleteMessages(sequenceNumbersToDelete, TransferDLQ: false); RemoveDeadletterDataGridRows(result.DeletedSequenceNumbers); if (messagesDeleteCount > result.DeletedSequenceNumbers.Count) diff --git a/src/ServiceBusExplorer/Forms/MessageForm.cs b/src/ServiceBusExplorer/Forms/MessageForm.cs index 0a7ff931..6d1d0eb0 100644 --- a/src/ServiceBusExplorer/Forms/MessageForm.cs +++ b/src/ServiceBusExplorer/Forms/MessageForm.cs @@ -82,6 +82,8 @@ public partial class MessageForm : Form #endregion #region Private Instance Fields + SubqueueType subqueueType = SubqueueType.NotSet; + readonly IEnumerable brokeredMessages; readonly BrokeredMessage brokeredMessage; readonly ServiceBusHelper serviceBusHelper; @@ -115,6 +117,16 @@ public partial class MessageForm : Form }; #endregion + #region Public Enums + public enum SubqueueType + { + NotSet, + NotASubqueue, + Deadletter, + TransferDeadletter + } + #endregion + #region Public Properties public List RemovedSequenceNumbers { @@ -209,11 +221,12 @@ public MessageForm(BrokeredMessage brokeredMessage, ServiceBusHelper serviceBusH } } - public MessageForm(QueueDescription queueDescription, BrokeredMessage brokeredMessage, + public MessageForm(QueueDescription queueDescription, SubqueueType subqueueType, BrokeredMessage brokeredMessage, ServiceBusHelper serviceBusHelper, WriteToLogDelegate writeToLog) : this(brokeredMessage, serviceBusHelper, writeToLog) { this.queueDescription = queueDescription; + this.subqueueType = subqueueType; } public MessageForm(SubscriptionWrapper subscriptionWrapper, BrokeredMessage brokeredMessage, @@ -260,11 +273,12 @@ public MessageForm(IEnumerable brokeredMessages, ServiceBusHelp } } - public MessageForm(QueueDescription queueDescription, IEnumerable brokeredMessages, + public MessageForm(QueueDescription queueDescription, SubqueueType subqueueType, IEnumerable brokeredMessages, ServiceBusHelper serviceBusHelper, WriteToLogDelegate writeToLog) : this(brokeredMessages, serviceBusHelper, writeToLog) { this.queueDescription = queueDescription; + this.subqueueType = subqueueType; } public MessageForm(SubscriptionWrapper subscriptionWrapper, IEnumerable brokeredMessages, @@ -482,6 +496,7 @@ private async void btnSubmit_Click(object sender, EventArgs e) var sent = outboundMessages.Count; var stopwatch = new Stopwatch(); + stopwatch.Start(); if (chkRemove.Checked) @@ -489,8 +504,12 @@ private async void btnSubmit_Click(object sender, EventArgs e) var messageHandler = CreateDeadLetterMessageHandler(); var result = await messageHandler.MoveMessages(messageSender, - sequenceNumbers, outboundMessages); + sequenceNumbers, + transferDLQ: subqueueType == SubqueueType.TransferDeadletter ? true: false, + outboundMessages); + RemovedSequenceNumbers = result.DeletedSequenceNumbers; + stopwatch.Stop(); if (result.TimedOut) From e25269538c937940fc635e10e66ed9fbddad06c1 Mon Sep 17 00:00:00 2001 From: Erik Mogensen Date: Sun, 11 Feb 2024 19:35:36 +0100 Subject: [PATCH 3/4] Removed transfer DLQ context menu --- .../Controls/HandleQueueControl.Designer.cs | 248 ++++++------------ .../Controls/HandleQueueControl.cs | 5 +- .../Controls/HandleQueueControl.resx | 5 +- .../HandleSubscriptionControl.Designer.cs | 16 +- 4 files changed, 98 insertions(+), 176 deletions(-) diff --git a/src/ServiceBusExplorer/Controls/HandleQueueControl.Designer.cs b/src/ServiceBusExplorer/Controls/HandleQueueControl.Designer.cs index 52d32e5c..f486679c 100644 --- a/src/ServiceBusExplorer/Controls/HandleQueueControl.Designer.cs +++ b/src/ServiceBusExplorer/Controls/HandleQueueControl.Designer.cs @@ -123,17 +123,17 @@ private void InitializeComponent() this.saveSelectedMessageBodyAsFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveSelectedMessagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveSelectedMessagesBodyAsFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.deadletterContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); - this.repairAndResubmitDeadletterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.resubmitDeadletterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.resubmitSelectedDeadletterInBatchModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.sharedDeadletterContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.repairAndResubmitSharedDeadletterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.resubmitSharedDeadletterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.saveSelectedDeadletteredMessageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveSelectedDeadletteredMessagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.deleteSelectedMessageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.deleteSelectedMessagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveSelectedSharedDeadletteredMessageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveSelectedSharedDeadletteredMessagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.deleteSelectedSharedDeadletterMessageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.deleteSelectedSharedDeadletterMessagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.messagesBindingSource = new System.Windows.Forms.BindingSource(this.components); this.sessionsBindingSource = new System.Windows.Forms.BindingSource(this.components); this.deadletterBindingSource = new System.Windows.Forms.BindingSource(this.components); @@ -141,14 +141,6 @@ private void InitializeComponent() this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.btnPurgeMessages = new System.Windows.Forms.Button(); this.transferDeadletterBindingSource = new System.Windows.Forms.BindingSource(this.components); - this.transferDeadletterContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); - this.repairAndResubmitTransferDeadletterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.resubmitSelectedTransferDeadletterInBatchModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.saveSelectedTransferDeadletteredMessageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveSelectedTransferDeadletteredMessagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mainTabControl.SuspendLayout(); this.tabPageDescription.SuspendLayout(); this.grouperAutoDeleteOnIdle.SuspendLayout(); @@ -238,13 +230,12 @@ private void InitializeComponent() this.grouperSessionState.SuspendLayout(); this.grouperSessionProperties.SuspendLayout(); this.messagesContextMenuStrip.SuspendLayout(); - this.deadletterContextMenuStrip.SuspendLayout(); + this.sharedDeadletterContextMenuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.messagesBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.sessionsBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.deadletterBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.authorizationRulesBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.transferDeadletterBindingSource)).BeginInit(); - this.transferDeadletterContextMenuStrip.SuspendLayout(); this.SuspendLayout(); // // btnPurgeDeadletterQueueMessages @@ -1156,6 +1147,7 @@ private void InitializeComponent() this.txtMessageText.CharWidth = 8; this.txtMessageText.Cursor = System.Windows.Forms.Cursors.IBeam; this.txtMessageText.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180))))); + this.txtMessageText.Font = new System.Drawing.Font("Courier New", 9.75F); this.txtMessageText.ForeColor = System.Drawing.SystemColors.ControlText; this.txtMessageText.IsReplaceMode = false; this.txtMessageText.Location = new System.Drawing.Point(16, 32); @@ -1454,6 +1446,7 @@ private void InitializeComponent() this.txtDeadletterText.CharWidth = 8; this.txtDeadletterText.Cursor = System.Windows.Forms.Cursors.IBeam; this.txtDeadletterText.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180))))); + this.txtDeadletterText.Font = new System.Drawing.Font("Courier New", 9.75F); this.txtDeadletterText.ForeColor = System.Drawing.SystemColors.ControlText; this.txtDeadletterText.IsReplaceMode = false; this.txtDeadletterText.Location = new System.Drawing.Point(16, 32); @@ -1735,6 +1728,7 @@ private void InitializeComponent() this.txtTransferDeadletterText.CharWidth = 8; this.txtTransferDeadletterText.Cursor = System.Windows.Forms.Cursors.IBeam; this.txtTransferDeadletterText.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180))))); + this.txtTransferDeadletterText.Font = new System.Drawing.Font("Courier New", 9.75F); this.txtTransferDeadletterText.ForeColor = System.Drawing.SystemColors.ControlText; this.txtTransferDeadletterText.IsReplaceMode = false; this.txtTransferDeadletterText.Location = new System.Drawing.Point(16, 32); @@ -2098,7 +2092,7 @@ private void InitializeComponent() this.saveSelectedMessagesToolStripMenuItem, this.saveSelectedMessagesBodyAsFileToolStripMenuItem}); this.messagesContextMenuStrip.Name = "registrationContextMenuStrip"; - this.messagesContextMenuStrip.Size = new System.Drawing.Size(306, 186); + this.messagesContextMenuStrip.Size = new System.Drawing.Size(306, 164); // // repairAndResubmitMessageToolStripMenuItem // @@ -2155,91 +2149,91 @@ private void InitializeComponent() this.saveSelectedMessagesBodyAsFileToolStripMenuItem.Text = "Save Selected Messages Text as File"; this.saveSelectedMessagesBodyAsFileToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedMessagesBodyAsFileToolStripMenuItem_Click); // - // deadletterContextMenuStrip + // sharedDeadletterContextMenuStrip // - this.deadletterContextMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); - this.deadletterContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.repairAndResubmitDeadletterToolStripMenuItem, - this.resubmitDeadletterToolStripMenuItem, - this.resubmitSelectedDeadletterInBatchModeToolStripMenuItem, + this.sharedDeadletterContextMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); + this.sharedDeadletterContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.repairAndResubmitSharedDeadletterToolStripMenuItem, + this.resubmitSharedDeadletterToolStripMenuItem, + this.resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem, this.toolStripSeparator2, - this.saveSelectedDeadletteredMessageToolStripMenuItem, - this.saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem, - this.saveSelectedDeadletteredMessagesToolStripMenuItem, - this.saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem, - this.deleteSelectedMessageToolStripMenuItem, - this.deleteSelectedMessagesToolStripMenuItem}); - this.deadletterContextMenuStrip.Name = "registrationContextMenuStrip"; - this.deadletterContextMenuStrip.Size = new System.Drawing.Size(306, 208); + this.saveSelectedSharedDeadletteredMessageToolStripMenuItem, + this.saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem, + this.saveSelectedSharedDeadletteredMessagesToolStripMenuItem, + this.saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem, + this.deleteSelectedSharedDeadletterMessageToolStripMenuItem, + this.deleteSelectedSharedDeadletterMessagesToolStripMenuItem}); + this.sharedDeadletterContextMenuStrip.Name = "registrationContextMenuStrip"; + this.sharedDeadletterContextMenuStrip.Size = new System.Drawing.Size(306, 230); // - // repairAndResubmitDeadletterToolStripMenuItem + // repairAndResubmitSharedDeadletterToolStripMenuItem // - this.repairAndResubmitDeadletterToolStripMenuItem.Name = "repairAndResubmitDeadletterToolStripMenuItem"; - this.repairAndResubmitDeadletterToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.repairAndResubmitDeadletterToolStripMenuItem.Text = "Repair And Resubmit Selected Message"; - this.repairAndResubmitDeadletterToolStripMenuItem.Click += new System.EventHandler(this.repairAndResubmitDeadletterMessageToolStripMenuItem_Click); + this.repairAndResubmitSharedDeadletterToolStripMenuItem.Name = "repairAndResubmitSharedDeadletterToolStripMenuItem"; + this.repairAndResubmitSharedDeadletterToolStripMenuItem.Size = new System.Drawing.Size(305, 22); + this.repairAndResubmitSharedDeadletterToolStripMenuItem.Text = "Repair And Resubmit Selected Message"; + this.repairAndResubmitSharedDeadletterToolStripMenuItem.Click += new System.EventHandler(this.repairAndResubmitSharedDeadletterMessageToolStripMenuItem_Click); // - // resubmitDeadletterToolStripMenuItem + // resubmitSharedDeadletterToolStripMenuItem // - this.resubmitDeadletterToolStripMenuItem.Name = "resubmitDeadletterToolStripMenuItem"; - this.resubmitDeadletterToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.resubmitDeadletterToolStripMenuItem.Text = "Resubmit Selected Message"; - this.resubmitDeadletterToolStripMenuItem.ToolTipText = "Resubmits the deadletter message with unchanged body."; - this.resubmitDeadletterToolStripMenuItem.Click += new System.EventHandler(this.resubmitDeadletterMessageToolStripMenuItem_Click); + this.resubmitSharedDeadletterToolStripMenuItem.Name = "resubmitSharedDeadletterToolStripMenuItem"; + this.resubmitSharedDeadletterToolStripMenuItem.Size = new System.Drawing.Size(305, 22); + this.resubmitSharedDeadletterToolStripMenuItem.Text = "Resubmit Selected Message"; + this.resubmitSharedDeadletterToolStripMenuItem.ToolTipText = "Resubmits the deadletter message with unchanged body."; + this.resubmitSharedDeadletterToolStripMenuItem.Click += new System.EventHandler(this.resubmitSharedDeadletterMessageToolStripMenuItem_Click); // - // resubmitSelectedDeadletterInBatchModeToolStripMenuItem + // resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem // - this.resubmitSelectedDeadletterInBatchModeToolStripMenuItem.Name = "resubmitSelectedDeadletterInBatchModeToolStripMenuItem"; - this.resubmitSelectedDeadletterInBatchModeToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.resubmitSelectedDeadletterInBatchModeToolStripMenuItem.Text = "Resubmit Selected Messages In Batch Mode"; - this.resubmitSelectedDeadletterInBatchModeToolStripMenuItem.Click += new System.EventHandler(this.resubmitSelectedDeadletterMessagesInBatchModeToolStripMenuItem_Click); + this.resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem.Name = "resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem"; + this.resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem.Size = new System.Drawing.Size(305, 22); + this.resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem.Text = "Resubmit Selected Messages In Batch Mode"; + this.resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem.Click += new System.EventHandler(this.resubmitSelectedSharedDeadletterMessagesInBatchModeToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Size = new System.Drawing.Size(302, 6); // - // saveSelectedDeadletteredMessageToolStripMenuItem + // saveSelectedSharedDeadletteredMessageToolStripMenuItem // - this.saveSelectedDeadletteredMessageToolStripMenuItem.Name = "saveSelectedDeadletteredMessageToolStripMenuItem"; - this.saveSelectedDeadletteredMessageToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.saveSelectedDeadletteredMessageToolStripMenuItem.Text = "Save Selected Message"; - this.saveSelectedDeadletteredMessageToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedDeadletteredMessageToolStripMenuItem_Click); + this.saveSelectedSharedDeadletteredMessageToolStripMenuItem.Name = "saveSelectedSharedDeadletteredMessageToolStripMenuItem"; + this.saveSelectedSharedDeadletteredMessageToolStripMenuItem.Size = new System.Drawing.Size(305, 22); + this.saveSelectedSharedDeadletteredMessageToolStripMenuItem.Text = "Save Selected Message"; + this.saveSelectedSharedDeadletteredMessageToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedSharedDeadletteredMessageToolStripMenuItem_Click); // - // saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem + // saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem // - this.saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem.Name = "saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem"; - this.saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem.Text = "Save Selected Message Text as File"; - this.saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem_Click); + this.saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem.Name = "saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem"; + this.saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem.Size = new System.Drawing.Size(305, 22); + this.saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem.Text = "Save Selected Message Text as File"; + this.saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem_Click); // - // saveSelectedDeadletteredMessagesToolStripMenuItem + // saveSelectedSharedDeadletteredMessagesToolStripMenuItem // - this.saveSelectedDeadletteredMessagesToolStripMenuItem.Name = "saveSelectedDeadletteredMessagesToolStripMenuItem"; - this.saveSelectedDeadletteredMessagesToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.saveSelectedDeadletteredMessagesToolStripMenuItem.Text = "Save Selected Messages"; - this.saveSelectedDeadletteredMessagesToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedDeadletteredMessagesToolStripMenuItem_Click); + this.saveSelectedSharedDeadletteredMessagesToolStripMenuItem.Name = "saveSelectedSharedDeadletteredMessagesToolStripMenuItem"; + this.saveSelectedSharedDeadletteredMessagesToolStripMenuItem.Size = new System.Drawing.Size(305, 22); + this.saveSelectedSharedDeadletteredMessagesToolStripMenuItem.Text = "Save Selected Messages"; + this.saveSelectedSharedDeadletteredMessagesToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedSharedDeadletteredMessagesToolStripMenuItem_Click); // - // saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem + // saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem // - this.saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem.Name = "saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem"; - this.saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem.Text = "Save Selected Messages Text as File"; - this.saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem_Click); + this.saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem.Name = "saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem"; + this.saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem.Size = new System.Drawing.Size(305, 22); + this.saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem.Text = "Save Selected Messages Text as File"; + this.saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem_Click); // - // deleteSelectedMessageToolStripMenuItem + // deleteSelectedSharedDeadletterMessageToolStripMenuItem // - this.deleteSelectedMessageToolStripMenuItem.Name = "deleteSelectedMessageToolStripMenuItem"; - this.deleteSelectedMessageToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.deleteSelectedMessageToolStripMenuItem.Text = "Delete Selected Message"; - this.deleteSelectedMessageToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedDeadLetterMessageToolStripMenuItem_Click); + this.deleteSelectedSharedDeadletterMessageToolStripMenuItem.Name = "deleteSelectedSharedDeadletterMessageToolStripMenuItem"; + this.deleteSelectedSharedDeadletterMessageToolStripMenuItem.Size = new System.Drawing.Size(305, 22); + this.deleteSelectedSharedDeadletterMessageToolStripMenuItem.Text = "Delete Selected Message"; + this.deleteSelectedSharedDeadletterMessageToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedSharedDeadLetterMessageToolStripMenuItem_Click); // - // deleteSelectedMessagesToolStripMenuItem + // deleteSelectedSharedDeadletterMessagesToolStripMenuItem // - this.deleteSelectedMessagesToolStripMenuItem.Name = "deleteSelectedMessagesToolStripMenuItem"; - this.deleteSelectedMessagesToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.deleteSelectedMessagesToolStripMenuItem.Text = "Delete Selected Messages"; - this.deleteSelectedMessagesToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedDeadLetterMessagesToolStripMenuItem_Click); + this.deleteSelectedSharedDeadletterMessagesToolStripMenuItem.Name = "deleteSelectedSharedDeadletterMessagesToolStripMenuItem"; + this.deleteSelectedSharedDeadletterMessagesToolStripMenuItem.Size = new System.Drawing.Size(305, 22); + this.deleteSelectedSharedDeadletterMessagesToolStripMenuItem.Text = "Delete Selected Messages"; + this.deleteSelectedSharedDeadletterMessagesToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedSharedDeadLetterMessagesToolStripMenuItem_Click); // // btnPurgeMessages // @@ -2260,67 +2254,6 @@ private void InitializeComponent() this.btnPurgeMessages.MouseEnter += new System.EventHandler(this.button_MouseEnter); this.btnPurgeMessages.MouseLeave += new System.EventHandler(this.button_MouseLeave); // - // transferDeadletterContextMenuStrip - // - this.transferDeadletterContextMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); - this.transferDeadletterContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.repairAndResubmitTransferDeadletterToolStripMenuItem, - this.resubmitSelectedTransferDeadletterInBatchModeToolStripMenuItem, - this.toolStripSeparator3, - this.saveSelectedTransferDeadletteredMessageToolStripMenuItem, - this.saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem, - this.saveSelectedTransferDeadletteredMessagesToolStripMenuItem, - this.saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem}); - this.transferDeadletterContextMenuStrip.Name = "registrationContextMenuStrip"; - this.transferDeadletterContextMenuStrip.Size = new System.Drawing.Size(306, 142); - this.transferDeadletterContextMenuStrip.Click += new System.EventHandler(this.resubmitSelectedTransferDeadletterMessagesInBatchModeToolStripMenuItem_Click); - // - // repairAndResubmitTransferDeadletterToolStripMenuItem - // - this.repairAndResubmitTransferDeadletterToolStripMenuItem.Name = "repairAndResubmitTransferDeadletterToolStripMenuItem"; - this.repairAndResubmitTransferDeadletterToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.repairAndResubmitTransferDeadletterToolStripMenuItem.Text = "Repair and Resubmit Selected Message"; - this.repairAndResubmitTransferDeadletterToolStripMenuItem.Click += new System.EventHandler(this.repairAndResubmitTransferDeadletterMessageToolStripMenuItem_Click); - // - // resubmitSelectedTransferDeadletterInBatchModeToolStripMenuItem - // - this.resubmitSelectedTransferDeadletterInBatchModeToolStripMenuItem.Name = "resubmitSelectedTransferDeadletterInBatchModeToolStripMenuItem"; - this.resubmitSelectedTransferDeadletterInBatchModeToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.resubmitSelectedTransferDeadletterInBatchModeToolStripMenuItem.Text = "Resubmit Selected Messages In Batch Mode"; - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(302, 6); - // - // saveSelectedTransferDeadletteredMessageToolStripMenuItem - // - this.saveSelectedTransferDeadletteredMessageToolStripMenuItem.Name = "saveSelectedTransferDeadletteredMessageToolStripMenuItem"; - this.saveSelectedTransferDeadletteredMessageToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.saveSelectedTransferDeadletteredMessageToolStripMenuItem.Text = "Save Selected Message"; - this.saveSelectedTransferDeadletteredMessageToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedTransferDeadletteredMessageToolStripMenuItem_Click); - // - // saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem - // - this.saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem.Name = "saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem"; - this.saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem.Text = "Save Selected Message Text as File"; - this.saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem_Click); - // - // saveSelectedTransferDeadletteredMessagesToolStripMenuItem - // - this.saveSelectedTransferDeadletteredMessagesToolStripMenuItem.Name = "saveSelectedTransferDeadletteredMessagesToolStripMenuItem"; - this.saveSelectedTransferDeadletteredMessagesToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.saveSelectedTransferDeadletteredMessagesToolStripMenuItem.Text = "Save Selected Messages"; - this.saveSelectedTransferDeadletteredMessagesToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedTransferDeadletteredMessagesToolStripMenuItem_Click); - // - // saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem - // - this.saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem.Name = "saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem"; - this.saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem.Size = new System.Drawing.Size(305, 22); - this.saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem.Text = "Save Selected Messages Text as File"; - this.saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem_Click); - // // HandleQueueControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2431,13 +2364,12 @@ private void InitializeComponent() this.grouperSessionState.PerformLayout(); this.grouperSessionProperties.ResumeLayout(false); this.messagesContextMenuStrip.ResumeLayout(false); - this.deadletterContextMenuStrip.ResumeLayout(false); + this.sharedDeadletterContextMenuStrip.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.messagesBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.sessionsBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.deadletterBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.authorizationRulesBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.transferDeadletterBindingSource)).EndInit(); - this.transferDeadletterContextMenuStrip.ResumeLayout(false); this.ResumeLayout(false); } @@ -2508,9 +2440,9 @@ private void InitializeComponent() private System.Windows.Forms.ContextMenuStrip messagesContextMenuStrip; private System.Windows.Forms.ToolStripMenuItem repairAndResubmitMessageToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem resubmitSelectedMessagesInBatchModeToolStripMenuItem; - private System.Windows.Forms.ContextMenuStrip deadletterContextMenuStrip; - private System.Windows.Forms.ToolStripMenuItem repairAndResubmitDeadletterToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem resubmitSelectedDeadletterInBatchModeToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip sharedDeadletterContextMenuStrip; + private System.Windows.Forms.ToolStripMenuItem repairAndResubmitSharedDeadletterToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem; private System.Windows.Forms.PictureBox pictFindMessages; private System.Windows.Forms.PictureBox pictFindDeadletter; private System.Windows.Forms.PictureBox pictFindMessagesByDate; @@ -2523,8 +2455,8 @@ private void InitializeComponent() private System.Windows.Forms.SaveFileDialog saveFileDialog; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripMenuItem saveSelectedDeadletteredMessageToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveSelectedDeadletteredMessagesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveSelectedSharedDeadletteredMessageToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveSelectedSharedDeadletteredMessagesToolStripMenuItem; private System.Windows.Forms.Button btnPurgeDeadletterQueueMessages; private System.Windows.Forms.Button btnPurgeMessages; private System.Windows.Forms.TabPage tabPageTransferDeadletter; @@ -2535,14 +2467,8 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.DataGridView transferDeadletterDataGridView; private System.Windows.Forms.BindingSource transferDeadletterBindingSource; - private System.Windows.Forms.ContextMenuStrip transferDeadletterContextMenuStrip; - private System.Windows.Forms.ToolStripMenuItem repairAndResubmitTransferDeadletterToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem resubmitSelectedTransferDeadletterInBatchModeToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - private System.Windows.Forms.ToolStripMenuItem saveSelectedTransferDeadletteredMessageToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveSelectedTransferDeadletteredMessagesToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem deleteSelectedMessageToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem deleteSelectedMessagesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem deleteSelectedSharedDeadletterMessageToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem deleteSelectedSharedDeadletterMessagesToolStripMenuItem; private Grouper grouperMessageText; private FastColoredTextBoxNS.FastColoredTextBox txtMessageText; private System.Windows.Forms.SplitContainer messagePropertiesSplitContainer; @@ -2563,10 +2489,8 @@ private void InitializeComponent() private Grouper grouperTransferDeadletterCustomProperties; private System.Windows.Forms.ToolStripMenuItem saveSelectedMessageBodyAsFileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveSelectedMessagesBodyAsFileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveSelectedDeadletteredMessageBodyAsFileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveSelectedDeadletteredMessagesBodyAsFileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveSelectedTransferDeadletteredMessageBodyAsFileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveSelectedTransferDeadletteredMessagesBodyAsFileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem; private TimeSpanControl tsAutoDeleteOnIdle; private TimeSpanControl tsDefaultMessageTimeToLive; private TimeSpanControl tsLockDuration; @@ -2574,7 +2498,7 @@ private void InitializeComponent() private System.Windows.Forms.PropertyGrid messageCustomPropertyGrid; private System.Windows.Forms.PropertyGrid deadletterCustomPropertyGrid; private System.Windows.Forms.PropertyGrid transferDeadletterCustomPropertyGrid; - private System.Windows.Forms.ToolStripMenuItem resubmitDeadletterToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem resubmitSharedDeadletterToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem resubmitMessageToolStripMenuItem; } } diff --git a/src/ServiceBusExplorer/Controls/HandleQueueControl.cs b/src/ServiceBusExplorer/Controls/HandleQueueControl.cs index 087e48e8..2aa886c2 100644 --- a/src/ServiceBusExplorer/Controls/HandleQueueControl.cs +++ b/src/ServiceBusExplorer/Controls/HandleQueueControl.cs @@ -4286,12 +4286,13 @@ void ShowAppropriateSharedDeadletterMenuItems(DataGridViewCellMouseEventArgs e) resubmitSharedDeadletterToolStripMenuItem.Visible = !multipleSelectedRows; saveSelectedSharedDeadletteredMessageToolStripMenuItem.Visible = !multipleSelectedRows; saveSelectedSharedDeadletteredMessageBodyAsFileToolStripMenuItem.Visible = !multipleSelectedRows; - deleteSelectedSharedDeadLetterMessageToolStripMenuItem.Visible = !multipleSelectedRows; + deleteSelectedSharedDeadletterMessageToolStripMenuItem.Visible = !multipleSelectedRows; + resubmitSelectedSharedDeadletterInBatchModeToolStripMenuItem.Visible = multipleSelectedRows; saveSelectedSharedDeadletteredMessagesToolStripMenuItem.Visible = multipleSelectedRows; saveSelectedSharedDeadletteredMessagesBodyAsFileToolStripMenuItem.Visible = multipleSelectedRows; - deleteSelectedSharedDeadLetterMessagesToolStripMenuItem.Visible = multipleSelectedRows; + deleteSelectedSharedDeadletterMessagesToolStripMenuItem.Visible = multipleSelectedRows; sharedDeadletterContextMenuStrip.Show(Cursor.Position); } diff --git a/src/ServiceBusExplorer/Controls/HandleQueueControl.resx b/src/ServiceBusExplorer/Controls/HandleQueueControl.resx index 8f7aada8..3b5394d7 100644 --- a/src/ServiceBusExplorer/Controls/HandleQueueControl.resx +++ b/src/ServiceBusExplorer/Controls/HandleQueueControl.resx @@ -235,7 +235,7 @@ 975, 17 - + 646, 58 @@ -256,9 +256,6 @@ 146, 58 - - 390, 57 - 116 diff --git a/src/ServiceBusExplorer/Controls/HandleSubscriptionControl.Designer.cs b/src/ServiceBusExplorer/Controls/HandleSubscriptionControl.Designer.cs index db3918b1..2e2b04d2 100644 --- a/src/ServiceBusExplorer/Controls/HandleSubscriptionControl.Designer.cs +++ b/src/ServiceBusExplorer/Controls/HandleSubscriptionControl.Designer.cs @@ -1699,16 +1699,16 @@ private void InitializeComponent() this.deadletterContextMenuStrip.Name = "registrationContextMenuStrip"; this.deadletterContextMenuStrip.Size = new System.Drawing.Size(306, 186); // - // repairAndResubmitDeadletterToolStripMenuItem + // repairAndResubmitSharedDeadletterToolStripMenuItem // - this.repairAndResubmitDeadletterToolStripMenuItem.Name = "repairAndResubmitDeadletterToolStripMenuItem"; + this.repairAndResubmitDeadletterToolStripMenuItem.Name = "repairAndResubmitSharedDeadletterToolStripMenuItem"; this.repairAndResubmitDeadletterToolStripMenuItem.Size = new System.Drawing.Size(305, 22); this.repairAndResubmitDeadletterToolStripMenuItem.Text = "Repair And Resubmit Selected Message"; this.repairAndResubmitDeadletterToolStripMenuItem.Click += new System.EventHandler(this.repairAndResubmitDeadletterMessageToolStripMenuItem_Click); // - // resubmitDeadletterToolStripMenuItem + // resubmitSharedDeadletterToolStripMenuItem // - this.resubmitDeadletterToolStripMenuItem.Name = "resubmitDeadletterToolStripMenuItem"; + this.resubmitDeadletterToolStripMenuItem.Name = "resubmitSharedDeadletterToolStripMenuItem"; this.resubmitDeadletterToolStripMenuItem.Size = new System.Drawing.Size(305, 22); this.resubmitDeadletterToolStripMenuItem.Text = "Resubmit Selected Message"; this.resubmitDeadletterToolStripMenuItem.ToolTipText = "Resubmits the deadletter message with unchanged body."; @@ -1740,16 +1740,16 @@ private void InitializeComponent() this.saveSelectedDeadletteredMessagesToolStripMenuItem.Text = "Save Selected Messages"; this.saveSelectedDeadletteredMessagesToolStripMenuItem.Click += new System.EventHandler(this.saveSelectedDeadletteredMessagesToolStripMenuItem_Click); // - // deleteSelectedMessageToolStripMenuItem + // deleteSelectedSharedDeadletterMessageToolStripMenuItem // - this.deleteSelectedMessageToolStripMenuItem.Name = "deleteSelectedMessageToolStripMenuItem"; + this.deleteSelectedMessageToolStripMenuItem.Name = "deleteSelectedSharedDeadletterMessageToolStripMenuItem"; this.deleteSelectedMessageToolStripMenuItem.Size = new System.Drawing.Size(305, 22); this.deleteSelectedMessageToolStripMenuItem.Text = "Delete Selected Message"; this.deleteSelectedMessageToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedMessageToolStripMenuItem_Click); // - // deleteSelectedMessagesToolStripMenuItem + // deleteSelectedSharedDeadletterMessagesToolStripMenuItem // - this.deleteSelectedMessagesToolStripMenuItem.Name = "deleteSelectedMessagesToolStripMenuItem"; + this.deleteSelectedMessagesToolStripMenuItem.Name = "deleteSelectedSharedDeadletterMessagesToolStripMenuItem"; this.deleteSelectedMessagesToolStripMenuItem.Size = new System.Drawing.Size(305, 22); this.deleteSelectedMessagesToolStripMenuItem.Text = "Delete Selected Messages"; this.deleteSelectedMessagesToolStripMenuItem.Click += new System.EventHandler(this.deleteSelectedMessagesToolStripMenuItem_Click); From 4e62c68c121ffd6e97a551cf83ba0062be3ecfc1 Mon Sep 17 00:00:00 2001 From: Erik Mogensen Date: Tue, 13 Feb 2024 07:55:37 +0100 Subject: [PATCH 4/4] Updated after review by Sean --- .../Controls/HandleQueueControl.cs | 12 ++++++------ src/ServiceBusExplorer/Forms/MessageForm.cs | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ServiceBusExplorer/Controls/HandleQueueControl.cs b/src/ServiceBusExplorer/Controls/HandleQueueControl.cs index 2aa886c2..216fa77e 100644 --- a/src/ServiceBusExplorer/Controls/HandleQueueControl.cs +++ b/src/ServiceBusExplorer/Controls/HandleQueueControl.cs @@ -3169,7 +3169,7 @@ private void messagesDataGridView_CellDoubleClick(object sender, DataGridViewCel return; } using (var messageForm = new MessageForm(queueDescription, - MessageForm.SubqueueType.NotASubqueue, bindingList[e.RowIndex], serviceBusHelper, writeToLog)) + MessageForm.QueueType.PrimaryQueue, bindingList[e.RowIndex], serviceBusHelper, writeToLog)) { messageForm.ShowDialog(); } @@ -3323,7 +3323,7 @@ private void ResubmitSelectedMessages() using (var form = new MessageForm( queueDescription, - MessageForm.SubqueueType.NotASubqueue, + MessageForm.QueueType.PrimaryQueue, messagesDataGridView.SelectedRows.Cast() .Select(r => (BrokeredMessage)r.DataBoundItem), serviceBusHelper, writeToLog)) @@ -3453,8 +3453,8 @@ async Task ResubmitSelectedDeadletterMessages(DataGridView dataGridView) using (var form = new MessageForm( queueDescription, dataGridView == deadletterDataGridView - ? MessageForm.SubqueueType.Deadletter - : MessageForm.SubqueueType.TransferDeadletter, + ? MessageForm.QueueType.Deadletter + : MessageForm.QueueType.TransferDeadletter, dataGridView.SelectedRows.Cast() .Select(r => (BrokeredMessage)r.DataBoundItem), serviceBusHelper, writeToLog)) @@ -4317,8 +4317,8 @@ void RepairAndResubmitSharedDeadletterMessage(DataGridViewCellEventArgs e) using (var messageForm = new MessageForm(queueDescription, activeGridView == deadletterDataGridView - ? MessageForm.SubqueueType.Deadletter - : MessageForm.SubqueueType.TransferDeadletter, + ? MessageForm.QueueType.Deadletter + : MessageForm.QueueType.TransferDeadletter, bindingList[e.RowIndex], serviceBusHelper, writeToLog)) diff --git a/src/ServiceBusExplorer/Forms/MessageForm.cs b/src/ServiceBusExplorer/Forms/MessageForm.cs index 6d1d0eb0..40a15d12 100644 --- a/src/ServiceBusExplorer/Forms/MessageForm.cs +++ b/src/ServiceBusExplorer/Forms/MessageForm.cs @@ -82,7 +82,7 @@ public partial class MessageForm : Form #endregion #region Private Instance Fields - SubqueueType subqueueType = SubqueueType.NotSet; + QueueType queueType = QueueType.NotSet; readonly IEnumerable brokeredMessages; readonly BrokeredMessage brokeredMessage; @@ -118,10 +118,10 @@ public partial class MessageForm : Form #endregion #region Public Enums - public enum SubqueueType + public enum QueueType { NotSet, - NotASubqueue, + PrimaryQueue, Deadletter, TransferDeadletter } @@ -221,12 +221,12 @@ public MessageForm(BrokeredMessage brokeredMessage, ServiceBusHelper serviceBusH } } - public MessageForm(QueueDescription queueDescription, SubqueueType subqueueType, BrokeredMessage brokeredMessage, + public MessageForm(QueueDescription queueDescription, QueueType queueType, BrokeredMessage brokeredMessage, ServiceBusHelper serviceBusHelper, WriteToLogDelegate writeToLog) : this(brokeredMessage, serviceBusHelper, writeToLog) { this.queueDescription = queueDescription; - this.subqueueType = subqueueType; + this.queueType = queueType; } public MessageForm(SubscriptionWrapper subscriptionWrapper, BrokeredMessage brokeredMessage, @@ -273,12 +273,12 @@ public MessageForm(IEnumerable brokeredMessages, ServiceBusHelp } } - public MessageForm(QueueDescription queueDescription, SubqueueType subqueueType, IEnumerable brokeredMessages, + public MessageForm(QueueDescription queueDescription, QueueType queueType, IEnumerable brokeredMessages, ServiceBusHelper serviceBusHelper, WriteToLogDelegate writeToLog) : this(brokeredMessages, serviceBusHelper, writeToLog) { this.queueDescription = queueDescription; - this.subqueueType = subqueueType; + this.queueType = queueType; } public MessageForm(SubscriptionWrapper subscriptionWrapper, IEnumerable brokeredMessages, @@ -505,7 +505,7 @@ private async void btnSubmit_Click(object sender, EventArgs e) var result = await messageHandler.MoveMessages(messageSender, sequenceNumbers, - transferDLQ: subqueueType == SubqueueType.TransferDeadletter ? true: false, + transferDLQ: queueType == QueueType.TransferDeadletter, outboundMessages); RemovedSequenceNumbers = result.DeletedSequenceNumbers;