コード例 #1
0
    public static void Main()
    {
        ChatServer chat = new ChatServer("MSN Chat Room");

        // Register to receive event notifications from the server
        chat.Join += new JoinHandler(OnJoinChat);
        chat.Quit += new QuitHandler(OnQuitChat);
        // Call methods on the server
        chat.JoinChat("Michael");
        chat.JoinChat("Bob");
        chat.JoinChat("Sam");
        chat.ShowMembers("After 3 have joined");
        chat.QuitChat("Bob");
        chat.ShowMembers("After 1 has quit");
    }
コード例 #2
0
    // TO DO:
    // Add event handlers for joining and quitting
    // Display the sender and the name of person

    public static void Main()
    {
        ChatServer chat = new ChatServer();

        // Register to receive event notifications from the server
        // TO DO:
        // Add code to register your event handlers

        // Call methods on the server
        chat.JoinChat("Michael");
        chat.JoinChat("Bob");
        chat.JoinChat("Sam");
        chat.ShowMembers("After 3 have joined");
        chat.QuitChat("Bob");
        chat.ShowMembers("After 1 has quit");
    }