Exemplo n.º 1
0
        private void unsubBtn_Click(object sender, EventArgs e)
        {
            bool flg = false;

            if (this.emailAddress != String.Empty)
            {
                SendViaEmail sendViaEmail = new SendViaEmail(this.emailAddress);
                sendViaEmail.Unsubscribe(this.publisher);
                MessageBox.Show(this.emailAddress + " unsubscribe succesfully!");
                this.emailAddress = String.Empty;

                flg = true;
            }

            if (this.mobileNumber != String.Empty)
            {
                SendViaMobile sendViaMobile = new SendViaMobile(this.mobileNumber);
                sendViaMobile.Unsubscribe(this.publisher);
                MessageBox.Show(this.mobileNumber + " unsubscribe succesfully!");
                this.mobileNumber = String.Empty;
                flg = true;
            }

            if (flg == true)
            {
                this.Close();
            }
        }
Exemplo n.º 2
0
        public void Unsubscribe(Publisher pub)
        {
            Dictionary <string, SendViaEmail> emailDic = pub.getEmailDic();

            SendViaEmail sendViaEmail = emailDic[this.getEmailAddr()];

            pub.publishmsg -= sendViaEmail.sendMsgViaMail;

            pub.removeFromList(this, "email");
        }