Ejemplo n.º 1
0
        private void activityPlusBox_Click(object sender, EventArgs e)
        {
            if (sender != null && sender is PictureBox && ((PictureBox)sender).Tag != null)
            {
                PictureBox pictureBox = (PictureBox)sender;
                if (pictureBox.Tag != null && pictureBox.Tag is ActivityLabelTag)
                {
                    ActivityLabelTag activityLabelTag = (ActivityLabelTag)pictureBox.Tag;
                    switch (activityLabelTag.expectedExpandingLevel)
                    {
                    case ExpandingLevel.ExpandAll:
                    {
                        ActivityTraceModeAnalyzerParameters parameters2 = activityLabelTag.analyzer.Parameters;
                        parameters2 = ((parameters2 != null) ? new ActivityTraceModeAnalyzerParameters(parameters2) : new ActivityTraceModeAnalyzerParameters());
                        parameters2.AppendExpandingActivity(activityLabelTag.activityColumnItem.CurrentActivity.Id, ExpandingLevel.ExpandAll);
                        container.AnalysisActivityInTraceMode(activityLabelTag.analyzer.ActiveActivity, null, parameters2);
                        break;
                    }

                    case ExpandingLevel.ExpandTransferOut:
                    {
                        ActivityTraceModeAnalyzerParameters parameters = activityLabelTag.analyzer.Parameters;
                        parameters = ((parameters != null) ? new ActivityTraceModeAnalyzerParameters(parameters) : new ActivityTraceModeAnalyzerParameters());
                        parameters.AppendExpandingActivity(activityLabelTag.activityColumnItem.CurrentActivity.Id, ExpandingLevel.ExpandTransferOut);
                        container.AnalysisActivityInTraceMode(activityLabelTag.analyzer.ActiveActivity, null, parameters);
                        break;
                    }
                    }
                }
            }
        }
Ejemplo n.º 2
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);
        }