private void MainForm_Load(object sender, EventArgs args) { try { DebugLog.Write("STARTUP"); LyncClient client = LyncHelper.GetLyncClient(); if (client == null) { Application.Exit(); return; } // subscribe to conversation added/removed events client.ConversationManager.ConversationAdded += ConversationAdded; client.ConversationManager.ConversationRemoved += ConversationRemoved; //// subscribe to contact availibility changes //foreach (var group in client.ContactManager.Groups) //{ // //Debug.WriteLine("{0}: {1}", group.Name, group.Count); // foreach (var contact in group) // { // contact.ContactInformationChanged += ContactInformationChanged; // ContactStatus status = GetContactStatus(contact); // if (status != null) // { // Debug.WriteLine("{0} initial status: {1} {2}", status.Username, status.Availability, status.Activity); // } // } //} DebugLog.Write("Waiting for incoming messages..."); // check for shutdown of lync client _lyncStatusTimer = new System.Threading.Timer(CheckLyncProcessStatus, null, 1000, 1000); } catch (Exception ex) { LogException("InitializeLogger", ex); LyncHelper.ShutdownLync(); Environment.Exit(0); } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs args) { LyncHelper.ShutdownLync(); }