Sean Ram
Posts: 27
Joined: 2013-03-13
|
I have a long running operation that I have to run in async mode. However, looks like I won't be able to use the async/await programming model inside Outlook/Add-in express because it being a COM application.
On adxRibbonButton3_OnClick event, I open a separate Windows Form and run the async operation on a button click event from that form.
The following code is on the separate Windows Form
[CODE]
private async void button1_ClickAsync(object sender, EventArgs e)
{
string msg = await Utility.DisplayPrimeCountsAsync();
// I NEED THE MSG VALUE RETURNED HERE TO DISPLAY IN UI
AddinModule.CurrentInstance.SendMessage(1);
}
As you can see, I am using the SendMessage Call as suggested in other posts here. However, there are couple of problems.
1. Send Message takes extremely long time to even get executed.
2. I need the msg value from the long running operation to be displayed on UI elements on the same form it is running. How can I achieve that?
Is there any other alternative to this problem? |
|
Andrei Smolin
Add-in Express team
Posts: 19100
Joined: 2006-05-11
|
Hello Sean,
The value passed to the SendMessage() method must be > 1024. Check if this helps.
You can save the message to a global variable before sending the message.
Andrei Smolin
Add-in Express Team Leader |
|
Sean Ram
Posts: 27
Joined: 2013-03-13
|
The value passed to the SendMessage() method must be > 1024. Check if this helps.
>> Looks like that worked. Thanks. |
|
Andrei Smolin
Add-in Express team
Posts: 19100
Joined: 2006-05-11
|
Welcome!
Andrei Smolin
Add-in Express Team Leader |
|