SmartFoxServer Silverlight API
SFSEvent..::.OnPrivateMessageDelegate Delegate
Namespaces ► SmartFoxClientAPI ► SFSEvent ► SFSEvent..::.OnPrivateMessageDelegate
Dispatched when a private chat message is received.
Declaration Syntax

C# | Visual Basic | Visual C++

    public delegate void OnPrivateMessageDelegate(
    	string message,
    	User sender,
    	int roomId,
    	int userId
    )

    Public Delegate Sub OnPrivateMessageDelegate ( _
    	message As String, _
    	sender As User, _
    	roomId As Integer, _
    	userId As Integer _
    )

    public delegate void OnPrivateMessageDelegate(
    	String^ message,
    	User^ sender,
    	int roomId,
    	int userId
    )

Parameters

message (String)
  the private message received.

sender (User)
  the User object representing the user that sent the message; this property is undefined if the sender isn't in the same room of the recipient.

roomId (Int32)
  the id of the room where the sender is.

userId (Int32)
  the user id of the sender (useful in case of private messages across different rooms, when the sender object is not available).

Remarks

History:
SmartFoxServer Pro v1.5.0 - roomId and userId parameters added.

Version:
SmartFoxServer Basic / Pro

Examples
The following example shows how to handle a private message.
CopyC#

    SFSEvent.onPrivateMessage += OnPrivateMessage;

    smartFox.SendPrivateMessage("Hallo Jack!", 22);

    public void OnPrivateMessage(string message, User sender, int roomId, int userId)
    {
        Debug.WriteLine("User " + sender.GetName() + " sent the following private message: " + .message);
    }

See Also
SFSEvent..::.OnPublicMessageDelegate
User
SendPrivateMessage(String, Int32, Int32)

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