Xy Capital
Guest
|
Hi add-in team,
RTD(ProgID, server, topic1, [topic2], ...)
Could you advise the way of accessing ProgID and server from C# code? We are only able access the value of topic1, topic2, etc
private async void TopicConnect(object sender, EventArgs e)
{
AddinExpress.RTD.ADXRTDTopic topic = sender as AddinExpress.RTD.ADXRTDTopic;
if (topic.String01 == "kdjawjd")
{
//do sth
...
private object CommonRefreshData(object sender)
{
AddinExpress.RTD.ADXRTDTopic topic = sender as AddinExpress.RTD.ADXRTDTopic;
//log_to_file("TopicID = " + topic.TopicID + " String01 = " + topic.String01 + " String02 = " + topic.String02);
if (topic.String03 == "blah")
{
//do sth
...
But we also wish to read the value of ProgID/server. The reason is that we want to prevent the RTD doing something unexpected when user input wrong RTD formula. We experience that user accidentally removed the 2nd argument and all the RTD formulas stopped working (from the log we see that it started a new thread connecting to the wrong server, as the 2nd argument changed to some value ) |
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Hello Xy,
The combination of ProgId and server parameter identify the RTD server instance in which you handle your topics; no other RTD server instance (if such an instance exists) receives the call.
Xy Capital writes:
We experience that user accidentally removed the 2nd argument and all the RTD formulas stopped working (from the log we see that it started a new thread connecting to the wrong server, as the 2nd argument changed to some value )
This is the way the RTD formula works. It expects that the second parameter specifies the server. You can bypass this difficulty by wrapping your RTD calls in UDF calls; check section Inserting the RTD function in a user-friendly way at https://www.add-in-express.com/docs/net-excel-udf-tips.php#advanced-rtd. Find an a project demonstrating this in https://www.add-in-express.com/creating-addins-blog/2010/03/24/addin-xll-rtd-one-assembly/.
Andrei Smolin
Add-in Express Team Leader |
|
Xy Capital
Guest
|
Thank you for the advise and examples Andrei ! |
|