Here there's an old question about this code.
xmpp.OnLogin += delegate(object o)
{
xmpp.Send(
new Message(
new Jid(JID_RECEIVER),
MessageType.chat,
"Hello, how are you?"
)
);
};
I want to use it in vb.net (version 10) but I couldn't figure out how to convert it.
To convert temperatures in degrees Fahrenheit to Celsius, subtract 32 and multiply by . 5556 (or 5/9).
The relationship between Fahrenheit and Celsius is expressed with the formula, °C = (°F - 32) × 5/9; where C represents the value in Celsius and F represents the value in Fahrenheit.
Convert celsius to fahrenheit 1 Celsius is equal to 33.8 Fahrenheit.
The delegate is an anonymous function. The syntax is a bit different for VB .NET, as expected. Without having the VB compiler at hand, I would say you need something like:
AddHandler xmpp.OnLogin,
Sub(o As Object)
xmpp.Send(
new Message(
new Jid(JID_RECEIVER),
MessageType.chat,
"Hello, how are you?"
)
End Sub
I don't know how to declare an anonymous delegate in VB.NET and I'm too lazy to Google it, but something like this should work (warning: not tested):
AddHandler xmpp.OnLogin, AddressOf Me.HandleSendMessage
Private Sub HandleSendMessage(ByVal o As Object)
xmpp.Send( new Message(
new Jid(JID_RECEIVER),
MessageType.chat,
"Hello, how are you?"
)
)
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With