SmartFoxServer Silverlight API
SFSEvent..::.OnUserCountChangeDelegate Delegate
Namespaces ► SmartFoxClientAPI ► SFSEvent ► SFSEvent..::.OnUserCountChangeDelegate
Dispatched when the number of users and/or spectators changes in a room within the current zone.
This event allows to keep track in realtime of the status of all the zone rooms in terms of users and spectators.
In case many rooms are used and the zone handles a medium to high traffic, this notification can be turned off to reduce bandwidth consumption, since a message is broadcasted to all users in the zone each time a user enters or exits a room.
Declaration Syntax

C# | Visual Basic | Visual C++

    public delegate void OnUserCountChangeDelegate(
    	Room room
    )

    Public Delegate Sub OnUserCountChangeDelegate ( _
    	room As Room _
    )

    public delegate void OnUserCountChangeDelegate(
    	Room^ room
    )

Parameters

room (Room)
  the Room object representing the room where the change occurred.

Remarks

Version:
SmartFoxServer Basic / Pro

Examples
The following example shows how to check the handle the spectator switch notification.
CopyC#

    SFSEvent.onUserCountChange += OnUserCountChange;

    public void OnUserCountChange(Room room)
    {
        // Assuming this is a game room

        string roomName = room.GetName()
        int playersNum = room.GetUserCount()
        int spectatorsNum: = room.GetSpectatorCount()

        Debug.WriteLine("Room " + roomName + "has " + playersNum + " players and " + spectatorsNum + " spectators");
    }

See Also
SFSEvent..::.OnUserEnterRoomDelegate
SFSEvent..::.OnUserLeaveRoomDelegate
Room
CreateRoom(NewRoomDescriptor, Int32)

Assembly: SmartFoxClientAPI_Silverlight (Module: SmartFoxClientAPI_Silverlight) Version: 1.0.0.0 (1.0.0.0)