I’ve developed a console application to wait for an event. The main part of the code looks like the following.
static void Main(string[] args)
{
// get lync client
var getclient = LyncClient.GetClient();
// register for conversation event
getclient.ConversationManager.ConversationAdded += Conversation_ConversationAdded;
}
What I wish for is to run this in the background, therefore I’ve changed its output to windows application. But it seems that the application ends once it is launched. Is there a way to keep the application alive?
Obviously I cannot use Console.Readline() since I wish to hide it. For now I’m using System.Threading.Thread.Sleep(int.MaxValue), but I don’t think it’s a good idea anyway since there’s a limit to it.
Not sure if the issue lies within my code, or I just need something to keep it alive. Any pointers?
Run it as a WPF application with a hidden main window that has the property ShowInTaskbar = false. That way it will interact with the Lync Client and not show up on the user’s desktop.