private void dgContactsList_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { try { // get the selected items Id string mId = dgContactsList.Rows[e.RowIndex].Cells[20].Value.ToString(); // open the associated form based on the selected column if (e.ColumnIndex == 7) { PhysicalAddress tHomeAddress = null; foreach (KeyValuePair <string, PhysicalAddress> pair in dHomeAddress) { if (pair.Key == mId) { tHomeAddress = (PhysicalAddress)pair.Value; } } // check for empty list and bail the event if we are if (tHomeAddress == null) { return; } Forms.PhysicalAddressForm mPhysicalAddress = new Forms.PhysicalAddressForm(tHomeAddress); mPhysicalAddress.Owner = this; mPhysicalAddress.ShowDialog(this); } if (e.ColumnIndex == 4) { PhysicalAddress tBusinessAddress = null; foreach (KeyValuePair <string, PhysicalAddress> pair in dBusinessAddress) { if (pair.Key == mId) { tBusinessAddress = (PhysicalAddress)pair.Value; } } if (tBusinessAddress == null) { return; } Forms.PhysicalAddressForm mPhysicalAddress = new Forms.PhysicalAddressForm(tBusinessAddress); mPhysicalAddress.Owner = this; mPhysicalAddress.ShowDialog(this); } if (e.ColumnIndex == 29) { PhysicalAddress tOtherAddress = null; foreach (KeyValuePair <string, PhysicalAddress> pair in dOtherAddress) { if (pair.Key == mId) { tOtherAddress = (PhysicalAddress)pair.Value; } } if (tOtherAddress == null) { return; } Forms.PhysicalAddressForm mPhysicalAddress = new Forms.PhysicalAddressForm(tOtherAddress); mPhysicalAddress.Owner = this; mPhysicalAddress.ShowDialog(this); } if (e.ColumnIndex == 3) { List <string> lBusinessPhones = null; foreach (KeyValuePair <string, List <string> > pair in dBusinessPhones) { if (pair.Key == mId) { lBusinessPhones = pair.Value; } } if (lBusinessPhones == null) { return; } Forms.CategoriesForm mCategories = new Forms.CategoriesForm(lBusinessPhones); mCategories.Owner = this; mCategories.ShowDialog(this); } if (e.ColumnIndex == 11) { List <string> lCategories = null; foreach (KeyValuePair <string, List <string> > pair in dCategories) { if (pair.Key == mId) { lCategories = pair.Value; } } if (lCategories == null) { return; } Forms.CategoriesForm mCategories = new Forms.CategoriesForm(lCategories); mCategories.Owner = this; mCategories.ShowDialog(this); } if (e.ColumnIndex == 6) { List <string> lHomePhones = null; foreach (KeyValuePair <string, List <string> > pair in dHomePhones) { if (pair.Key == mId) { lHomePhones = pair.Value; } } if (lHomePhones == null) { return; } Forms.CategoriesForm mCategories = new Forms.CategoriesForm(lHomePhones); mCategories.Owner = this; mCategories.ShowDialog(this); } if (e.ColumnIndex == 21) { List <string> lImAddress = null; foreach (KeyValuePair <string, List <string> > pair in dImAddresses) { if (pair.Key == mId) { lImAddress = pair.Value; } } if (lImAddress == null) { return; } Forms.CategoriesForm mCategories = new Forms.CategoriesForm(lImAddress); mCategories.Owner = this; mCategories.ShowDialog(this); } } catch (NullReferenceException) { // likely a cell collection that is empty, just return } catch (Exception ex) { toolStripStatus.Text = ex.Message; } }
private void dgEvents_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { try { // get the selected items Id string mId = dgEvents.Rows[e.RowIndex].Cells[0].Value.ToString(); // open the associated form based on the selected column if (e.ColumnIndex == 6) { List <ItemBody> tItemBody = null; foreach (KeyValuePair <string, List <ItemBody> > pair in dItemBody) { if (pair.Key == mId) { tItemBody = pair.Value; } } // check for empty list and bail the event if we are if (tItemBody == null) { return; } Forms.ItemBodyForm mItemBody = new Forms.ItemBodyForm(mId, tItemBody); mItemBody.Owner = this; mItemBody.ShowDialog(this); } // open the associated form based on the selected column if (e.ColumnIndex == 3) { List <Attendee> tAttendees = null; foreach (KeyValuePair <string, List <Attendee> > pair in dAttendees) { if (pair.Key == mId) { tAttendees = pair.Value; } } // check for empty list and bail the event if we are if (tAttendees == null) { return; } Forms.AttendeeForm mAttendees = new Forms.AttendeeForm(mId, tAttendees); mAttendees.Owner = this; mAttendees.ShowDialog(this); } if (e.ColumnIndex == 9) { List <string> lCategories = null; foreach (KeyValuePair <string, List <string> > pair in dCategories) { if (pair.Key == mId) { lCategories = pair.Value; } } // check for empty list and bail the event if we are if (lCategories == null) { return; } Forms.CategoriesForm mCategories = new Forms.CategoriesForm(lCategories); mCategories.Owner = this; mCategories.ShowDialog(this); } if (e.ColumnIndex == 24) { RecurrencePattern tPattern = null; RecurrenceRange tRange = null; foreach (KeyValuePair <string, RecurrencePattern> pair in dRecurrencePattern) { if (pair.Key == mId) { tPattern = pair.Value; } } foreach (KeyValuePair <string, RecurrenceRange> pair in dRecurrenceRange) { if (pair.Key == mId) { tRange = pair.Value; } } // check for empty list and bail the event if we are if (tPattern == null && tRange == null) { return; } Forms.RecurrenceForm mRecurrence = new Forms.RecurrenceForm(tPattern, tRange); mRecurrence.Owner = this; mRecurrence.ShowDialog(this); } if (e.ColumnIndex == 5) { List <FileAttachment> tFileAttachments = null; List <ItemAttachment> tItemAttachments = null; foreach (KeyValuePair <string, List <FileAttachment> > pair in dFileAttachments) { if (pair.Key == mId) { tFileAttachments = pair.Value; } } foreach (KeyValuePair <string, List <ItemAttachment> > pair in dItemAttachments) { if (pair.Key == mId) { tItemAttachments = pair.Value; } } // check for empty list and bail the event if we are if (tFileAttachments == null && tItemAttachments == null) { return; } Forms.AttachmentsForm mAttachment = new Forms.AttachmentsForm(mId, tFileAttachments, tItemAttachments); mAttachment.Owner = this; mAttachment.ShowDialog(this); } } catch (Exception ex) { toolStripStatus.Text = ex.Message; } }
private void dgMessages_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { try { // get the selected items Id string mId = dgMessages.Rows[e.RowIndex].Cells[0].Value.ToString(); // open the associated form based on the selected column if (e.ColumnIndex == 3) { List <Recipient> tRecips = null; foreach (KeyValuePair <string, List <Recipient> > pair in dRecips) { if (pair.Key == mId) { tRecips = pair.Value; } } // check for empty list and bail the event if we are if (tRecips == null) { return; } Forms.RecipientCollection mRecipients = new Forms.RecipientCollection(mId, tRecips); mRecipients.Owner = this; mRecipients.ShowDialog(this); } if (e.ColumnIndex == 4) { List <FileAttachment> tFileAttachments = null; List <ItemAttachment> tItemAttachments = null; foreach (KeyValuePair <string, List <FileAttachment> > pair in dFileAttachments) { if (pair.Key == mId) { tFileAttachments = pair.Value; } } foreach (KeyValuePair <string, List <ItemAttachment> > pair in dItemAttachments) { if (pair.Key == mId) { tItemAttachments = pair.Value; } } if (tFileAttachments == null && tItemAttachments == null) { return; } Forms.AttachmentsForm mAttachment = new Forms.AttachmentsForm(mId, tFileAttachments, tItemAttachments); mAttachment.Owner = this; mAttachment.ShowDialog(this); } if (e.ColumnIndex == 5) { List <Recipient> tRecips = null; foreach (KeyValuePair <string, List <Recipient> > pair in dBcc) { if (pair.Key == mId) { tRecips = pair.Value; } } // check for empty list and bail the event if we are if (tRecips == null) { return; } Forms.RecipientCollection mRecipients = new Forms.RecipientCollection(mId, tRecips); mRecipients.Owner = this; mRecipients.ShowDialog(this); } if (e.ColumnIndex == 7) { List <Recipient> tRecips = null; foreach (KeyValuePair <string, List <Recipient> > pair in dCc) { if (pair.Key == mId) { tRecips = pair.Value; } } // check for empty list and bail the event if we are if (tRecips == null) { return; } Forms.RecipientCollection mRecipients = new Forms.RecipientCollection(mId, tRecips); mRecipients.Owner = this; mRecipients.ShowDialog(this); } if (e.ColumnIndex == 8) { List <Recipient> tRecips = null; foreach (KeyValuePair <string, List <Recipient> > pair in dReplyTo) { if (pair.Key == mId) { tRecips = pair.Value; } } // check for empty list and bail the event if we are if (tRecips == null) { return; } Forms.RecipientCollection mRecipients = new Forms.RecipientCollection(mId, tRecips); mRecipients.Owner = this; mRecipients.ShowDialog(this); } if (e.ColumnIndex == 6) { List <ItemBody> lBody = null; foreach (KeyValuePair <string, List <ItemBody> > pair in dItemBody) { if (pair.Key == mId) { lBody = pair.Value; } } // check for empty list and bail the event if we are if (lBody == null) { return; } Forms.ItemBodyForm mItemBodyCollection = new Forms.ItemBodyForm(mId, lBody); mItemBodyCollection.Owner = this; mItemBodyCollection.ShowDialog(this); } if (e.ColumnIndex == 9) { List <string> lCategories = null; foreach (KeyValuePair <string, List <string> > pair in dCategories) { if (pair.Key == mId) { lCategories = pair.Value; } } // check for empty list and bail the event if we are if (lCategories == null) { return; } Forms.CategoriesForm mCategories = new Forms.CategoriesForm(lCategories); mCategories.Owner = this; mCategories.ShowDialog(this); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }