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));
        }
Ejemplo n.º 2
0
 protected WindowlessControlBase(int zOrder, WindowlessControlScale scale, IWindowlessControlContainer container, Point location, IErrorReport errorReport)
 {
     ZOrder           = zOrder;
     this.container   = container;
     Scale            = scale;
     Location         = location;
     this.errorReport = errorReport;
     Container.RegisterWindowlessControl(this);
 }
        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);
            }
        }
Ejemplo n.º 4
0
        private static Size GetControlSize(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(new Size(9, 9));

            case WindowlessControlScale.Small:
                return(new Size(7, 7));

            case WindowlessControlScale.XSmall:
                return(new Size(5, 5));

            default:
                return(new Size(9, 9));
            }
        }
        internal static Size GetControlSize(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(new Size(26, 18));

            case WindowlessControlScale.Small:
                return(new Size(20, 14));

            case WindowlessControlScale.XSmall:
                return(new Size(14, 10));

            default:
                return(new Size(0, 0));
            }
        }
Ejemplo n.º 6
0
        private static Font GetDefaultFont(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(new Font(FontFamily.GenericSansSerif, 9f, FontStyle.Bold));

            case WindowlessControlScale.Small:
                return(new Font(FontFamily.GenericSansSerif, 7f, FontStyle.Bold));

            case WindowlessControlScale.XSmall:
                return(new Font(FontFamily.GenericSansSerif, 5f));

            default:
                return(new Font(FontFamily.GenericSansSerif, 8f));
            }
        }
Ejemplo n.º 7
0
        public static int GetDefaultHSize(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(60);

            case WindowlessControlScale.Small:
                return(48);

            case WindowlessControlScale.XSmall:
                return(32);

            default:
                return(0);
            }
        }
Ejemplo n.º 8
0
        public static Size GetExpandableIconSize(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(new Size(9, 9));

            case WindowlessControlScale.Small:
                return(new Size(7, 7));

            case WindowlessControlScale.XSmall:
                return(new Size(5, 5));

            default:
                return(new Size(9, 9));
            }
        }
        private static int GetBoundEmpty(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(5);

            case WindowlessControlScale.Small:
                return(4);

            case WindowlessControlScale.XSmall:
                return(3);

            default:
                return(0);
            }
        }
Ejemplo n.º 10
0
        internal static int GetDefaultBlock(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(15);

            case WindowlessControlScale.Small:
                return(10);

            case WindowlessControlScale.XSmall:
                return(6);

            default:
                return(0);
            }
        }
        private static int GetInnerBoxEdge(WindowlessControlScale scale, int width)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(width - 3);

            case WindowlessControlScale.Small:
                return(width - 2);

            case WindowlessControlScale.XSmall:
                return(width - 2);

            default:
                return(width - 1);
            }
        }
        public static float GetFontSize(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(8f);

            case WindowlessControlScale.Small:
                return(5.5f);

            case WindowlessControlScale.XSmall:
                return(3f);

            default:
                return(8f);
            }
        }
Ejemplo n.º 13
0
        internal static int GetDefaultBlank(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(30);

            case WindowlessControlScale.Small:
                return(24);

            case WindowlessControlScale.XSmall:
                return(18);

            default:
                return(0);
            }
        }
        public static int GetDefaultBlock(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(30);

            case WindowlessControlScale.Small:
                return(25);

            case WindowlessControlScale.XSmall:
                return(20);

            default:
                return(0);
            }
        }
        public static int GetDefaultBlank(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(10);

            case WindowlessControlScale.Small:
                return(8);

            case WindowlessControlScale.XSmall:
                return(6);

            default:
                return(0);
            }
        }
        private static int GetLineWidth(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(4);

            case WindowlessControlScale.Small:
                return(3);

            case WindowlessControlScale.XSmall:
                return(2);

            default:
                return(0);
            }
        }
Ejemplo n.º 17
0
        public static int GetDefaultVSize(WindowlessControlScale scale)
        {
            switch (scale)
            {
            case WindowlessControlScale.Normal:
                return(30);

            case WindowlessControlScale.Small:
                return(24);

            case WindowlessControlScale.XSmall:
                return(16);

            default:
                return(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));
            }
        }
Ejemplo n.º 19
0
        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));
            }
        }
Ejemplo n.º 20
0
        private static Point GetInterActivityConnectionPoint(WindowlessControlScale scale, bool isToLeft, Point basePoint)
        {
            Point p      = new Point(0, 0);
            Point result = basePoint;

            switch (scale)
            {
            case WindowlessControlScale.Normal:
                p = (isToLeft ? new Point(4, 6) : new Point(20, 6));
                break;

            case WindowlessControlScale.Small:
                p = (isToLeft ? new Point(3, 5) : new Point(18, 5));
                break;

            case WindowlessControlScale.XSmall:
                p = (isToLeft ? new Point(2, 3) : new Point(12, 4));
                break;
            }
            result.Offset(p);
            return(result);
        }
 protected WindowlessControlBaseExt(int zOrder, WindowlessControlScale scale, IWindowlessControlContainer container, Point p, IErrorReport errorReport)
     : base(zOrder, scale, container, p, errorReport)
 {
 }
Ejemplo n.º 22
0
 public void ResizeUI(WindowlessControlScale scale)
 {
     currentScale = scale;
     ReloadView();
 }
Ejemplo n.º 23
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));
        }
Ejemplo n.º 24
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));
     }
 }
Ejemplo n.º 25
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);
        }
Ejemplo n.º 26
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);
             }
         }
     }
 }