Пример #1
0
 private void OnWindowlessControlExtentionEvent(object o, WindowlessControlEventArgs e)
 {
     if (o != null && e != null && e.EventType == WindowlessControlEventType.ObjectClick && o is HorzBundRowControl)
     {
         HorzBundRowControl horzBundRowControl = (HorzBundRowControl)o;
         lblDate.Text = horzBundRowControl.CurrentRowItem.Date.ToLongDateString();
     }
 }
        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);
        }
Пример #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);
            }
        }
Пример #4
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);
 }
Пример #5
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));
     }
 }