SmartFoxServer Silverlight API
CreateRoom Method (roomObj, roomId)
Namespaces ► SmartFoxClientAPI ► SmartFoxClient ► CreateRoom(NewRoomDescriptor, Int32)
Dynamically create a new room in the current zone.
Declaration Syntax

C# | Visual Basic | Visual C++

    public void CreateRoom(
    	NewRoomDescriptor roomObj,
    	int roomId
    )

    Public Sub CreateRoom ( _
    	roomObj As NewRoomDescriptor, _
    	roomId As Integer _
    )

    public:
    void CreateRoom(
    	NewRoomDescriptor^ roomObj,
    	int roomId
    )

Parameters

roomObj (NewRoomDescriptor)
  a NewRoomDescriptor object with the properties described farther on.

roomId (Int32)
  the id of the room from where the request is originated, in case the application allows multi-room join (optional, default value: activeRoomId).

Remarks

Sends:
SFSEvent..::.OnRoomAddedDelegate
SFSEvent..::.OnCreateRoomErrorDelegate

NOTE:
if the newly created room is a game room, the user is joined automatically upon successful room creation.

Version:
SmartFoxServer Basic / Pro

Examples
The following example shows how to create a new room.
CopyC#

    NewRoomDescriptor roomObj = new NewRoomDescriptor("The Cave", 15, true);

    List<RoomVariable> variables = new List<RoomVariable>();
    variables.Add( new RoomVariable("ogres", 5, true, false) );
    variables.Add( new RoomVariable("skeletons", 4) );

    roomObj.Add("vars", variables);

    smartFox.CreateRoom(roomObj);

See Also
SFSEvent..::.OnRoomAddedDelegate
SFSEvent..::.OnCreateRoomErrorDelegate
SFSEvent..::.OnUserCountChangeDelegate

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