private ViewChatUser GetViewChatUser(ChatUser chatUser) { try { ViewChatUser user; if (!_allViewChatUsers.ContainsKey(chatUser.Bare)) { user = new ViewChatUser { JabberClient = _jabberClient, ChatUser = chatUser, Messages = new ObservableCollection<ChatMessage>() }; _allViewChatUsers.Add(chatUser.Bare, user); } else { user = _allViewChatUsers[chatUser.Bare]; } return user; } catch (Exception exception) { _log.Error(exception); return null; } }
private void ActivateDockItemByBare(string bare) { try { if ((Application.Current.MainWindow is MainWindow) && (Application.Current.MainWindow as MainWindow).ViewChatUsers.Any()) { _selectedViewChatUser = ViewChatUsers.FirstOrDefault(t => t.ChatUser.Bare.Equals(bare)); if (_selectedViewChatUser == null) { _selectedViewChatUser = (Application.Current.MainWindow as MainWindow).ViewChatUsers[bare]; ViewChatUsers.Insert(0, _selectedViewChatUser); OnSelectedViewChatUserChanged(); } Show(); ActivateDockItem(); } } catch (Exception exception) { _log.Error(exception); } }