private void cmdOK_Click(object sender, RoutedEventArgs e) { try { var cse = new ContactsSelectedEventArgs(); foreach (var pg in lstGroups.Items.OfType <PNListBoxItem>().Where(p => p.IsChecked.HasValue && p.IsChecked.Value)) { var g = pg.Tag as _Group; var contacts = PNStatic.Contacts.Where(c => g != null && c.GroupID == g.ID); foreach (var c in contacts) { cse.Contacts.Add(c); } } if (ContactsSelected != null) { ContactsSelected(this, cse); } DialogResult = true; } catch (Exception ex) { PNStatic.LogException(ex); } }
private void cmdOK_Click(object sender, RoutedEventArgs e) { try { var cse = new ContactsSelectedEventArgs(); foreach ( var pti in lstContacts.Items.OfType<PNListBoxItem>().Where(p => p.IsChecked.HasValue && p.IsChecked.Value)) { cse.Contacts.Add(pti.Tag as PNContact); } if (ContactsSelected != null) { ContactsSelected(this, cse); } DialogResult = true; } catch (Exception ex) { PNStatic.LogException(ex); } }
private void cmdOK_Click(object sender, RoutedEventArgs e) { try { var cse = new ContactsSelectedEventArgs(); foreach ( var pti in lstContacts.Items.OfType <PNListBoxItem>().Where(p => p.IsChecked.HasValue && p.IsChecked.Value)) { cse.Contacts.Add(pti.Tag as PNContact); } if (ContactsSelected != null) { ContactsSelected(this, cse); } DialogResult = true; } catch (Exception ex) { PNStatic.LogException(ex); } }
private void cmdOK_Click(object sender, RoutedEventArgs e) { try { var cse = new ContactsSelectedEventArgs(); foreach (var pg in lstGroups.Items.OfType<PNListBoxItem>().Where(p => p.IsChecked.HasValue && p.IsChecked.Value)) { var g = pg.Tag as _Group; var contacts = PNStatic.Contacts.Where(c => g != null && c.GroupID == g.ID); foreach (var c in contacts) { cse.Contacts.Add(c); } } if (ContactsSelected != null) { ContactsSelected(this, cse); } DialogResult = true; } catch (Exception ex) { PNStatic.LogException(ex); } }
private void dlgSelectCOrG_ContactsSelected(object sender, ContactsSelectedEventArgs e) { try { var d = sender as WndSelectContacts; if (d != null) { d.ContactsSelected -= dlgSelectCOrG_ContactsSelected; } else { var gd = sender as WndSelectGroups; if (gd != null) { gd.ContactsSelected -= dlgSelectCOrG_ContactsSelected; } } var notesToSend = getSelectedNotes(); if (notesToSend == null) return; var notes = new List<string>(); var recipients = new List<string>(); if (e.Contacts.Where(cn => cn != null).Any(cn => !PNStatic.FormMain.SendNotesViaNetwork(notesToSend, cn))) { return; } if (!PNStatic.Settings.Network.NoNotificationOnSend) { foreach (var note in notesToSend) { notes.Add(note.Name); recipients.Add(note.SentTo); } PNStatic.FormMain.ShowSentNotification(notes, recipients); } } catch (Exception ex) { PNStatic.LogException(ex); } }