Passing parameter to OnSendMessage from SendMessage

Add-in Express™ Support Service
That's what is more important than anything else

Only registered users are allowed to subscribe.
Passing parameter to OnSendMessage from SendMessage
 
Subscribe
Kiru Marimuthu




Posts: 8
Joined: 2017-07-20
Thanks for recommending to use SendMessage over here.Null Synchronisation Context

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);            
        }
 
Posted 06 Oct, 2017 05:37:49 Top
Andrei Smolin


Add-in Express team


Posts: 14129
Joined: 2006-05-11
Hello Kiru,

You can use a queue containing lists of resolved topics.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 06 Oct, 2017 06:22:44 Top