Hi,
I'm a new IDL User, and I'm writting a new silverlight application that need to work with IDL, to create charts, and do some calculations. To use IDL with silverlight, I create a Web Service wich is dedicated to communicate with IDL. When the user want to produce a chart, the silverlight application, sends parameters to the web service (type of chart, number of values, size.... The web service receive this parameters, send data to IDL. IDL produce the graph, and save it into a file, that, the webservice can read and return as an array of bytes to the Silverlight application. That works !!!
My problem is that the user must be able to enter a mathematical formula, give values to variables, and run the formula. When the formula is correct, all is well, but when the formula contains an error, I am unable to capture the error code in my Web service. I need the code, because, I want to send the message in French to the user (I'm from France -) )
In the webservice, I do the following :
- Create a connection Objet and an event handler on IDL Output
IdlSoft = new COM_IDL_connect();
IdlSoft.OnIDLOutput += new _DIDLWrapperEvents_OnIDLOutputEventHandler(IdlSoft_OnIDLOutput);
IdlSoft.CreateObject(0, 0, 0);
- Give values to my variables
IdlSoft.SetIDLVariable("a", lValeurA);
IdlSoft.SetIDLVariable("b", lValeurB);
- and execute the formula
commandIdl = " y = " + lFormule;
try
{
IdlSoft.ExecuteString(commandIdl);
}
catch (Exception e)
{
coderet.errmessage = IdlSoft.GetLastError();
}
on the event handler OnIDLOutput, I can have the message produce by IDL, but it's not possible to have the error code.
void IdlSoft_OnIDLOutput(string Output)
{
ErrorMsg += Output;
}
I tried to add a catch before the execution of the formula, but it does not seems to work. There's no output 'Code Erreur : " xxx.
commandIdl = "CATCH, error ";
IdlSoft.ExecuteString(commandIdl);
commandIdl = "IF error NE 0 THEN BEGIN \r\n";
commandIdl += " print, 'Code Erreur : ' , error \r\n";
commandIdl += " CATCH, /CANCEL \r\n";
commandIdl += "ENDIF";
IdlSoft.ExecuteString(commandIdl);
Can you help me ?????
Thanks
|