Пример #1
0
 public ActivityColumnItem(Activity activity, ExecutionColumnItem item, int index, ActivityTraceModeAnalyzer analyzer)
 {
     currentActivity = activity;
     executionItem   = item;
     itemIndex       = index;
     this.analyzer   = analyzer;
 }
 public ExecutionColumnItem(ExecutionInfo executionInfo, Activity activeActivity, Dictionary <string, Activity> allActivities, int index, List <string> suppressedActivityIds, ActivityTraceModeAnalyzer analyzer)
 {
     currentExecutionInfo = executionInfo;
     this.activeActivity  = activeActivity;
     this.allActivities   = allActivities;
     itemIndex            = index;
     this.analyzer        = analyzer;
     if (suppressedActivityIds != null && suppressedActivityIds.Count != 0)
     {
         this.suppressedActivityIds = suppressedActivityIds;
     }
 }
Пример #3
0
        public ExecutionCellControl(ActivityTraceModeAnalyzer analyzer, ExecutionColumnItem currentExecutionColumn, HorzBundRowItem rowItem, IWindowlessControlContainer parentContainer, Point location, HorzBundRowControl horzBundRowCtrl, IErrorReport errorReport)
            : base(4, parentContainer.GetCurrentScale(), parentContainer, location, errorReport)
        {
            int i   = 0;
            int num = base.Location.X + GetDefaultBlank(base.Scale);
            Dictionary <int, TraceRecordCellItem> dictionary = new Dictionary <int, TraceRecordCellItem>();

            currentExecutionColumnItem = currentExecutionColumn;
            this.horzBundRowCtrl       = horzBundRowCtrl;
            base.Size      = GetControlSize(base.Scale, currentExecutionColumn.ActivityColumnCount);
            base.BackColor = defaultBackColor;
            foreach (TraceRecordCellItem traceRecordCellItem in rowItem.TraceRecordCellItems)
            {
                if (traceRecordCellItem.RelatedExecutionItem == currentExecutionColumn && !dictionary.ContainsKey(traceRecordCellItem.RelatedActivityItem.ItemIndex))
                {
                    dictionary.Add(traceRecordCellItem.RelatedActivityItem.ItemIndex, traceRecordCellItem);
                }
            }
            for (; i < currentExecutionColumn.ActivityColumnCount; i++)
            {
                if (dictionary.ContainsKey(i))
                {
                    TraceRecordCellControl traceRecordCellControl = new TraceRecordCellControl(dictionary[i], base.Container, new Point(num, base.Location.Y), currentExecutionColumn[i], this, base.ErrorReport);
                    base.ChildControls.Add(traceRecordCellControl);
                    if (dictionary[i].IsParentTransferTrace)
                    {
                        bool  isToLeft = (dictionary[i].RelatedActivityItem.ItemIndex >= dictionary[i].RelatedTraceRecordCellItem.RelatedActivityItem.ItemIndex) ? true : false;
                        Point interActivityConnectionPoint = GetInterActivityConnectionPoint(base.Container.GetCurrentScale(), isToLeft, traceRecordCellControl.Location);
                        ActivityTransferCellControl item   = new ActivityTransferCellControl(dictionary[i], base.Container, interActivityConnectionPoint, base.ErrorReport);
                        base.ChildControls.Add(item);
                    }
                }
                else if (currentExecutionColumn[i].WithinActivityBoundary)
                {
                    TraceRecordCellControl item2 = new TraceRecordCellControl(null, base.Container, new Point(num, base.Location.Y), currentExecutionColumn[i], this, base.ErrorReport);
                    base.ChildControls.Add(item2);
                }
                num += TraceRecordCellControl.GetControlSize(base.Scale).Width + GetDefaultBlock(base.Scale);
            }
            if (CurrentExecutionColumnItem.Analyzer.AllInvolvedExecutionItems.Count > 1)
            {
                contextMenuStrip = new ContextMenuStrip();
                ToolStripMenuItem value = new ToolStripMenuItem(SR.GetString("SL_HideProcess"));
                contextMenuStrip.Click += menuItem_Click;
                contextMenuStrip.Items.Add(value);
                disposedControls.Add(contextMenuStrip);
            }
        }
        public HorzBundRowControl(ActivityTraceModeAnalyzer analyzer, HorzBundRowItem rowItem, IWindowlessControlContainer parentContainer, Point location, IErrorReport errorReport)
            : base(5, parentContainer.GetCurrentScale(), parentContainer, location, errorReport)
        {
            base.BackColor = defaultBackColor;
            currentRowItem = rowItem;
            int width = GetTimeBoxSize(base.Scale).Width;

            width += GetDefaultBlank(base.Scale);
            int num = 0;

            foreach (ExecutionColumnItem executionColumnItem in analyzer.ExecutionColumnItems)
            {
                ExecutionCellControl item = new ExecutionCellControl(analyzer, executionColumnItem, rowItem, base.Container, new Point(width, base.Location.Y), this, base.ErrorReport);
                base.ChildControls.Add(item);
                width += ExecutionCellControl.GetControlSize(base.Scale, executionColumnItem.ActivityColumnCount).Width + GetDefaultBlock(base.Scale);
                num++;
            }
            base.FontSize = GetFontSize(base.Scale);
            base.Size     = new Size(width - GetDefaultBlock(base.Scale), GetTimeBoxSize(base.Scale).Height);
        }
Пример #5
0
 internal override bool PerformAnalysis(bool isRestoring, bool reportError)
 {
     if (base.CurrentActivity != null && base.CurrentDataSource != null)
     {
         int  num   = 0;
         int  width = 0;
         bool flag  = false;
         ActivityTraceModeAnalyzer activityTraceModeAnalyzer = null;
         try
         {
             activityTraceModeAnalyzer = new ActivityTraceModeAnalyzer(base.CurrentActivity, base.CurrentDataSource, showActivityBoundaryTracesMenuItem.Checked, showVerboseMenuItem.Checked, parameters, base.ErrorReport);
         }
         catch (TraceViewerException exception)
         {
             if (reportError)
             {
                 base.ErrorReport.ReportErrorToUser(exception);
             }
             return(false);
         }
         renderingHashCode = activityTraceModeAnalyzer.RenderingHashCode;
         currentAnalyzer   = activityTraceModeAnalyzer;
         if (currentAnalyzer.ContainsProcess)
         {
             isEmpty = false;
             foreach (HorzBundRowItem item in activityTraceModeAnalyzer)
             {
                 HorzBundRowControl horzBundRowControl = new HorzBundRowControl(activityTraceModeAnalyzer, item, base.Container, new Point(0, num), base.ErrorReport);
                 num  += horzBundRowControl.Size.Height;
                 width = horzBundRowControl.Size.Width;
             }
             if (activityTraceModeAnalyzer.MessageExchanges != null && activityTraceModeAnalyzer.MessageExchanges.Count != 0)
             {
                 foreach (MessageExchangeCellItem value in activityTraceModeAnalyzer.MessageExchanges.Values)
                 {
                     if (!flag && value.SentExecutionColumnItem.CurrentExecutionInfo.GetHashCode() == value.ReceiveExecutionColumnItem.CurrentExecutionInfo.GetHashCode())
                     {
                         flag = true;
                     }
                     new MessageExchangeCellControl(base.Container, value, base.ErrorReport);
                 }
             }
             ProbingErrorsInView();
             HorzBundTitleControl horzBundTitleControl = new HorzBundTitleControl(activityTraceModeAnalyzer, base.Container);
             horzBundTitleControl.Location = new Point(0, 0);
             base.Container.SetupTitleControl(horzBundTitleControl);
             Size size = new Size(width, num + 10);
             base.Container.SetupBodySize(size);
             base.Container.SetupTitleSize(new Size(size.Width, HorzBundTitleControl.GetDefaultHSize(base.Container.GetCurrentScale())));
             if (size.Width > 32767 || size.Height > 32767)
             {
                 base.UserInterfaceProvider.ShowMessageBox(SR.GetString("SL_OutOfSize"), null, MessageBoxIcon.Exclamation, MessageBoxButtons.OK);
             }
         }
         else
         {
             isEmpty = true;
         }
         return(true);
     }
     return(false);
 }
Пример #6
0
        private PictureBox CreatePictureBox(ActivityColumnItem activityColumnItem, ActivityTraceModeAnalyzer analyzer, WindowlessControlScale scale)
        {
            if (activityColumnItem.CurrentActivity.ActivityType == ActivityType.RootActivity)
            {
                return(null);
            }
            List <TraceRecord> list = null;

            try
            {
                list = activityColumnItem.CurrentActivity.LoadTraceRecords(true, null);
            }
            catch (LogFileException)
            {
                return(null);
            }
            Dictionary <long, TraceRecord> dictionary  = new Dictionary <long, TraceRecord>();
            Dictionary <long, TraceRecord> dictionary2 = new Dictionary <long, TraceRecord>();
            ActivityLabelTag activityLabelTag          = new ActivityLabelTag();

            activityLabelTag.activityColumnItem = activityColumnItem;
            activityLabelTag.analyzer           = analyzer;
            foreach (TraceRecord item in list)
            {
                if (ActivityTraceModeAnalyzer.IsValidForGraphFilter(item, analyzer.ContainsActivityBoundary, analyzer.ContainsVerboseTraces) && (analyzer.Parameters == null || !analyzer.Parameters.SuppressedExecutions.ContainsKey(item.Execution.ExecutionID)))
                {
                    if (item.IsTransfer)
                    {
                        dictionary.Add(item.TraceID, item);
                    }
                    else if (item.Level == TraceEventType.Error || item.Level == TraceEventType.Warning || item.Level == TraceEventType.Critical)
                    {
                        dictionary.Add(item.TraceID, item);
                    }
                    else
                    {
                        dictionary2.Add(item.TraceID, item);
                    }
                }
            }
            List <TraceRecordCellItem> resultTraceRecordItemsForActivity = analyzer.GetResultTraceRecordItemsForActivity(activityColumnItem.CurrentActivity);

            if (resultTraceRecordItemsForActivity != null && resultTraceRecordItemsForActivity.Count != 0 && dictionary.Count != 0 && dictionary2.Count != 0)
            {
                PictureBox pictureBox = new PictureBox();
                pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                pictureBox.Size     = GetExpandableIconSize(scale);
                pictureBox.Tag      = activityLabelTag;
                pictureBox.Click   += activityPlusBox_Click;
                if (dictionary.Count + dictionary2.Count != resultTraceRecordItemsForActivity.Count)
                {
                    pictureBox.Image = plusImage;
                    activityLabelTag.expectedExpandingLevel = ExpandingLevel.ExpandAll;
                    return(pictureBox);
                }
                foreach (TraceRecordCellItem item2 in resultTraceRecordItemsForActivity)
                {
                    if (item2.CurrentTraceRecord != null && dictionary2.ContainsKey(item2.CurrentTraceRecord.TraceID))
                    {
                        pictureBox.Image = minusImage;
                        activityLabelTag.expectedExpandingLevel = ExpandingLevel.ExpandTransferOut;
                        return(pictureBox);
                    }
                }
            }
            return(null);
        }
Пример #7
0
 private void SetupContextMenuForActivityTitle(Label activityLabel, ActivityColumnItem activityColumnItem, ActivityTraceModeAnalyzer analyzer, WindowlessControlScale scale)
 {
     if (activityLabel != null && activityColumnItem != null)
     {
         PictureBox pictureBox = CreatePictureBox(activityColumnItem, analyzer, scale);
         if (pictureBox != null)
         {
             Point location = activityLabel.Location;
             location.Offset(-pictureBox.Width - 1, (activityLabel.Height - pictureBox.Height) / 2);
             pictureBox.Location = location;
             mainPanel.Controls.Add(pictureBox);
             if (!activityExpandableControls.ContainsKey(activityColumnItem.CurrentActivity.Id))
             {
                 activityExpandableControls.Add(activityColumnItem.CurrentActivity.Id, pictureBox);
             }
         }
     }
 }
Пример #8
0
 public HorzBundTitleControl(ActivityTraceModeAnalyzer analyzer, IWindowlessControlContainer container)
 {
     if (analyzer != null)
     {
         InitializeComponent();
         this.container = container;
         Label value = new Label
         {
             AutoSize  = false,
             Dock      = DockStyle.Bottom,
             Height    = 1,
             BackColor = Utilities.GetColor(ApplicationColors.TitleBorder)
         };
         base.Controls.Add(value);
         WindowlessControlScale currentScale = container.GetCurrentScale();
         int num  = HorzBundRowControl.GetTimeBoxSize(currentScale).Width + HorzBundRowControl.GetDefaultBlank(currentScale);
         int num2 = num + ExecutionCellControl.GetDefaultBlank(currentScale);
         int num3 = num;
         foreach (ExecutionColumnItem executionColumnItem in analyzer.ExecutionColumnItems)
         {
             int        num4       = TraceRecordCellControl.GetControlSize(currentScale).Width *executionColumnItem.ActivityColumnCount + ExecutionCellControl.GetDefaultBlock(currentScale) * (executionColumnItem.ActivityColumnCount - 1) + 2 * ExecutionCellControl.GetDefaultBlank(currentScale);
             PictureBox pictureBox = new PictureBox();
             toolTip.SetToolTip(pictureBox, (string)pictureBox.Tag);
             pictureBox.Location    = new Point(num, 0);
             pictureBox.BorderStyle = BorderStyle.None;
             pictureBox.Image       = processTitleBackImage;
             pictureBox.SizeMode    = PictureBoxSizeMode.StretchImage;
             pictureBox.Size        = new Size(num4, GetDefaultVSize(currentScale));
             mainPanel.Controls.Add(pictureBox);
             num  += num4 + HorzBundRowControl.GetDefaultBlock(currentScale);
             num3 += num4;
             Label label = new Label();
             if (TraceViewerForm.IsThreadExecutionMode)
             {
                 label.Text = executionColumnItem.CurrentExecutionInfo.ProcessName + SR.GetString("CF_LeftB") + executionColumnItem.CurrentExecutionInfo.ThreadID + SR.GetString("CF_RightB");
             }
             else
             {
                 label.Text = executionColumnItem.CurrentExecutionInfo.ProcessName;
             }
             label.Font      = GetDefaultFont(currentScale);
             label.TextAlign = ContentAlignment.MiddleCenter;
             label.Dock      = DockStyle.Fill;
             label.BackColor = Color.Transparent;
             toolTip.SetToolTip(label, executionColumnItem.CurrentExecutionInfo.ToString());
             pictureBox.Controls.Add(label);
             for (int i = 0; i < executionColumnItem.ActivityColumnCount; i++)
             {
                 Activity currentActivity     = executionColumnItem[i].CurrentActivity;
                 Label    label2              = new Label();
                 string   activityDisplayName = TraceViewerForm.GetActivityDisplayName(currentActivity);
                 toolTip.SetToolTip(label2, activityDisplayName);
                 int       index     = -1;
                 ImageList imageList = null;
                 if (container.GetCurrentScale() != WindowlessControlScale.XSmall)
                 {
                     if (executionColumnItem[i].CurrentActivity != null && executionColumnItem[i].CurrentActivity.ActivityType == ActivityType.RootActivity)
                     {
                         imageList = TraceViewerForm.GetImageFromImageList(Images.RootActivity, out index);
                     }
                     else if (executionColumnItem[i].CurrentActivity != null && ActivityAnalyzerHelper.IsHostRelatedActivity(executionColumnItem[i].CurrentActivity))
                     {
                         imageList = ((executionColumnItem[i].CurrentActivity.ActivityType != ActivityType.ListenActivity) ? TraceViewerForm.GetImageFromImageList(Images.HostActivityIcon, out index) : TraceViewerForm.GetImageFromImageList(Images.ListenActivity, out index));
                     }
                     else if (executionColumnItem[i].CurrentActivity != null && ActivityAnalyzerHelper.IsMessageRelatedActivity(executionColumnItem[i].CurrentActivity))
                     {
                         imageList = TraceViewerForm.GetImageFromImageList(Images.MessageActivityIcon, out index);
                         if (executionColumnItem[i].CurrentActivity.ActivityType == ActivityType.UserCodeExecutionActivity)
                         {
                             imageList = TraceViewerForm.GetImageFromImageList(Images.ExecutionActivityIcon, out index);
                         }
                         else if (executionColumnItem[i].CurrentActivity.ActivityType == ActivityType.ConnectionActivity)
                         {
                             imageList = TraceViewerForm.GetImageFromImageList(Images.ConnectionActivityIcon, out index);
                         }
                     }
                     else
                     {
                         imageList = TraceViewerForm.GetImageFromImageList(Images.DefaultActivityIcon, out index);
                     }
                 }
                 if (index != -1 && imageList != null)
                 {
                     label2.ImageList  = imageList;
                     label2.ImageIndex = index;
                     label2.ImageAlign = ContentAlignment.MiddleCenter;
                 }
                 else
                 {
                     label2.Text = SR.GetString("SL_ATitle");
                 }
                 label2.BackColor    = Color.Transparent;
                 label2.DoubleClick += lblActivity_DoubleClick;
                 label2.Tag          = currentActivity;
                 label2.Font         = GetDefaultFont(currentScale);
                 label2.BorderStyle  = BorderStyle.None;
                 label2.TextAlign    = ContentAlignment.TopCenter;
                 label2.Location     = new Point(num2, GetDefaultVSize(currentScale));
                 label2.Size         = new Size(TraceRecordCellControl.GetControlSize(currentScale).Width, GetDefaultVSize(currentScale));
                 SetupContextMenuForActivityTitle(label2, executionColumnItem[i], analyzer, currentScale);
                 mainPanel.Controls.Add(label2);
                 num2 += TraceRecordCellControl.GetControlSize(currentScale).Width + ExecutionCellControl.GetDefaultBlock(currentScale);
             }
             num2 -= ExecutionCellControl.GetDefaultBlock(currentScale) - ExecutionCellControl.GetDefaultBlank(currentScale);
             num2 += HorzBundRowControl.GetDefaultBlock(currentScale) + ExecutionCellControl.GetDefaultBlank(currentScale);
         }
         if (analyzer.ExecutionColumnItems.Count > 1)
         {
             num3 += HorzBundRowControl.GetDefaultBlock(currentScale) * (analyzer.ExecutionColumnItems.Count - 1);
         }
         lblDate.Font     = new Font(WindowlessControlBase.CreateFont(HorzBundRowControl.GetFontSize(currentScale)), FontStyle.Bold);
         lblDate.Width    = HorzBundRowControl.GetTimeBoxSize(currentScale).Width;
         lblDate.Height   = GetDefaultHSize(currentScale);
         lblDate.Location = new Point(0, 10);
         container.RegisterExtentionEventListener(OnWindowlessControlExtentionEvent);
         base.Size = new Size(num3, GetDefaultHSize(currentScale));
     }
 }
 public TraceRecordCellItem(TraceRecord trace, ActivityColumnItem item, ActivityTraceModeAnalyzer analyzer)
 {
     currentTraceRecord  = trace;
     relatedActivityItem = item;
     this.analyzer       = analyzer;
 }