コード例 #1
0
        static void Main(string[] args)
        {
            // Bridge and their implementation
            IMessageSender email = new EmailSender();
            IMessageSender msmq  = new MSMQSender();
            IMessageSender web   = new WebServiceSender();

            Message message = new SystemMessage();

            message.Subject = "Test Message";
            message.Body    = "Hi, This is test message";

            message.MessageSender = email;
            message.Send();

            message.MessageSender = msmq;
            message.Send();

            message.MessageSender = web;
            message.Send();

            // User Message
            UserMessage userMessage = new UserMessage();

            userMessage.Subject       = "User Message";
            userMessage.Body          = "Hi, this is user test message";
            userMessage.Comment       = "I hope you enjoying";
            userMessage.MessageSender = email;
            userMessage.Send();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            IMessageSender email = new EmailSender();
            IMessageSender queue = new MSMQSender();
            IMessageSender web   = new WebServiceSender();

            Message message = new SystemMessage();

            message.Subject = "Test Message";
            message.Body    = "Hi, This is a Test Message";

            message.MessageSender = email;
            message.Send();

            message.MessageSender = queue;
            message.Send();

            message.MessageSender = web;
            message.Send();

            UserMessage usermsg = new UserMessage();

            usermsg.Subject      = "Test Message";
            usermsg.Body         = "Hi, This is a Test Message";
            usermsg.UserComments = "I hope you are well";

            usermsg.MessageSender = email;
            usermsg.Send();

            Console.ReadKey();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            IMessageSender text = new TextSender();
            IMessageSender web  = new WebServiceSender();

            Message message = new SystemMessage();

            message.Subject = "A Message";
            message.Body    = "Hi there, Please accept this message.";

            message.MessageSender = text;
            message.Send();

            message.MessageSender = web;
            message.Send();

            Console.ReadKey();
        }