private Lifeline GetLifeLine(string name)
 {
     var typename = ParseType(name);
     if (!lifelines.ContainsKey(typename))
     {
         
         var lifeline = new Lifeline(typename);
        
         doc.Add(lifeline);
         lifeline.Left = last == null ? 30 : last.Right + 30;
         last = lifeline;
         lifelines.Add(typename, lifeline);
         return lifeline;
     }
     return lifelines[typename];
 }
 private Lifeline GetLifeLine(string name)
 {
     var typename = ParseType(name);
     if (!_lifelines.ContainsKey(typename))
     {
         
         var lifeline = new Lifeline(typename, GetColor(0), GetOppositeColor(0));
         lifeline.Selectable = false;
         lifeline.GoToSpot = ParseFullType(name);
         lifeline.Clicked += lifeline_Clicked;
         _doc.Add(lifeline);
         lifeline.Left = last == null ? 30 : last.Right + 30;
         last = lifeline;
         _lifelines.Add(typename, lifeline);
         return lifeline;
     }
     return _lifelines[typename];
 }
        private Lifeline RecurseElements(Chain item, Lifeline parent, bool inSetup, bool inTest, bool inTeardown)
        {

            var time = (item.TimeEnd - item.TimeStart);
            var intime = time - GetChildrenTimes(item);
            var current = GetLifeLine(item.DisplayName);
                  
            if (item.IsTest) inTest = true;
            if (item.IsSetup) inSetup = true;
            if (item.IsTeardown) inTeardown = true;
            if (!(item.DisplayName.Contains("::get_") || item.DisplayName.Contains("::set_")))
            {

                if (parent != null)
                {
                    var message = new Message(seq, parent, current, GetName(item.DisplayName) + " " + TimeFormatter.FormatTime(intime), 2, _dte, GetColor(time), GetOppositeColor(intime));
                    message.Pen = GetPenColor(inSetup, inTest, inTeardown, time);
                    message.Clicked += message_Clicked;
                    message.GoToSpot = item.Name;
                    _doc.Add(message);
                    seq++;
                }
            }
            foreach(var child in item.Children)
            {
                var childline = RecurseElements(child, current, inSetup, inTest, inTeardown);
                if (current != null && childline != current)
                {
                    if (!(item.DisplayName.Contains("::get_") || item.DisplayName.Contains("::set_")))
                    {

                        var childtime = child.TimeEnd - child.TimeStart;
                        var message = new Message(seq, childline, current, "", 1, _dte, GetColor(time), GetOppositeColor(time))
                                          {
                                              Pen = GetPenColor(inSetup, inTest, inTeardown, childtime),
                                              GoToSpot = item.Name
                                          };
                        _doc.Add(message);
                        seq++;
                    }
                }
            }
            return current;
        }
        private Lifeline RecurseElements(Chain item, Lifeline parent, bool inSetup, bool inTest, bool inTeardown)
        {
            var current = GetLifeLine(item.DisplayName);
            if (item.IsTest) inTest = true;
            if (item.IsSetup) inSetup = true;
            if (item.IsTeardown) inTeardown = true;
            if (parent != null)
            {
                var message = new Message(seq, parent, current, GetName(item.DisplayName), 1, _dte);
                message.Pen = GetPenColor(inSetup, inTest, inTeardown);
                message.Clicked += message_Clicked;
                message.GoToSpot = item.Name;
                doc.Add(message);
                seq++;
            }

            foreach(var child in item.Children)
            {
                var childline = RecurseElements(child, current, inSetup, inTest, inTeardown);
                if(current != null && childline != current)
                {
                    var message = new Message(seq, childline, current, "", 1, _dte);
                    message.Pen = GetPenColor(inSetup, inTest, inTeardown);
                    message.GoToSpot = item.Name;
                    doc.Add(message);
                    seq++;
                }
            }
            return current;
        }
Beispiel #5
0
 // convenience constructor
 public Message(float step, Lifeline from, Lifeline to, string msg, float actlen, DTE2 dte, Color color,
                Color oppositeColor)
     : this(color)
 {
     _dte = dte;
     Step = step;
     var lab = FromLabel as GoText;
     Pen = new Pen(_color);
     _msg = msg;
     if (lab != null) lab.Text = msg;
     lab.TextColor = oppositeColor;
     if (from != null) FromPort = from.Port;
     if (to != null) ToPort = to.Port;
     if (actlen > 0 && to != null)
     {
         var act = new Activation {Begin = step, End = step + actlen};
         to.Add(act);
     }
 }