コード例 #1
0
            /// <summary>
            /// Get the label of the timeline event
            /// </summary>
            /// <returns>The list of strings and colours which need to be joined to make a label</returns>
            public List <Tuple <string, WritableRgbaFloat> > Label()
            {
                Debug.Assert(_item is not null);
                if (_cachedLabel != null && _cachedLabelTheme == Themes.ThemeVariant)
                {
                    return(_cachedLabel);
                }

                _cachedLabel      = new List <Tuple <string, WritableRgbaFloat> >();
                _cachedLabelTheme = Themes.ThemeVariant;

                WritableRgbaFloat textColour = Themes.GetThemeColourWRF(Themes.eThemeColour.WindowText);

                switch (_eventType)
                {
                case eTimelineEvent.ProcessStart:
                {
                    TraceRecord trace = (TraceRecord)_item;
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Process ({trace.PID}) Started", textColour));
                    break;
                }

                case eTimelineEvent.ProcessEnd:
                {
                    TraceRecord trace = (TraceRecord)_item;
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Process ({trace.PID}) Ended", textColour));
                    break;
                }

                case eTimelineEvent.ThreadStart:
                {
                    ProtoGraph graph = (ProtoGraph)_item;
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Thread ({graph.ThreadID}) Started", textColour));
                    break;
                }

                case eTimelineEvent.ThreadEnd:
                {
                    ProtoGraph graph = (ProtoGraph)_item;
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Thread ({graph.ThreadID}) Ended", textColour));
                    break;
                }

                case eTimelineEvent.APICall:
                {
                    Logging.APICALL call       = (Logging.APICALL)_item;
                    NodeData        n          = call.Node !;
                    var             labelitems = n.CreateColourisedSymbolCall(call.Graph, call.Index, textColour, Themes.GetThemeColourWRF(Themes.eThemeColour.Emphasis1));
                    _cachedLabel.AddRange(labelitems);
                    break;
                }

                default:
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Bad timeline event: ", textColour));
                    Debug.Assert(false, $"Bad timeline event: {_eventType}");
                    return(_cachedLabel);
                }
                return(_cachedLabel);
            }