Exemplo n.º 1
0
        /// <summary>
        ///  アイテム送信時の宛先表示画面を生成する
        /// </summary>
        /// <param name="item">アイテム</param>
        /// <param name="cancel">送信をしないかどうか</param>
        private void ConfirmContact(object Item, ref bool Cancel)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                // アイテムタイプをMailで初期化
                Utility.OutlookItemType itemType = Utility.OutlookItemType.Mail;

                // アイテムの宛先を取得
                List <Outlook.Recipient> recipientsList = new List <Outlook.Recipient>();
                recipientsList = Utility.GetRecipients(Item, ref itemType, true);

                // 会議の招待に対する返事の場合、宛先表示しない
                if (itemType == Utility.OutlookItemType.MeetingResponse ||
                    recipientsList == null)
                {
                    return;
                }

                // 宛先情報のリストを取得
                SearchRecipient searchRecipient = new SearchRecipient();
                List <RecipientInformationDto> recipientList = searchRecipient.SearchContact(recipientsList, itemType);

                // 送信者のExchangeUserオブジェクトを取得
                RecipientInformationDto senderInformation = null;
                senderInformation = Utility.GetSenderInfomation(Item);

                // 受信者の宛先情報のリストに、送信者の情報も追加する
                if (senderInformation != null)
                {
                    recipientList.Add(senderInformation);
                }

                Cursor.Current = Cursors.Default;

                // 引数に宛先情報を渡し、宛先表示画面を表示する
                RecipientConfirmationWindow recipientWindow = new RecipientConfirmationWindow(itemType, recipientList);
                DialogResult result = recipientWindow.ShowDialog();

                // 画面でOK以外が選択された場合
                if (result != DialogResult.OK)
                {
                    // メール送信のイベントをキャンセルする
                    Cancel = true;
                }
            }
            /// 例外が発生した場合、エラーダイアログを表示
            /// 送信イベントをキャンセルする
            catch (Exception ex)
            {
                // エラーダイアログの呼び出し
                ErrorDialog.ShowException(ex);

                Cancel = true;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 送信者、To、Cc、Bccを取得と検索し、宛先リスト画面を呼び出す
        /// </summary>
        private void ShowRecipientListWindow(object activeItem)
        {
            Cursor.Current = Cursors.WaitCursor;

            /// Mailで初期化
            Utility.OutlookItemType itemType          = Utility.OutlookItemType.Mail;
            RecipientInformationDto senderInformation = null;

            /// メールの宛先を取得
            List <Outlook.Recipient> recipientsList = new List <Outlook.Recipient>();

            recipientsList = Utility.GetRecipients(activeItem, ref itemType);

            ///  会議招集の返信の場合、そのまま送信する
            if (recipientsList == null)
            {
                return;
            }

            /// 検索し、受信者の宛先情報リストが戻ってくる
            SearchRecipient searchRecipient = new SearchRecipient();
            List <RecipientInformationDto> recipientList = searchRecipient.SearchContact(recipientsList, itemType);

            /// 送信者のExchangeUserオブジェクトを取得
            senderInformation = Utility.GetSenderInfomation(activeItem);

            /// 受信者の宛先情報のリストに、送信者の情報も追加する
            if (senderInformation != null)
            {
                recipientList.Add(senderInformation);
            }

            Cursor.Current = Cursors.Default;

            // 宛先リストの画面を表示する
            RecipientListWindow recipientListWindow = new RecipientListWindow(itemType, recipientList);

            recipientListWindow.ShowDialog();
        }