private void ChatAddButton_Click(object sender, RoutedEventArgs e) { ChatEntryDialog chatEntryDialog = new ChatEntryDialog(); if (chatEntryDialog.ShowDialog() == true) { ChatGroup newChat = new ChatGroup(chatEntryDialog.ResponseName, chatEntryDialog.ResponseId); chatGroupList.Add(newChat); } else { //The user canceled the dialog } }
private void RemoveEventButton_Click(object sender, RoutedEventArgs e) { MessageBoxResult response = MessageBox.Show("Remove event? \n Action cannot be undone.", "Remove Event", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (response == MessageBoxResult.Yes) { ChatGroup chatGroup = (ChatGroup)ChatListBox.SelectedItem; chatGroup.RemoveEvent((Event)EventListBox.SelectedItem); ClearEventInfo(); } else { //The user clicked no } }
private void AddEventButton_Click(object sender, RoutedEventArgs e) { EventDialog eventDialog = new EventDialog(); if (eventDialog.ShowDialog() == true) { ChatGroup chatGroup = (ChatGroup)ChatListBox.SelectedItem; Event newEvent = new Event(eventDialog.ResponseName, eventDialog.ResponseDate, chatGroup.chatId); chatGroup.AddEvent(newEvent); } else { //The user canceled the dialog } }
private void ChatListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ChatListBox.SelectedIndex == -1 || ChatListBox.SelectedItem == null) { DisableInfoPanel(); return; } EnableInfoPanel(); ChatGroup chatGroup = (ChatGroup)ChatListBox.SelectedItem; ChatNameTextBox.Text = chatGroup.chatName; ChatIdTextBox.Text = chatGroup.chatId.ToString(); EventListBox.ItemsSource = chatGroup.eventList; }