Example #1
0
        static void Main(string[] args)
        {
            VideoEncoder videoEncoder    = new VideoEncoder();
            var          mailService     = new MailService();
            var          whatsAppService = new WhatsAppService();

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded;
            videoEncoder.VideoEncoded += whatsAppService.OnVideoEncoded;

            videoEncoder.EncodeVideo(new Video {
                Title = "'The Lallantop Show'"
            });
            videoEncoder.EncodeVideo(new Video {
                Title = "'Duniadaari'"
            });
        }
Example #2
0
        public static void Main(string[] args)
        {
            var video1 = new Video {
                Title = "Van highlights"
            };
            var encoder     = new VideoEncoder();    // Publisher
            var mailService = new MailService();     // Subscriber
            var whatsApp    = new WhatsAppService(); // Another Subscriber

            // VideoEncoded behind the scenes is a list of pointers (methods)
            // Below we are just adding a new method to call to this list.
            encoder.VideoEncoded += mailService.VideoEnocderEventHandler; // subcribe to the event

            // Adding another subscriber
            encoder.VideoEncoded += whatsApp.VideoEnocderEventHandler; // Subscribe to the event

            encoder.Encode(video1);
        }
Example #3
0
 public WhatsAppController(IConfiguration configuration, IMessageProcessor messageProcessor, WhatsAppService whatsAppService)
 {
     _configuration    = configuration;
     _messageProcessor = messageProcessor;
     _whatsAppService  = whatsAppService;
 }