private void chbxUser_Checked(object sender, RoutedEventArgs e) { if (!programChanged) { SelectUsersWindow dlg = new SelectUsersWindow(users, selectedUsers); if (dlg.ShowDialog() == true) this.selectedUsers = dlg.SelectedUsers; else chbxUser.IsChecked = false; } }
private void lnkAddRecipients_MouseDown(object sender, MouseButtonEventArgs e) { List<User> contained = (from u in message.Recipients select u.User as User).ToList(); SelectUsersWindow sel = new SelectUsersWindow(users); sel.Exclude(contained); sel.ShowDialog(); if (sel.SelectedUsers.Count > 0) { try { foreach (User u in sel.SelectedUsers) message.Recipients.Add(new MessageRecipient() { User = u, MessageID = message.MessageID, IsRead = false }); message.Save(); } catch (Exception ex) { message.Recipients.Remove(sel.SelectedUsers); VisualMessageBox.Show(ex.Message, "Fehler"); } } }