コード例 #1
0
        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 == (int)columns.Body)
                {
                    List<ItemBody> tItemBody = null;

                    foreach (KeyValuePair<string, List<ItemBody>> pair in dItemBody)
                    {
                        if (pair.Key == mId)
                        {
                            tItemBody = pair.Value;
                        }
                    }

                    ItemBodyForm mItemBody = new ItemBodyForm(mId, tItemBody);
                    mItemBody.Owner = this;
                    mItemBody.ShowDialog(this);
                }
                // open the associated form based on the selected column
                if (e.ColumnIndex == (int)columns.Attendees)
                {
                    List<Attendee> tAttendees = null;

                    foreach (KeyValuePair<string, List<Attendee>> pair in dAttendees)
                    {
                        if (pair.Key == mId)
                        {
                            tAttendees = pair.Value;
                        }
                    }

                    AttendeeForm mAttendees = new AttendeeForm(mId, tAttendees);
                    mAttendees.Owner = this;
                    mAttendees.ShowDialog(this);
                }
                if (e.ColumnIndex == (int)columns.Categories)
                {
                    List<string> lCategories = null;
                    foreach (KeyValuePair<string, List<string>> pair in dCategories)
                    {
                        if (pair.Key == mId)
                        {
                            lCategories = pair.Value;
                        }
                    }

                    CategoriesForm mCategories = new CategoriesForm(lCategories);
                    mCategories.Owner = this;
                    mCategories.ShowDialog(this);
                }
                if (e.ColumnIndex == (int)columns.Recurrence)
                {
                    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;
                        }
                    }

                    RecurrenceForm mRecurrence = new RecurrenceForm(tPattern, tRange);
                    mRecurrence.Owner = this;
                    mRecurrence.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Attachments)
                {
                    if (dFileAttachments.Count > 0 || dItemAttachments.Count > 0)
                    {
                        List<FileAttachment> tFileAttachments = null;
                        List<ItemAttachment> tItemAttachments = null;
                        List<ReferenceAttachment> tRefAttachments = 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;
                            }
                        }

                        foreach (KeyValuePair<string, List<ReferenceAttachment>> pair in dReferenceAttachments)
                        {
                            if (pair.Key == mId)
                            {
                                tRefAttachments = pair.Value;
                            }
                        }

                        AttachmentsForm mAttachment = new AttachmentsForm(mId, tFileAttachments, tItemAttachments, tRefAttachments, ref applogger);
                        mAttachment.Owner = this;
                        mAttachment.ShowDialog(this);
                    }
                }
            }
            catch (NullReferenceException nre)
            {
                applogger.Log("Double-click Error:");
                applogger.Log(nre.Message);
            }
            catch (Exception ex)
            {
                applogger.Log("Double-click Error:");
                applogger.Log(ex.Message);
            }
        }
コード例 #2
0
ファイル: MailAPI.cs プロジェクト: desjarlais/restfuloutlook
        private void dgMessages_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                // get the selected item Id
                string mId = dgMessages.Rows[e.RowIndex].Cells[(int)columns.Id].Value.ToString();

                // open the associated form based on the selected column
                if (e.ColumnIndex == (int)columns.To)
                {
                    // create a temp recip collection
                    List<Recipient> tRecips = null;

                    // loop through the cached dictionary values
                    foreach (KeyValuePair<string, List<Recipient>> pair in dRecips)
                    {
                        // if the value matches the selected item id
                        // add it to the temp dictionary
                        if (pair.Key == mId)
                        {
                            tRecips = pair.Value;
                        }
                    }

                    // pass the temp dictionary to the form
                    RecipientCollection mRecipients = new RecipientCollection(mId, tRecips);
                    mRecipients.Owner = this;
                    mRecipients.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Attachments)
                {
                    if (dFileAttachments.Count > 0 || dItemAttachments.Count > 0)
                    {
                        List<FileAttachment> tFileAttachments = null;
                        List<ItemAttachment> tItemAttachments = null;
                        List<ReferenceAttachment> tRefAttachments = 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;
                            }
                        }

                        foreach (KeyValuePair<string, List<ReferenceAttachment>> pair in dReferenceAttachments)
                        {
                            if (pair.Key == mId)
                            {
                                tRefAttachments = pair.Value;
                            }
                        }

                        AttachmentsForm mAttachment = new AttachmentsForm(mId, tFileAttachments, tItemAttachments, tRefAttachments, ref applogger);
                        mAttachment.Owner = this;
                        mAttachment.ShowDialog(this);
                    }
                }

                if (e.ColumnIndex == (int)columns.Bcc)
                {
                    List<Recipient> tRecips = null;

                    foreach (KeyValuePair<string, List<Recipient>> pair in dBcc)
                    {
                        if (pair.Key == mId)
                        {
                            tRecips = pair.Value;
                        }
                    }

                    RecipientCollection mRecipients = new RecipientCollection(mId, tRecips);
                    mRecipients.Owner = this;
                    mRecipients.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Cc)
                {
                    List<Recipient> tRecips = null;

                    foreach (KeyValuePair<string, List<Recipient>> pair in dCc)
                    {
                        if (pair.Key == mId)
                        {
                            tRecips = pair.Value;
                        }
                    }

                    RecipientCollection mRecipients = new RecipientCollection(mId, tRecips);
                    mRecipients.Owner = this;
                    mRecipients.ShowDialog(this);                    
                }

                if (e.ColumnIndex == (int)columns.ReplyTo)
                {
                    List<Recipient> tRecips = null;

                    foreach (KeyValuePair<string, List<Recipient>> pair in dReplyTo)
                    {
                        if (pair.Key == mId)
                        {
                            tRecips = pair.Value;
                        }
                    }

                    RecipientCollection mRecipients = new RecipientCollection(mId, tRecips);
                    mRecipients.Owner = this;
                    mRecipients.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Body)
                {
                    List<ItemBody> lBody = null;
                    foreach (KeyValuePair<string, List<ItemBody>> pair in dItemBody)
                    {
                        if (pair.Key == mId)
                        {
                            lBody = pair.Value;
                        }
                    }

                    ItemBodyForm mItemBodyCollection = new ItemBodyForm(mId, lBody);
                    mItemBodyCollection.Owner = this;
                    mItemBodyCollection.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Categories)
                {
                    List<string> lCategories = null;
                    foreach (KeyValuePair<string, List<string>> pair in dCategories)
                    {
                        if (pair.Key == mId)
                        {
                            lCategories = pair.Value;
                        }
                    }

                    CategoriesForm mCategories = new CategoriesForm(lCategories);
                    mCategories.Owner = this;
                    mCategories.ShowDialog(this);
                }
            }
            catch (Exception ex)
            {
                applogger.Log("Double-click Error:");
                applogger.Log(ex.Message);
            }
        }
コード例 #3
0
        private void dgMessages_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                // get the selected item Id
                string mId = dgMessages.Rows[e.RowIndex].Cells[(int)columns.Id].Value.ToString();

                // open the associated form based on the selected column
                if (e.ColumnIndex == (int)columns.To)
                {
                    // create a temp recip collection
                    List <Recipient> tRecips = null;

                    // loop through the cached dictionary values
                    foreach (KeyValuePair <string, List <Recipient> > pair in dRecips)
                    {
                        // if the value matches the selected item id
                        // add it to the temp dictionary
                        if (pair.Key == mId)
                        {
                            tRecips = pair.Value;
                        }
                    }

                    // pass the temp dictionary to the form
                    RecipientCollection mRecipients = new RecipientCollection(mId, tRecips);
                    mRecipients.Owner = this;
                    mRecipients.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Attachments)
                {
                    if (dFileAttachments.Count > 0 || dItemAttachments.Count > 0)
                    {
                        List <FileAttachment>      tFileAttachments = null;
                        List <ItemAttachment>      tItemAttachments = null;
                        List <ReferenceAttachment> tRefAttachments  = 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;
                            }
                        }

                        foreach (KeyValuePair <string, List <ReferenceAttachment> > pair in dReferenceAttachments)
                        {
                            if (pair.Key == mId)
                            {
                                tRefAttachments = pair.Value;
                            }
                        }

                        AttachmentsForm mAttachment = new AttachmentsForm(mId, tFileAttachments, tItemAttachments, tRefAttachments, ref applogger);
                        mAttachment.Owner = this;
                        mAttachment.ShowDialog(this);
                    }
                }

                if (e.ColumnIndex == (int)columns.Bcc)
                {
                    List <Recipient> tRecips = null;

                    foreach (KeyValuePair <string, List <Recipient> > pair in dBcc)
                    {
                        if (pair.Key == mId)
                        {
                            tRecips = pair.Value;
                        }
                    }

                    RecipientCollection mRecipients = new RecipientCollection(mId, tRecips);
                    mRecipients.Owner = this;
                    mRecipients.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Cc)
                {
                    List <Recipient> tRecips = null;

                    foreach (KeyValuePair <string, List <Recipient> > pair in dCc)
                    {
                        if (pair.Key == mId)
                        {
                            tRecips = pair.Value;
                        }
                    }

                    RecipientCollection mRecipients = new RecipientCollection(mId, tRecips);
                    mRecipients.Owner = this;
                    mRecipients.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.ReplyTo)
                {
                    List <Recipient> tRecips = null;

                    foreach (KeyValuePair <string, List <Recipient> > pair in dReplyTo)
                    {
                        if (pair.Key == mId)
                        {
                            tRecips = pair.Value;
                        }
                    }

                    RecipientCollection mRecipients = new RecipientCollection(mId, tRecips);
                    mRecipients.Owner = this;
                    mRecipients.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Body)
                {
                    List <ItemBody> lBody = null;
                    foreach (KeyValuePair <string, List <ItemBody> > pair in dItemBody)
                    {
                        if (pair.Key == mId)
                        {
                            lBody = pair.Value;
                        }
                    }

                    ItemBodyForm mItemBodyCollection = new ItemBodyForm(mId, lBody);
                    mItemBodyCollection.Owner = this;
                    mItemBodyCollection.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Categories)
                {
                    List <string> lCategories = null;
                    foreach (KeyValuePair <string, List <string> > pair in dCategories)
                    {
                        if (pair.Key == mId)
                        {
                            lCategories = pair.Value;
                        }
                    }

                    CategoriesForm mCategories = new CategoriesForm(lCategories);
                    mCategories.Owner = this;
                    mCategories.ShowDialog(this);
                }
            }
            catch (Exception ex)
            {
                applogger.Log("Double-click Error:");
                applogger.Log(ex.Message);
            }
        }
コード例 #4
0
        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 == (int)columns.Body)
                {
                    List <ItemBody> tItemBody = null;

                    foreach (KeyValuePair <string, List <ItemBody> > pair in dItemBody)
                    {
                        if (pair.Key == mId)
                        {
                            tItemBody = pair.Value;
                        }
                    }

                    ItemBodyForm mItemBody = new ItemBodyForm(mId, tItemBody);
                    mItemBody.Owner = this;
                    mItemBody.ShowDialog(this);
                }
                // open the associated form based on the selected column
                if (e.ColumnIndex == (int)columns.Attendees)
                {
                    List <Attendee> tAttendees = null;

                    foreach (KeyValuePair <string, List <Attendee> > pair in dAttendees)
                    {
                        if (pair.Key == mId)
                        {
                            tAttendees = pair.Value;
                        }
                    }

                    AttendeeForm mAttendees = new AttendeeForm(mId, tAttendees);
                    mAttendees.Owner = this;
                    mAttendees.ShowDialog(this);
                }
                if (e.ColumnIndex == (int)columns.Categories)
                {
                    List <string> lCategories = null;
                    foreach (KeyValuePair <string, List <string> > pair in dCategories)
                    {
                        if (pair.Key == mId)
                        {
                            lCategories = pair.Value;
                        }
                    }

                    CategoriesForm mCategories = new CategoriesForm(lCategories);
                    mCategories.Owner = this;
                    mCategories.ShowDialog(this);
                }
                if (e.ColumnIndex == (int)columns.Recurrence)
                {
                    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;
                        }
                    }

                    RecurrenceForm mRecurrence = new RecurrenceForm(tPattern, tRange);
                    mRecurrence.Owner = this;
                    mRecurrence.ShowDialog(this);
                }

                if (e.ColumnIndex == (int)columns.Attachments)
                {
                    if (dFileAttachments.Count > 0 || dItemAttachments.Count > 0)
                    {
                        List <FileAttachment>      tFileAttachments = null;
                        List <ItemAttachment>      tItemAttachments = null;
                        List <ReferenceAttachment> tRefAttachments  = 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;
                            }
                        }

                        foreach (KeyValuePair <string, List <ReferenceAttachment> > pair in dReferenceAttachments)
                        {
                            if (pair.Key == mId)
                            {
                                tRefAttachments = pair.Value;
                            }
                        }

                        AttachmentsForm mAttachment = new AttachmentsForm(mId, tFileAttachments, tItemAttachments, tRefAttachments, ref applogger);
                        mAttachment.Owner = this;
                        mAttachment.ShowDialog(this);
                    }
                }
            }
            catch (NullReferenceException nre)
            {
                applogger.Log("Double-click Error:");
                applogger.Log(nre.Message);
            }
            catch (Exception ex)
            {
                applogger.Log("Double-click Error:");
                applogger.Log(ex.Message);
            }
        }