API defines public delegate.. huh?
C# noob here. Wondering if anyone out there could shed some light on dealing with this API. I'm using .net 3.5.
The API method is defined in the object browser as:
public delegate int CallbackMessage(long userData, int nToolId, int nStatus, string pMessage)
When I try the following code:
CallbackMessage myCall = new CallbackMessage(); //i know this is wrong, looking at intellisense
The intellisense on CallbackMessage constructor is telling me:
CallbackMessage.CallbackMessage( int (long, int, int, string) target);
How would I build a constructor for myCall? Thanks in advance.
Re: API defines public delegate.. huh?
you need to something that looks like the next
Code:
private void myCallbackHandler(long userData, int nToolId, int nStatus, string pMessage){
//do something with the values
}
private void Test(){
//make a call to the API
CallbackMessage.CallbackMessage += new CallbackMessage(myCallbackHandler);
}
Re: API defines public delegate.. huh?
that worked.. thanks for the help!
Re: API defines public delegate.. huh?
You can also just write:
Code:
private void myCallbackHandler(long userData, int nToolId, int nStatus, string pMessage){
//do something with the values
}
private void Test(){
//make a call to the API
CallbackMessage.CallbackMessage += myCallbackHandler;
}
Re: API defines public delegate.. huh?
Quote:
Originally Posted by
Mutant_Fruit
You can also just write:
Code:
private void myCallbackHandler(long userData, int nToolId, int nStatus, string pMessage){
//do something with the values
}
private void Test(){
//make a call to the API
CallbackMessage.CallbackMessage += myCallbackHandler;
}
Didn't know that :-)