private void _addCallMenuItem_Click(object sender, EventArgs e) { using (ChooseContactDialog ccd = new ChooseContactDialog()) { ccd.ChooseContactOnly = true; if (DialogResult.OK == ccd.ShowDialog()) { AddCall(ccd.SelectedContact); } } }
private void assignMenuItem_Click(object sender, EventArgs e) { if (taskListBox.SelectedIndex >= 0) { ChooseContactDialog dialog = new ChooseContactDialog(); dialog.RestrictContacts = "[Department] = \"Field\""; dialog.Title = "Assign To"; if (dialog.ShowDialog() == DialogResult.OK) { #region Send Email to Contact // ... ali prvo provjeri ima li e-adrese! if (String.IsNullOrEmpty(dialog.SelectedContact.Email1Address)) { MessageBox.Show("Assignee lacks e-address."); return; } EmailMessage email = new EmailMessage(); email.To.Add(new Recipient(dialog.SelectedContact.Email1Address)); Task task = (Task)taskListBox.SelectedItem; email.Subject = string.Format("Task Assigned: {0}", task.Subject); email.BodyText = task.Body; // Provjeriti postoji li fotka. if (!String.IsNullOrEmpty((string)task.Properties["Photo"])) { email.Attachments.Add(new Attachment((string)task.Properties["Photo"])); } email.Send("ActiveSync"); #endregion #region Complete task task.Complete = true; task.Update(); taskListBox.Items.RemoveAt(taskListBox.SelectedIndex); #endregion #region Call Engineer if (MessageBox.Show( string.Format("Call {0} now?", dialog.SelectedContactName), "Call Ahead", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { Phone phone = new Phone(); phone.Talk(dialog.SelectedContact.BusinessTelephoneNumber); } #endregion } } }
private void BrowseContact() { var contactDialog = new ChooseContactDialog(); if (contactDialog.ShowDialog() == DialogResult.OK) Value = contactDialog.SelectedContact.ItemId.GetHashCode(); }