Example #1
0
        public static void ShowMediator()
        {
            var mediator    = new SimpleMediator();
            var normalUser  = new NormalUser(mediator);
            var premiumUser = new PremiumUser(mediator);

            mediator.AddUser(normalUser);
            mediator.AddUser(premiumUser);

            normalUser.ChangeSubscription();
        }
Example #2
0
        /// <summary>
        /// Mediators this instance.
        /// </summary>
        public void Mediator()
        {
            ////creating the object of ChatMediator class
            IChatMediator chatMediator = new ChatMediator();
            ////create users and add them to chat mediator's user list
            IUser paramesh = new BasicUser(chatMediator, "paramesh");
            IUser manju    = new PremiumUser(chatMediator, "manju");
            IUser karan    = new PremiumUser(chatMediator, "karan");

            chatMediator.AddUser(paramesh);
            chatMediator.AddUser(manju);
            chatMediator.AddUser(karan);
            //// send message
            karan.SendMessage("Hello Everyone!");
            Console.WriteLine("===============================================");
            paramesh.SendMessage("hiii");
            Console.ReadLine();
        }