示例#1
0
        public void AddMessage(int source, int destination, string message)
        {
            _row++;
            var direction = MessageDirection.LeftToRight;

            if (source > destination)
            {
                var tmp = source;
                source      = destination;
                destination = tmp;
                direction   = MessageDirection.RightToLeft;
            }

            var arrowElement = new ArrowElement {
                Direction = direction
            };

            Grid.SetRow(arrowElement, 2);
            var grid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },

                Children =
                {
                    new TextBlock
                    {
                        HorizontalAlignment = HorizontalAlignment.Center,
                        Margin     = new Thickness(0, 0, 0, -2),
                        Text       = message,
                        Background = Brushes.White,
                    },
                    arrowElement
                }
            };

            SeqDiagPanel.SetPosition(grid,
                                     Position.Message(source, destination, _row));
            LayoutRoot.Children.Add(grid);
        }
示例#2
0
        public void AddMessage(int source, int destination, string message)
        {
            _row++;
            var direction = MessageDirection.LeftToRight;
            if (source > destination)
            {
                var tmp = source;
                source = destination;
                destination = tmp;
                direction = MessageDirection.RightToLeft;
            }

            var arrowElement = new ArrowElement { Direction = direction };
            Grid.SetRow(arrowElement, 2);
            var grid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {Height = GridLength.Auto},
                    new RowDefinition {Height = GridLength.Auto},
                },

                Children =
                {
                    new TextBlock
                    {
                        HorizontalAlignment = HorizontalAlignment.Center,
                        Margin = new Thickness(0,0,0,-2),
                        Text = message,
                        Background = Brushes.White,
                    },
                    arrowElement
                }
            };

            SeqDiagPanel.SetPosition(grid,
                Position.Message(source, destination, _row));
            LayoutRoot.Children.Add(grid);
        }