public void GetDeadletterMessages()
 {
     using (var receiveModeForm = new ReceiveModeForm(RetrieveMessagesFromDeadletterQueue, MainForm.SingletonMainForm.TopCount, serviceBusHelper.BrokeredMessageInspectors.Keys))
     {
         if (receiveModeForm.ShowDialog() == DialogResult.OK)
         {
             txtDeadletterText.Text = string.Empty;
             deadletterPropertyListView.Items.Clear();
             deadletterPropertyGrid.SelectedObject = null;
             var messageInspector = !string.IsNullOrEmpty(receiveModeForm.Inspector) &&
                                    serviceBusHelper.BrokeredMessageInspectors.ContainsKey(receiveModeForm.Inspector) ?
                                    Activator.CreateInstance(serviceBusHelper.BrokeredMessageInspectors[receiveModeForm.Inspector]) as IBrokeredMessageInspector :
                                    null;
             if (subscriptionWrapper.TopicDescription.EnablePartitioning)
             {
                 ReadDeadletterMessagesOneAtTheTime(receiveModeForm.Peek, receiveModeForm.All, receiveModeForm.Count, messageInspector);
             }
             else
             {
                 GetDeadletterMessages(receiveModeForm.Peek, receiveModeForm.All, receiveModeForm.Count, messageInspector);
             }
         }
     }
 }
 public void GetMessages()
 {
     using (var receiveModeForm = new ReceiveModeForm(RetrieveMessagesFromQueue, MainForm.SingletonMainForm.TopCount, serviceBusHelper.BrokeredMessageInspectors.Keys))
     {
         if (receiveModeForm.ShowDialog() == DialogResult.OK)
         {
             txtMessageText.Text = string.Empty;
             messagePropertyListView.Items.Clear();
             messagePropertyGrid.SelectedObject = null;
             var messageInspector = !string.IsNullOrEmpty(receiveModeForm.Inspector) && 
                                    serviceBusHelper.BrokeredMessageInspectors.ContainsKey(receiveModeForm.Inspector) ?
                                    Activator.CreateInstance(serviceBusHelper.BrokeredMessageInspectors[receiveModeForm.Inspector]) as IBrokeredMessageInspector :
                                    null;
             GetMessages(receiveModeForm.Peek, receiveModeForm.All, receiveModeForm.Count, messageInspector);
         }
     }
 }