public SelectContactDialog(ContactManager lyncContactManager) { InitializeComponent(); Debug.Assert(lyncContactManager != null); //adds a contact list to itself SimpleContactFinderControl contactListControl = new SimpleContactFinderControl(lyncContactManager, "Find contact by URI"); contactListControl.ContactSelected += new ContactSelected(contactListControl_ContactsSelected); //adds the contact list control to the UI contactListControl.Dock = DockStyle.Fill; this.Controls.Add(contactListControl); }
public MainWindow() { InitializeComponent(); try { //obtains the lync client instance client = LyncClient.GetClient(); //creates the contact list user control contactFinderControl = new SimpleContactFinderControl(client.ContactManager, "Create a conversation"); //register for the control ContactsSelected event contactFinderControl.ContactSelected += new ContactSelected(contactFinderControl_ContactSelected); //creates the Sign-In user control signInControl = new SignInControl(client); } //if the Lync process is not running and UISuppressionMode=false, //this exception will be thrown catch (ClientNotFoundException) { //explain to the user what happened MessageBox.Show("Microsoft Lync does not appear to be running. Please start Lync."); //exit (in a fully implemented application, a retry here would be recommended) Application.Exit(); } catch (NotStartedByUserException) { //explain to the user what happened MessageBox.Show("Microsoft Lync does not appear to be running. Please start Lync."); //exit (in a fully implemented application, a retry here would be recommended) Application.Exit(); } }