Application Strategies in Lync 2010 Control Applications

This topic identifies the basic strategies that can be used to add presence to Microsoft Windows Presentation Foundation (WPF) and Microsoft Silverlight applications.

Use Microsoft Lync 2010 Controls to add presence and availability information about colleagues, customers, and vendors to your new or existing applications.

Lync Control applications require the user to sign in to Microsoft Lync 2010. Each Lync Controls application connects to Microsoft Lync Server 2010 using a single out-of-process connection to Lync 2010. The application is either a WPF or Silverlight application that contains Lync Controls.

Authoring Notes

For Windows Forms and WPF applications it is common to use one thread for UI, and a separate thread for tasks such as database access or asynchronous network calls. However, in Silverlight Lync Controls applications, keep all application logic in the UI thread.

For event handling in Silverlight Lync Controls applications, you must marshal relevant event data to your UI thread using something like Dispatcher.Invoke. To do otherwise raises a cross-thread exception.

Adding Presence to an Existing WPF Application

To add Lync Controls to an existing WPF application, add project references for the Lync Control DLLs, and then add XAML code to create the Lync Controls.

To add Lync Controls to an existing WPF application

  1. Sign in to Microsoft Lync 2010.

  2. In Microsoft Visual Studio, add project references to the WPF versions of the following libraries.

    • Microsoft.Lync.Controls.dll

    • Microsoft.Lync.Controls.Framework.dll

    • Microsoft.Lync.Model.dll

    • Microsoft.Lync.Utilities.dll

  3. On the appropriate XAML page, add the following XAML text to declare the Lync Controls namespace.

    xmlns:controls="clr-namespace:Microsoft.Lync.Controls;assembly=Microsoft.Lync.Controls"
    
  4. Author the appropriate XAML code to add the Lync Controls. For example, the following XAML will add a MyStatusArea control. For more information, see Walkthrough: Presence Hello World.

    <StackPanel>
      <controls:MyStatusArea PhotoDisplayMode="Small"/>
    </StackPanel>
    
  5. Build and run the application.

Adding Presence to an Existing Silverlight Application

To add Lync Controls to an existing Silverlight application, add project references for the Lync Control DLLs, and then add XAML code to create the Lync Controls.

To add Lync Controls to an existing Silverlight application

  1. Sign in to Lync 2010.

  2. Add project references to the Silverlight versions of the following libraries.

    • Microsoft.Lync.Controls.dll

    • Microsoft.Lync.Controls.Framework.dll

    • Microsoft.Lync.Model.dll

    • Microsoft.Lync.Utilities.dll

  3. On the appropriate XAML page, add the following XAML text to declare the Lync 2010 namespace.

    xmlns:controls="clr-namespace:Microsoft.Lync.Controls;assembly=Microsoft.Lync.Controls"
    
  4. Author the appropriate XAML code to add the Lync Controls. For example, the following XAML will add a MyStatusArea control. For more information, see Lync 2010 Controls Walkthroughs.

    <StackPanel>
      <controls:MyStatusArea PhotoDisplayMode="Small"/>
    </StackPanel>
    
  5. Build and run the application.

See Also

Other Resources

Lync 2010 Controls