SmartFoxServer Silverlight API
JoinRoom Method (newRoom, pword, isSpectator, dontLeave, oldRoom)
Namespaces ► SmartFoxClientAPI ► SmartFoxClient ► JoinRoom(Object, String, Boolean, Boolean, Int32)
Join a room.
Declaration Syntax

C# | Visual Basic | Visual C++

    public void JoinRoom(
    	Object newRoom,
    	string pword,
    	bool isSpectator,
    	bool dontLeave,
    	int oldRoom
    )

    Public Sub JoinRoom ( _
    	newRoom As Object, _
    	pword As String, _
    	isSpectator As Boolean, _
    	dontLeave As Boolean, _
    	oldRoom As Integer _
    )

    public:
    void JoinRoom(
    	Object^ newRoom,
    	String^ pword,
    	bool isSpectator,
    	bool dontLeave,
    	int oldRoom
    )

Parameters

newRoom (Object)
  the name (string) or the id (int) of the room to join.

pword (String)
  the room's password, if it's a private room (optional).

isSpectator (Boolean)
  a boolean flag indicating wheter you join as a spectator or not (optional).

dontLeave (Boolean)
  a boolean flag indicating if the current room must be left after successfully joining the new room (optional).

oldRoom (Int32)
  the id of the room to leave (optional, default value: activeRoomId).

Remarks

NOTE:
the last two optional parameters enable the advanced multi-room join feature of SmartFoxServer, which allows a user to join two or more rooms at the same time. If this feature is not required, the parameters can be omitted.

Sends:
SFSEvent..::.OnJoinRoomDelegate
SFSEvent..::.OnJoinRoomErrorDelegate

Version:
SmartFoxServer Basic / Pro

Examples
In the following example the user requests to join a room with id = 10; by default SmartFoxServer will disconnect him from the previous room.
CopyC#

    smartFox.JoinRoom(10);

In the following example the user requests to join a room with id = 12 and password = "mypassword"; by default SmartFoxServer will disconnect him from the previous room.
CopyC#

    smartFox.JoinRoom(12, "mypassword");

In the following example the user requests to join the room with id = 15 and passes true to the dontLeave flag; this will join the user in the new room while keeping him in the old room as well.
CopyC#

    smartFox.JoinRoom(15, "", false, true);

See Also
SFSEvent..::.OnJoinRoomDelegate
SFSEvent..::.OnJoinRoomErrorDelegate

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