Kiru Marimuthu
Guest
|
Thanks for recommending to use SendMessage over here.https://www.add-in-express.com/forum/read.php?FID=5&TID=14702
Is there a way to pass a parameter to OnSendMessage? I would like to pass a list of topics from SendMessage and receive the same in OnSendMessage and update only those topics.
I have another workaround of having it in class level variable, but I have to clear the list after each iteration. So sometimes by the time OnSendMessage is called the list gets cleared.
private void XXX_OnSendMessage(object sender, ADXSendMessageEventArgs e)
{
if (e.Message == message)
{
UpdateTopics(resolvedTopics.Values.ToArray());
}
if (e.Message == taskPane)
{
AddinModule.CurrentInstance.adxExcelTaskPanesCollectionItem1.TaskPaneInstance.RegionState =
ADXRegionState.Normal;
}
}
private void BatchProcess(IEnumerable<KeyValuePair<string, Tuple<ADXRTDTopic, bool>>> topic)
{
Parallel.ForEach(topic, RequestData);
resolvedTopics.Clear();
foreach (var t in topic)
{
resolvedTopics.AddOrUpdate(t.Key, t.Value.Item1, (text, oldValue) => t.Value.Item1);
}
SendMessage(message);
}
|
|
Andrei Smolin
Add-in Express team
Posts: 18794
Joined: 2006-05-11
|
Hello Kiru,
You can use a queue containing lists of resolved topics.
Andrei Smolin
Add-in Express Team Leader |
|