public ReadMail(MainWindow parent, EmailView data, int requestId) { InitializeComponent(); this.data = data; this.parent = parent; this.Title = data.subject; this.requestId = requestId; if (this.Title.Length > 55) { this.Title = this.Title.Substring(0, 50) + "..."; } subjectLabel.Content = this.Title; fromTextbox.Text = data.email; bodyTextBox.Text = data.body; }
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 listViewSent_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (listViewSent.SelectedItem != null) { sentLastSelectedItem = (EmailView)listViewSent.SelectedItem; } }