// Go to a new chatpage private void CreateChat_MouseDown(object sender, MouseButtonEventArgs e) { overlay.Visibility = Visibility.Collapsed; decideOnProfile.Visibility = Visibility.Collapsed; ChatPage chat = new ChatPage(ClickedUser); NavigationService.Navigate(chat); }
// Receives the id of the user and opens a new chat page private void OpenChat_MouseDown(object sender, MouseButtonEventArgs e) { var clickedChat = e.Source as FrameworkElement; // get the element that is clicked on and store this in the temp var string idOfClick = clickedChat.Name; idOfClick = idOfClick.Replace("_", ""); // _ is removed from the string UserData chatPartner = MatchmakerAPI_Client.DeserializeUserData(MatchmakerAPI_Client.GetUserData(int.Parse(idOfClick))); // get the userdata from the database ChatPage chat = new ChatPage(chatPartner); NavigationService.Navigate(chat); }
//When a chat is selected and the go-to-chat-button is pressed, go to the chat private void btnGoToChat_Click(object sender, RoutedEventArgs e) { object user = NotificationList.SelectedItem; if (user == null) { MessageBox.Show("Please select a notification!", ""); } else { ChatPage chatPage = new ChatPage((user as Notification).user); chatPage.InitializeComponent(); NavigationService.Navigate(chatPage); } }