示例#1
0
        static void Main(string[] args)
        {
            ChatMediator chat  = new ChatMediator();
            IUser        User1 = new PrimeUser()
            {
                Name = "Kasim"
            };
            IUser User2 = new BasicUser()
            {
                Name = "Thirumalesh"
            };
            IUser User3 = new PrimeUser()
            {
                Name = "Vamsi"
            };

            chat.AddUser(User1);
            chat.AddUser(User2);
            chat.AddUser(User3);

            chat.Rec(User2, "'Hello'");

            chat.SendMessage(User3, "'Hello'");
            chat.SendMessage(User1, "'Hello'");
            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            IChatMediator chatMediator = new ChatMediator();
            IUser         user1        = new BasicUser(chatMediator, "Vraj Shah");
            IUser         user2        = new PremiumUser(chatMediator, "Komal Shah");
            IUser         user3        = new PremiumUser(chatMediator, "Dipika Shah");

            chatMediator.AddUser(user1);
            chatMediator.AddUser(user2);
            chatMediator.AddUser(user3);

            user1.SendMessage("Hello");
            user2.SendMessage("Hi");
            Console.ReadLine();
        }