コード例 #1
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            bool isSending = false;

            Newsletter.Lock.AcquireReaderLock(Timeout.Infinite);
            isSending = Newsletter.IsSending;
            Newsletter.Lock.ReleaseReaderLock();
            // if another newsletter is currently being sent, show the panel with the wait message,
            // but don't hide the input controls so that the user doesn't loose the newsletter's text
            if (isSending)
            {
                panWait.Visible = true;
            }
            else
            {
                // if no newsletter is currently being sent, send this new one and
                // redirect to the page showing the progress
                int id = Newsletter.SendNewsletter(txtSubject.Text,
                                                   txtPlainTextBody.Text, txtHtmlBody.Value);
                this.Response.Redirect("SendingNewsletter.aspx");
            }
        }