none
Handling raised events in Lync RRS feed

  • Question

  • i was advised to move this question here so here goes.

    hi all

    i am looking to put together a Lync 2010 application and have been experimenting to see if it is feasible or not. i have some code on a main form and a class for the lync functions.

    I have a basic understanding of how the events are being raised but have come to a bit of a problem.

    I can subscribe to the event and get it to acknowledge in the code i have written however the problem is getting my code to respond without causing a problem.

    Initially my code was throwing a thread error and would not execute any code in the function i had written to handle the event, so i instantiated a new form and added a control to it, this would show fine but i could not interact with any of the controls,  i suspect the thread to be the issue here.

    i suspect this is because the incoming event is on a thread generated by Lync not my code and needs some additional coding to make it thread safe but i am unsure what i need to do to achieve this. I am presuming all the calls from Lync are Asynchronous.

    If i am catching the events from Lync, can i only execute lync related code in the function ? Why cant i call out to another function without getting the thread issue ?

    i have looked at delegates and the microsoft page on creating a thread safe call but i dont quite understand the reasoning behind them. If i am listening for an event within my code why is the thread this uses causing me a problem, does it not belong to my code ? What are my options here ?

    TIA

    Monday, June 10, 2013 9:09 PM

Answers

  • The Lync client API does follow asynchronous coding patterns. This sounds like a more general asynchronous coding question that isn't specific to Lync. It sounds like you are dealing with issues around multi-threading, and being unable to access the main UI thread. If you want to interact with the main UI thread, then I suggest looking into using the Dispatcher object.

    There shouldn't be anything about the Lync client API that prevents you from having multiple threads, so you may get more help from general C# coding forums. Doesn't hurt to try here, though ;) But you may just not get as much help here unless it's a specific Lync SDK question.


    -- How To Ask a Question: http://support.microsoft.com/kb/555375 -- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

    Monday, June 10, 2013 11:52 PM