private void ProbingErrorsInView() { CollectUnexpandedTransfers(); if (unexpandedTransferOutControls.Count != 0) { TraceRecordCellControl traceRecordCellControl = null; foreach (TraceRecordCellControl unexpandedTransferOutControl in unexpandedTransferOutControls) { if (unexpandedTransferOutControl.ExpandingState == ExpandingState.Collapsed) { TraceRecordSetSeverityLevel severityLevel = TraceRecordSetSeverityLevel.Normal; TraceRecord firstErrorTrace = null; ActivityAnalyzerHelper.DetectErrorOrWarningOnActivity(base.CurrentDataSource.Activities[unexpandedTransferOutControl.CurrentTraceRecordItem.CurrentTraceRecord.RelatedActivityID], base.CurrentDataSource.Activities, null, null, true, true, ref severityLevel, ref firstErrorTrace, ActivityAnalyzerHelper.INIT_ACTIVITY_TREE_DEPTH2); if (severityLevel != 0) { unexpandedTransferOutControl.CurrentTraceRecordItem.SeverityLevel = severityLevel; if (traceRecordCellControl == null) { traceRecordCellControl = unexpandedTransferOutControl; base.Container.ScrollControlIntoView(traceRecordCellControl, isCenter: true); } } } } } }
public static Size GetControlSize(WindowlessControlScale scale, TraceRecordCellItem parentTraceItem) { if (parentTraceItem.RelatedTraceRecordCellItem != null) { int itemIndex = parentTraceItem.RelatedActivityItem.ItemIndex; int itemIndex2 = parentTraceItem.RelatedTraceRecordCellItem.RelatedActivityItem.ItemIndex; int num = (itemIndex > itemIndex2) ? (itemIndex - itemIndex2) : (itemIndex2 - itemIndex); int activityColumnBlockWidth = TraceRecordCellControl.GetActivityColumnBlockWidth(scale, num); if (num > 0) { switch (scale) { case WindowlessControlScale.Normal: return(new Size(activityColumnBlockWidth, 5)); case WindowlessControlScale.Small: return(new Size(activityColumnBlockWidth, 3)); case WindowlessControlScale.XSmall: return(new Size(activityColumnBlockWidth, 3)); } } } return(new Size(0, 0)); }
private void InitializeRedrawData(TraceRecordCellControl sendCellCtrl, TraceRecordCellControl receiveCellCtrl) { boundEmpty = GetBoundEmpty(base.Container.GetCurrentScale()); if (!isInSameExecution) { startPoint = ExecutionCellControl.GetCrossMessageExchangeConnectionPoint(sendCellCtrl.ParentExecutionCellControl, base.Container.GetCurrentScale(), !isToArrow); secondPoint = startPoint; secondPoint.Offset(isToArrow ? boundEmpty : (-boundEmpty), 0); endPoint = ExecutionCellControl.GetCrossMessageExchangeConnectionPoint(receiveCellCtrl.ParentExecutionCellControl, base.Container.GetCurrentScale(), isToArrow); thirdPoint = endPoint; thirdPoint.Offset(isToArrow ? (-boundEmpty) : boundEmpty, 0); } else { startPoint = ExecutionCellControl.GetCrossMessageExchangeConnectionPoint(sendCellCtrl.ParentExecutionCellControl, base.Container.GetCurrentScale(), isToArrow); secondPoint = startPoint; secondPoint.Offset(-HorzBundRowControl.GetDefaultBlock(base.Container.GetCurrentScale()) / 2, 0); endPoint = ExecutionCellControl.GetCrossMessageExchangeConnectionPoint(receiveCellCtrl.ParentExecutionCellControl, base.Container.GetCurrentScale(), isToArrow); thirdPoint = endPoint; thirdPoint.Offset(-HorzBundRowControl.GetDefaultBlock(base.Container.GetCurrentScale()) / 2, 0); } if (isToArrow) { startPoint.Offset(-(startPoint.X - sendCellCtrl.Location.X - sendCellCtrl.Size.Width), 0); endPoint.Offset(receiveCellCtrl.Location.X - endPoint.X, 0); } else { startPoint.Offset(sendCellCtrl.Location.X - startPoint.X, 0); endPoint.Offset(-(endPoint.X - receiveCellCtrl.Location.X - receiveCellCtrl.Size.Width), 0); } lineWidth = GetLineWidth(base.Container.GetCurrentScale()); Point point = startPoint; Point point2 = secondPoint; Point point3 = thirdPoint; Point point4 = endPoint; point.Offset(0, -2); point2.Offset(0, -2); point3.Offset(0, -2); point4.Offset(0, -2); if (!isInSameExecution) { int num = Math.Abs(point2.X - point.X) + 2; int num2 = Math.Abs(point3.X - point4.X) + 2; leftRect = new Rectangle(isToArrow ? point : point4, new Size(isToArrow ? num : num2, lineWidth)); rightRect = new Rectangle(isToArrow ? point3 : point2, new Size(isToArrow ? num2 : num, lineWidth)); } else { leftRect = new Rectangle(point, new Size(Math.Abs(point2.X - point.X) + 2, lineWidth + 1)); rightRect = new Rectangle(point4, new Size(Math.Abs(point4.X - point3.X) + 2, lineWidth + 1)); } base.Location = new Point(Math.Min(startPoint.X, endPoint.X) - 8, Math.Min(startPoint.Y, endPoint.Y) - 8); Point point5 = new Point(Math.Max(startPoint.X, endPoint.X), Math.Max(startPoint.Y, endPoint.Y) + lineWidth); base.Size = new Size(point5.X - base.Location.X + 16, point5.Y - base.Location.Y + 16); }
public TraceTransferExpandableIconControl(IWindowlessControlContainer parentContainer, TraceRecordCellControl expandableCell, IErrorReport errorReport) : base(0, parentContainer.GetCurrentScale(), parentContainer, new Point(0, 0), errorReport) { base.Size = GetControlSize(parentContainer.GetCurrentScale()); Point location = expandableCell.Location; location.Offset(-base.Size.Width - 1, 2); base.Location = location; this.expandableCell = expandableCell; }
private void AddRelatedControlsForTraceRecord(TraceRecordCellControl ctrl, List <WindowlessControlBase> relatedCtrls) { if (ctrl != null && relatedCtrls != null) { foreach (WindowlessControlBase relatedCtrl in relatedCtrls) { if (!ctrl.RelatedMessageControls.Contains(relatedCtrl)) { ctrl.RelatedMessageControls.Add(relatedCtrl); } } } }
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); } }
private void ReloadView() { if (base.CurrentActivity != null && base.CurrentDataSource != null) { WindowlessControlBase topMostHighlighedControl = base.Container.GetTopMostHighlighedControl(); base.Container.ClearView(); if (PerformAnalysis(isRestoring: true, reportError: true) && topMostHighlighedControl != null && topMostHighlighedControl is TraceRecordCellControl) { TraceRecordCellControl traceRecordCellControl = (TraceRecordCellControl)topMostHighlighedControl; if (traceRecordCellControl.CurrentTraceRecordItem != null) { base.Container.SelectTraceRecordItem(traceRecordCellControl.CurrentTraceRecordItem.CurrentTraceRecord, traceRecordCellControl.CurrentActivityColumnItem.CurrentActivity.Id); } } } RefreshOptionMenuHighlightStatus(); }
private void CollectUnexpandedTransfers() { Dictionary <int, LinkedList <WindowlessControlBase> > windowlessControls = base.Container.GetWindowlessControls(); if (windowlessControls != null && windowlessControls.ContainsKey(2)) { foreach (WindowlessControlBase item in windowlessControls[2]) { if (item is TraceRecordCellControl) { TraceRecordCellControl traceRecordCellControl = (TraceRecordCellControl)item; if (traceRecordCellControl.CurrentTraceRecordItem != null && !unexpandedTransferOutControls.Contains(traceRecordCellControl) && traceRecordCellControl.ExpandingState == ExpandingState.Collapsed) { unexpandedTransferOutControls.Add(traceRecordCellControl); } } } } }
internal static Size GetControlSize(WindowlessControlScale scale, int activityCount) { int height = TraceRecordCellControl.GetControlSize(scale).Height; switch (scale) { case WindowlessControlScale.Normal: return(new Size(GetDefaultBlank(scale) * 2 + (activityCount - 1) * GetDefaultBlock(scale) + activityCount * TraceRecordCellControl.GetControlSize(scale).Width, height)); case WindowlessControlScale.Small: return(new Size(GetDefaultBlank(scale) * 2 + (activityCount - 1) * GetDefaultBlock(scale) + activityCount * TraceRecordCellControl.GetControlSize(scale).Width, height)); case WindowlessControlScale.XSmall: return(new Size(GetDefaultBlank(scale) * 2 + (activityCount - 1) * GetDefaultBlock(scale) + activityCount * TraceRecordCellControl.GetControlSize(scale).Width, height)); default: return(new Size(0, 0)); } }
public static Size GetTimeBoxSize(WindowlessControlScale scale) { int height = TraceRecordCellControl.GetControlSize(scale).Height; switch (scale) { case WindowlessControlScale.Normal: return(new Size(100, height)); case WindowlessControlScale.Small: return(new Size(70, height)); case WindowlessControlScale.XSmall: return(new Size(40, height)); default: return(new Size(0, 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)); } }