SmartFoxServer Silverlight API
SFSEvent..::.OnSpectatorSwitchedDelegate Delegate
Namespaces ► SmartFoxClientAPI ► SFSEvent ► SFSEvent..::.OnSpectatorSwitchedDelegate
Dispatched in response to the SwitchSpectator(Int32) request.
The request to turn a spectator into a player may fail if another user did the same before your request, and there was only one player slot available.
Declaration Syntax

C# | Visual Basic | Visual C++

    public delegate void OnSpectatorSwitchedDelegate(
    	bool success,
    	int newId,
    	Room room
    )

    Public Delegate Sub OnSpectatorSwitchedDelegate ( _
    	success As Boolean, _
    	newId As Integer, _
    	room As Room _
    )

    public delegate void OnSpectatorSwitchedDelegate(
    	bool success,
    	int newId,
    	Room^ room
    )

Parameters

success (Boolean)
  the switch result: true if the spectator was turned into a player, otherwise false.

newId (Int32)
  the player id assigned by the server to the user.

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

Remarks

Version:
SmartFoxServer Basic / Pro

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

    SFSEvent.onSpectatorSwitched += OnSpectatorSwitched;

    smartFox.SwitchSpectator();

    public void OnSpectatorSwitched(bool success, int newId, Room room)
    {
        if (success)
            Debug.WriteLine("You have been turned into a player; your id is " + newId);
        else
            Debug.WriteLine("The attempt to switch from spectator to player failed");
    }

See Also
GetPlayerId()()()
Room
SwitchSpectator(Int32)

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