public ConversationViewModel(WTalk.Model.Conversation conversation, Client client) { this._innerConversation = conversation; this._innerConversation.NewMessageReceived += _innerConversation_NewMessageReceived; this._client = client; SendMessageCommand = new RelayCommand <object>((p) => SendMessage(p.ToString())); SetFocusCommand = new RelayCommand(() => SetFocus()); DeleteConversationCommand = new RelayCommand(() => DeleteConversation()); SetOTRCommand = new RelayCommand(() => SetOTR()); }
public ConversationViewModel(WTalk.Model.Conversation conversationCache, Client client) { this.Participant = conversationCache.Participants.Values.FirstOrDefault(c=>c.Id != client.CurrentUser.id.chat_id); this.Messages = new ObservableCollection<Message>(conversationCache.MessagesHistory); _lastMessage = this.Messages.LastOrDefault(); this._conversationCache = conversationCache; this._client = client; this._client.NewConversationEventReceived += _client_NewConversationEventReceived; SendMessageCommand = new RelayCommand((p) => SendMessage(p.ToString())); SetFocusCommand = new RelayCommand((p) => SetFocus(_conversationCache.Id)); }
public ConversationViewModel(WTalk.Model.Conversation conversationCache, Client client) { this.Participant = conversationCache.Participants.Values.FirstOrDefault(c => c.Id != client.CurrentUser.id.chat_id); this.Messages = new ObservableCollection <Message>(conversationCache.MessagesHistory); _lastMessage = this.Messages.LastOrDefault(); this._conversationCache = conversationCache; this._client = client; this._client.NewConversationEventReceived += _client_NewConversationEventReceived; SendMessageCommand = new RelayCommand((p) => SendMessage(p.ToString())); SetFocusCommand = new RelayCommand((p) => SetFocus(_conversationCache.Id)); }
public ConversationViewModel(WTalk.Model.Conversation conversation, Client client) : this(client) { this.Conversation = conversation; this.Conversation.NewMessageReceived += Conversation_NewMessageReceived; this.Contact = client.GetContactFromCache(conversation.Participants.Where(c => c.Key != client.CurrentUser.Id).FirstOrDefault().Key).Result; if (this.Contact != null) { _name = this.Contact.DisplayName; } else { _name = "Unknown User"; } }
void _client_NewConversationCreated(object sender, Conversation e) { ActiveContacts.Add(new ConversationViewModel(e, _client)); reorderContacts(); }
void _client_NewMessageReceived(object sender, Conversation e) { App.Current.Dispatcher.Invoke(() => { if (!App.Current.MainWindow.IsActive) App.Current.MainWindow.FlashWindow(); }); reorderContacts(); }