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); }
internal static int GetActivityColumnBlockWidth(WindowlessControlScale scale, int delta) { switch (scale) { case WindowlessControlScale.Normal: return(delta * ExecutionCellControl.GetDefaultBlock(scale) + (delta - 1) * GetControlSize(scale).Width + 10); case WindowlessControlScale.Small: return(delta * ExecutionCellControl.GetDefaultBlock(scale) + (delta - 1) * GetControlSize(scale).Width + 6); case WindowlessControlScale.XSmall: return(delta * ExecutionCellControl.GetDefaultBlock(scale) + (delta - 1) * GetControlSize(scale).Width + 4); default: return(0); } }
internal static Point GetCrossMessageExchangeConnectionPoint(ExecutionCellControl ctrl, WindowlessControlScale scale, bool isLeft) { if (ctrl != null) { Point location = ctrl.Location; switch (scale) { case WindowlessControlScale.Normal: if (isLeft) { location.Offset(0, 7); } else { location.Offset(ctrl.Size.Width, 7); } break; case WindowlessControlScale.Small: if (isLeft) { location.Offset(0, 4); } else { location.Offset(ctrl.Size.Width, 4); } break; case WindowlessControlScale.XSmall: if (isLeft) { location.Offset(0, 3); } else { location.Offset(ctrl.Size.Width, 3); } break; } return(location); } return(new Point(0, 0)); }
public TraceRecordCellControl(TraceRecordCellItem traceItem, IWindowlessControlContainer parentContainer, Point location, ActivityColumnItem activityColumnItem, ExecutionCellControl executionCellCtrl, IErrorReport errorReport) : base(2, parentContainer.GetCurrentScale(), parentContainer, location, errorReport) { currentTraceRecordItem = traceItem; this.executionCellCtrl = executionCellCtrl; currentActivityColumnItem = activityColumnItem; isToChildActivity = (CurrentTraceRecordItem != null && CurrentTraceRecordItem.IsToChildTransferTrace); if (activityColumnItem.IsActiveActivity) { base.BackColor = activeBackColor; } else if (activityColumnItem.PairedActivityIndex == 0) { base.BackColor = defaultBackColor; } else { base.BackColor = base.Container.GetRandColorByIndex(activityColumnItem.PairedActivityIndex); } base.Size = GetControlSize(base.Scale); switch (base.Scale) { case WindowlessControlScale.Normal: base.FontSize = 8f; break; case WindowlessControlScale.Small: base.FontSize = 6f; break; case WindowlessControlScale.XSmall: base.FontSize = 3f; break; } if (currentTraceRecordItem != null) { currentTraceRecordItem.RelatedActivityItem.IncrementDrawnTraceRecordItemCount(); } if (isToChildActivity && CurrentTraceRecordItem.CurrentTraceRecord != null && CurrentTraceRecordItem.CurrentTraceRecord.IsTransfer && CurrentTraceRecordItem.CurrentTraceRecord.ActivityID != CurrentTraceRecordItem.CurrentTraceRecord.RelatedActivityID) { TraceTransferExpandableIconControl item = new TraceTransferExpandableIconControl(base.Container, this, base.ErrorReport); base.ChildControls.Add(item); } }
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); }
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)); } }