public async void Handle(MessageBodyLoaded @event) { var storedMessage = @event.Message as StoredMessage; if (storedMessage != null) { var conversationId = storedMessage.ConversationId; if (conversationId == null) { return; } _eventAggregator.Publish(new WorkStarted("Loading conversation data...")); var relatedMessagesTask = await _serviceControl.GetConversationById(conversationId); var nodes = relatedMessagesTask.ConvertAll(CreateMessageNode); CreateConversationNodes(storedMessage.Id, nodes); LinkConversationNodes(nodes); UpdateLayout(); _eventAggregator.Publish(new WorkFinished()); } }
public 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 = serviceControl.GetConversationById(conversationId); var nodes = relatedMessagesTask .Select(x => new MessageNode(this, x) { ShowEndpoints = ShowEndpoints }) .ToList(); CreateConversationNodes(storedMessage.Id, nodes); LinkConversationNodes(nodes); UpdateLayout(); } finally { loadingConversation = false; } }
public async Task Handle(SelectedMessageChanged @event) { var storedMessage = selection.SelectedMessage; if (storedMessage == null) { ClearState(); return; } var conversationId = storedMessage.ConversationId; if (conversationId == null) { ClearState(); return; } if (loadedConversationId == conversationId) { RefreshSelection(storedMessage.Id); return; } ClearState(); loadedConversationId = conversationId; using (workNotifier.NotifyOfWork("Loading flow...")) { var relatedMessagesTask = await serviceControl.GetConversationById(conversationId); var nodes = relatedMessagesTask .Select(x => new MessageNode(this, x) { ShowEndpoints = ShowEndpoints, IsFocused = x.Id == storedMessage.Id }) .ToList(); CreateConversationNodes(storedMessage.Id, nodes); LinkConversationNodes(nodes); UpdateLayout(); } }
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; } }
public async Task Handle(SelectedMessageChanged message) { try { var conversationId = Selection?.SelectedMessage?.ConversationId; if (string.IsNullOrEmpty(conversationId)) { ClearState(); return; } if (loadedConversationId == conversationId && DiagramItems.Any()) //If we've already displayed this diagram { RefreshSelection(); return; } var messages = (await serviceControl.GetConversationById(conversationId)).ToList(); if (messages.Count == 0) { LogTo.Warning("No messages found for conversation id {0}", conversationId); ClearState(); return; } CreateElements(messages); loadedConversationId = conversationId; RefreshSelection(); } catch (Exception ex) { ClearState(); ErrorMessage = $"There was an error processing the message data."; ReportPackage = new ReportMessageCommand.ReportMessagePackage(ex, Selection?.SelectedMessage); } }
public void Handle(SelectedMessageChanged message) { var storedMessage = message.Message; if (storedMessage == null) { return; } var conversationId = storedMessage.ConversationId; if (conversationId == null) { return; } var messages = serviceControl.GetConversationById(conversationId).ToList(); if (messages.Count == 0) { // SC is being silly LogTo.Warning("No messages found for conversation id {0}", conversationId); return; } CreateEndpoints(messages); CreateMessages(messages); donotReselect = true; SelectedMessage = Messages.FirstOrDefault(m => m.Message.MessageId == message.Message.MessageId && m.Message.TimeSent == message.Message.TimeSent && m.Message.Id == message.Message.Id); }