public void Execute() { foreach (var message in _messages) { int senderNumber = message.SenderNumber; if (!_currentContext.MessagesWindows.ContainsKey(senderNumber)) { ICommand command = _newMessagesWindowFactory(senderNumber); CommandInvoker.Execute(command); } MessagesViewModel messagesViewModel = _currentContext.MessagesWindows[senderNumber]; messagesViewModel.AddMessage(message); } }
public void AddMessage(Message msg) { vm.AddMessage(msg); }