public static void Execute_Example()
        {
            // Create chatroom
            Chatroom chatroom = new Chatroom();



            // Create participants and register them
            Participant George = new TeamMember("George");
            Participant Paul   = new TeamMember("Paul");
            Participant Ringo  = new TeamMember("Ringo");
            Participant John   = new TeamMember("John");
            Participant Yoko   = new NonTeamMember("Yoko");

            chatroom.Register(George);
            chatroom.Register(Paul);
            chatroom.Register(Ringo);
            chatroom.Register(John);
            chatroom.Register(Yoko);

            // Chatting participants
            Yoko.Send("John", "Hi John!");
            Paul.Send("Ringo", "All you need is love");
            Ringo.Send("George", "My sweet Lord");
            Paul.Send("John", "Can't buy me love");
            John.Send("Yoko", "My sweet love");

            // Wait for user

            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Create chatroom
            Chatroom chatroom = new Chatroom();

            // Create participants and register them
            Participant George = new Beatle("George");
            Participant Paul   = new Beatle("Paul");
            Participant Ringo  = new Beatle("Ringo");
            Participant John   = new Beatle("John");
            Participant Yoko   = new NonBeatle("Yoko");

            chatroom.Register(George);
            chatroom.Register(Paul);
            chatroom.Register(Ringo);
            chatroom.Register(John);
            chatroom.Register(Yoko);

            // Chatting participants
            Yoko.Send("John", "Hi John!");
            Paul.Send("Ringo", "All you need is love");
            Ringo.Send("George", "My sweet Lord");
            Paul.Send("John", "Can't buy me love");
            John.Send("Yoko", "My sweet love");

            Console.WriteLine("Press any key to exit...");
            Console.Read();
        }
Beispiel #3
0
        public static void RunTest()
        {
            Chatroom    newChatroom = new Chatroom();
            Participant john        = new Participant("John");
            Participant max         = new Participant("Max");
            Participant mary        = new Participant("Mary");
            Participant george      = new Participant("George");
            Participant dan         = new Participant("Dan");

            newChatroom.Register(john);
            newChatroom.Register(max);
            newChatroom.Register(mary);
            newChatroom.Register(george);
            newChatroom.Register(dan);

            dan.Send(john, "Hello!");
            john.Send(dan, "What's up?");
            dan.Send(john, "I'm good, and you?");
            john.Send(dan, "I'm good too, thank you.");
            george.Send(mary, "Woof");
            mary.Send(george, "Meow");
            max.Send(dan, "Blah");


            Console.WriteLine();
            newChatroom.PrintChatHistory();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            var chatroom = new Chatroom();

            var john   = new Participant("John");
            var james  = new Participant("James");
            var george = new Participant("George");
            var tom    = new ExclusiveParticipant("Tom");

            chatroom.Register(john);
            chatroom.Register(james);
            chatroom.Register(george);
            chatroom.Register(tom);

            john.Send("James", "Hi, James!");
            james.Send("John", "Hi, John!");
            james.Send("Tom", "Hi, Tom!");
            george.Send("Tom", "Hi, Tom!");

            Console.ReadLine();
        }