public void deleteRequest(int id, EmailView email, ReadMail requestWindow) { if (id == 0) { if (MessageBox.Show("Are you sure you want to delete selected email?", "Delete email", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { // FIXME: porque nao pode ser só um for? // para cada um dos objectos selecionados adicionar ao array ArrayList tmpArr = new ArrayList(); foreach (object obj in listViewInbox.Items) { if (((EmailView)obj).Equals(email)) { tmpArr.Add(obj); } } foreach (object obj in tmpArr.ToArray()) { listViewInbox.Items.Remove(obj); } } else { requestWindow.Show(); } } else if (id == 1) { if (MessageBox.Show("Are you sure you want to delete selected email?", "Delete email", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { // FIXME: porque nao pode ser só um for? // para cada um dos objectos selecionados adicionar ao array ArrayList tmpArr = new ArrayList(); foreach (object obj in listViewSent.Items) { if (((EmailView)obj).Equals(email)) { tmpArr.Add(obj); } } foreach (object obj in tmpArr.ToArray()) { listViewSent.Items.Remove(obj); } } else { requestWindow.Show(); } } }
private void sentReadButton_Click(object sender, RoutedEventArgs e) { if (listViewSent.SelectedItems.Count > 0) { listViewSent.UnselectAll(); ReadMail tmp = new ReadMail(this, sentLastSelectedItem, 0); tmp.Show(); } else { MessageBox.Show("Please select an email first and the click the Read button", "No email selected", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void listViewSent_MouseDoubleClick(object sender, MouseButtonEventArgs e) { listViewSent.UnselectAll(); ReadMail tmp = new ReadMail(this, sentLastSelectedItem, 1); tmp.Show(); }