internal void Send()
 {
     if (SelectedMessageServer != null)
     {
         Application.Current.Dispatcher.BeginInvoke(((Action)(() => SendList.Add(Message))));
         SelectedMessageServer.Send(Message);
     }
 }
示例#2
0
        private void menuSendMail_Click(object sender, EventArgs e)
        {
            string size     = "";
            string priority = "";

            // アドレスまたは本文が未入力のとき
            if (textAddress.Text == "" || textBody.Text == "")
            {
                if (textAddress.Text == "")
                {
                    // アドレス未入力エラーメッセージを表示する
                    MessageBox.Show("宛先が入力されていません。", "直接送信", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (textBody.Text == "")
                {
                    // 本文未入力エラーメッセージを表示する
                    MessageBox.Show("本文が入力されていません。", "直接送信", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return;
            }

            // 件名がないときは件名に(無題)を設定する
            if (textSubject.Text == "")
            {
                textSubject.Text = "(無題)";
            }

            // 優先度の設定をする
            priority = mailPriority[comboPriority.Text];

            // 文面の末尾が\r\nでないときは\r\nを付加する
            if (!textBody.Text.EndsWith("\r\n"))
            {
                textBody.Text += "\r\n";
            }

            CleanAttach();

            attachName = GetAttaches();

            // 送信メールサイズを取得する
            size = GetMailSize();

            // 直接送信
            MainForm.DirectSendMail(this.textAddress.Text, this.textCc.Text, this.textBcc.Text, this.textSubject.Text, this.textBody.Text, attachName, priority);
            string date = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString();

            var sendMail = new Mail(this.textAddress.Text, "", this.textSubject.Text, this.textBody.Text, this.attachName, date, size, "", false, "", this.textCc.Text, this.textBcc.Text, priority);

            // コレクションに追加する
            SendList.Add(sendMail);

            BeforeClosing(MainForm);

            this.Close();
        }
示例#3
0
        private void menuSendMailBox_Click(object sender, EventArgs e)
        {
            string size     = "";
            string priority = "";

            // アドレスまたは本文が未入力のとき
            if (textAddress.Text == "" || textBody.Text == "")
            {
                if (textAddress.Text == "")
                {
                    // アドレス未入力エラーメッセージを表示する
                    MessageBox.Show("宛先が入力されていません。", "送信箱に入れる", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (textBody.Text == "")
                {
                    // 本文未入力エラーメッセージを表示する
                    MessageBox.Show("本文が入力されていません。", "送信箱に入れる", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return;
            }

            // 件名がないときは件名に(無題)を設定する
            if (textSubject.Text == "")
            {
                textSubject.Text = "(無題)";
            }

            // 優先度の設定をする
            priority = mailPriority[comboPriority.Text];

            // 文面の末尾が\r\nでないときは\r\nを付加する
            if (!textBody.Text.EndsWith("\r\n"))
            {
                textBody.Text += "\r\n";
            }

            CleanAttach();

            attachName = GetAttaches();

            // 未送信メールは作成日時を格納するようにする(未送信という文字列だと日付ソートでエラーになる)
            string date = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString();

            // 編集フラグがOffのとき
            if (!IsEdit)
            {
                // 送信メールサイズを取得する
                size = GetMailSize();

                // Form1からのコレクションに追加してリスト更新する
                var newMail = new Mail(this.textAddress.Text, "", this.textSubject.Text, this.textBody.Text, attachName, date, size, "", true, "", this.textCc.Text, this.textBcc.Text, priority);
                SendList.Add(newMail);
            }
            else
            {
                // 選択したメールの内容を書き換える
                // 送信リストに入れている情報を書き換える
                size = GetMailSize();
                SendList[ListTag].subject    = textSubject.Text;
                SendList[ListTag].address    = textAddress.Text;
                SendList[ListTag].body       = textBody.Text;
                SendList[ListTag].attach     = attachName;
                SendList[ListTag].date       = date;
                SendList[ListTag].size       = size;
                SendList[ListTag].notReadYet = true;
                SendList[ListTag].cc         = textCc.Text;
                SendList[ListTag].bcc        = textBcc.Text;
                SendList[ListTag].priority   = priority;

                // Becky!と同じように更新後はテキストも変更
                MainForm.textBody.Text = textBody.Text;
            }

            BeforeClosing(MainForm);

            this.Close();
        }