public void AddChatUser(Guid guid, string name) { System.Diagnostics.Debug.WriteLine("Adding chatuser " + guid.ToString()); ChatUserModel entry = new ChatUserModel(guid, name); if (!chatUsers.Contains(entry)) { System.Diagnostics.Debug.WriteLine("added user " + name); this.chatUsers.Add(entry); } }
/// <summary> /// Event handler which is triggered when the user selection in the UI changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ui_UserList_SelectionChanged(object sender, SelectionChangedEventArgs e) { ChatUserModel selectedUser = e.AddedItems[0] as ChatUserModel; if (selectedUser == null) System.Diagnostics.Debug.WriteLine("Couldn't cast eventargs to UserModel"); else { RemoteReference userReference; if (this.chatUsers.TryGetValue(selectedUser.guid, out userReference)) { currentPartner = userReference; currentPartnerModel = selectedUser; } else System.Diagnostics.Debug.WriteLine("Couldn't find selected user " + selectedUser.guid.ToString()); } }
/// <summary> /// Join the chat with a certain user. Will change switch to the communication page. /// </summary> /// <param name="partner">Partner with whom we want to chat</param> /// <param name="partnerModel">The model of our current partner</param> /// private void JoinChat(RemoteReference partner, ChatUserModel partnerModel) { this.currentPartner = partner; this.currentPartnerModel = partnerModel; partner.AsyncInvoke("EnteredChatNotification", this.myChatUser.GetName()); Frame.Navigate(typeof(CommunicationPage), new PageInformation(partner, partnerModel.nickname, this.myChatUser)); }
/// <summary> /// Join the chat with a certain user. Will change switch to the communication page. /// </summary> /// <param name="partner">Partner with whom we want to chat</param> /// <param name="partnerModel">The model of our current partner</param> private void JoinChat(RemoteReference partner, ChatUserModel partnerModel) { this.currentPartner = partner; this.currentPartnerModel = partnerModel; PhoneApplicationService.Current.State["CurrentPartner"] = partner; PhoneApplicationService.Current.State["PartnerNickname"] = partnerModel.nickname; PhoneApplicationService.Current.State["MyChatUser"] = this.myChatUser; partner.AsyncInvoke("EnteredChatNotification", this.myChatUser.GetName()); NavigationService.Navigate(communicationPageURI); }