private void CreateConversationNodes(string selectedId, IEnumerable <MessageNode> relatedNodes)
        {
            foreach (var node in relatedNodes)
            {
                if (string.Equals(node.Message.Id, selectedId, StringComparison.InvariantCultureIgnoreCase))
                {
                    _originalSelectionId = selectedId;
                    SelectedMessage      = node;
                }

                _nodeMap.TryAdd(node.Message.Id, node);
                Diagram.Nodes.Add(node);
            }
        }
        public async void Handle(SelectedMessageChanged @event)
        {
            if (_loadingConversation)
            {
                return;
            }

            _loadingConversation = true;
            _originalSelectionId = string.Empty;
            _nodeMap.Clear();

            SelectedMessage = null;
            Diagram         = new MessageFlowDiagram();

            var storedMessage = @event.Message;

            if (storedMessage == null)
            {
                _loadingConversation = false;
                return;
            }

            var conversationId = storedMessage.ConversationId;

            if (conversationId == null)
            {
                _loadingConversation = false;
                return;
            }

            try
            {
                var relatedMessagesTask = await _serviceControl.GetConversationById(conversationId);

                var nodes = relatedMessagesTask.ConvertAll(CreateMessageNode);

                CreateConversationNodes(storedMessage.Id, nodes);
                LinkConversationNodes(nodes);
                UpdateLayout();
            }
            finally
            {
                _loadingConversation = false;
            }
        }
        private void AddConnection(MessageNode parentNode, MessageNode childNode)
        {
            var fromPoint = new DiagramConnectionPoint(parentNode, Edge.Bottom);
            var toPoint   = new DiagramConnectionPoint(childNode, Edge.Top);

            parentNode.ConnectionPoints.Add(fromPoint);
            childNode.ConnectionPoints.Add(toPoint);

            DiagramConnection connection;

            if (childNode.IsPublished)
            {
                connection = new EventConnection(fromPoint, toPoint);
            }
            else
            {
                connection = new CommandConnection(fromPoint, toPoint);
            }

            Diagram.Connections.Add(connection);
        }
示例#4
0
 public SearchMessageEventArgs(MessageNode message)
 {
     this.MessageNode = message;
 }
 public void Handle(SelectedMessageChanged message)
 {
     SelectedMessage = null;
     _nodeMap.Clear();
     Diagram = new MessageFlowDiagram();
 }
 public SearchMessageEventArgs(MessageNode message)
 {
     this.MessageNode = message;
 }