public void SetContent(string xml, QueueItemError errorMsg = null)
        {
            Scintilla t = w32.Child as Scintilla;

              t.Text = FormatXml(xml);

              if( errorMsg != null ) {
            theGrid.RowDefinitions[1].Height = new GridLength(61);
            lbError.Text = errorMsg.Message;
            lbRetries.Text = errorMsg.Retries.ToString();

            if( errorMsg.State == QueueItemErrorState.Retry ) {
              imgError.Source = BMP_WARNING;
              //lbRetries.
              lbError.Background = BACKGROUND_WARNING;
              lbRetries.Foreground = BACKGROUND_WARNING;

            } else {
              imgError.Source = BMP_ERROR;
              lbError.Background = BACKGROUND_ERROR;
              lbRetries.Foreground = BACKGROUND_ERROR;
            }

              } else {
            theGrid.RowDefinitions[1].Height = new GridLength(0);
            //lbError.Visibility = System.Windows.Visibility.Hidden;
              }
        }
        public void SetContent(string content, MessageContentFormat contentType, QueueItemError errorMsg = null)
        {
            switch(contentType) {
            case MessageContentFormat.Xml:
              tbContent.CodeLanguage = NServiceBus.Profiler.Common.CodeParser.CodeLanguage.Xml;
              tbContent.Text = content;
              break;

            case MessageContentFormat.Json:
              tbContent.CodeLanguage = NServiceBus.Profiler.Common.CodeParser.CodeLanguage.Json;
              tbContent.Text = content;
              break;
              }

              if( errorMsg != null ) {
            theGrid.RowDefinitions[1].Height = new GridLength(61);
            lbError.Text = errorMsg.Message;
            lbRetries.Text = errorMsg.Retries.ToString();

            if( errorMsg.State == QueueItemErrorState.Retry ) {
              imgError.Source = BMP_WARNING;

              lbError.Background = BACKGROUND_WARNING;
              lbRetries.Foreground = BACKGROUND_WARNING;

            } else {
              imgError.Source = BMP_ERROR;
              lbError.Background = BACKGROUND_ERROR;
              lbRetries.Foreground = BACKGROUND_ERROR;
            }

              } else {
            theGrid.RowDefinitions[1].Height = new GridLength(0);
              }
        }
    public void SetContent(string content, MessageContentFormat contentType, QueueItemError errorMsg = null) {

      if( content.IsValid() && !content.StartsWith("**") ) {

        if( contentType == MessageContentFormat.Xml )
          tbContent.CodeLanguage = NServiceBus.Profiler.Common.CodeParser.CodeLanguage.Xml;

        else if( contentType == MessageContentFormat.Json )
          tbContent.CodeLanguage = NServiceBus.Profiler.Common.CodeParser.CodeLanguage.Json;

      } else tbContent.CodeLanguage = NServiceBus.Profiler.Common.CodeParser.CodeLanguage.Plain;

      tbContent.Text = content;

      if( errorMsg != null ) {
        theGrid.RowDefinitions[1].Height = new GridLength(61);
        lbError.Text = errorMsg.Message;
        imgStackTrace.ToolTip = errorMsg.StackTrace;
        lbRetries.Text = errorMsg.Retries.ToString();

        if( errorMsg.State == QueueItemErrorState.Retry ) {
          imgError.Source = WARNING_BMP;
          lbError.Background = WARNING_BACKGROUND;
          gsError.Background = WARNING_SPLITHANDLE;
          lbRetries.Foreground = WARNING_BACKGROUND;
        
        } else {
          imgError.Source = ERROR_BMP;
          lbError.Background = ERROR_BACKGROUND;
          gsError.Background = ERROR_SPLITHANDLE;
          lbRetries.Foreground = ERROR_BACKGROUND;
        }


      } else { 
        theGrid.RowDefinitions[1].Height = new GridLength(0);
      }

    }