SmartFoxServer Silverlight API
SFSEvent..::.OnUserVariablesUpdateDelegate Delegate
Namespaces ► SmartFoxClientAPI ► SFSEvent ► SFSEvent..::.OnUserVariablesUpdateDelegate
Dispatched when a user in the current room updates his/her User Variables.
Declaration Syntax

C# | Visual Basic | Visual C++

    public delegate void OnUserVariablesUpdateDelegate(
    	User user,
    	Dictionary<string, Object> changedVars
    )

    Public Delegate Sub OnUserVariablesUpdateDelegate ( _
    	user As User, _
    	changedVars As Dictionary(Of String, Object) _
    )

    public delegate void OnUserVariablesUpdateDelegate(
    	User^ user,
    	Dictionary<String^, Object^>^ changedVars
    )

Parameters

user (User)
  the User object representing the user who updated his/her variables.

changedVars (Dictionary<(Of <(String, Object>)>))
  a dictionary with the names of the changed variables as keys.

Remarks

NOTE:
the changedVars dictionary contains the names of the changed variables only, not the actual values. To retrieve them the GetVariable(String) / GetVariables()()() methods can be used.

Version:
SmartFoxServer Basic / Pro

Examples
The following example shows how to handle an update in User Variables.
CopyC#

    SFSEvent.onUserVariablesUpdate += OnUserVariablesUpdate;

    public void OnUserVariablesUpdate(User user, Dictionary<string, object> changedVars)
    {
        // We assume that each user has px and py variables representing the users's avatar coordinates in a 2D environment

        if (changedVars["px"] != null || changedVars["py"] != null)
        {
            Debug.WriteLine("User " + user.GetName() + " moved to new coordinates:");
            Debug.WriteLine("\t px: " + user.GetVariable("px"));
            Debug.WriteLine("\t py: " + user.GetVariable("py"));
        }
    }

See Also
User
SetUserVariables(Dictionary<(Of <(String, Object>)>), Int32)

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