Exercise 2: Extending the Conversation Window with Silverlight

Task 1 – Beginning the Exercise

In this task, you will open the project and configure it to run with your accounts.

  1. Navigate to Start >> All Programs >> Microsoft Visual Studio 2010.
  2. Click on the Microsoft Visual Studio 2010 icon to start Visual Studio 2010.
  3. Select File >> Open Project.
  4. Navigate to the folder C:\%Office365TrainingKit%\Labs\9.2\Source\Before.
  5. Open the AddingContexttoConversations solution.
  6. In Solution Explorer, right-click the LaunchLinkCWE project and select Set as Startup Project.
  7. Open the LaunchLinkCWE project.
  8. In Solution Explorer, open the app.config file.
  9. Change the PrimaryLabUserId and SecondaryLabUserId values to SIP URI of your primary and secondary lab accounts.
  10. Replace the ApplicatonGuid with a new GUID.
  11. Select View >> Task List and select Comments from the menu.
  12. Start a remote desktop session with the secondary lab user.
  13. Add localhost to Internet Explorer’s list of Trusted sites.
    1. Launch Internet Explorer.
    2. Navigate to Tools >> Internet Options and select the Security tab.
    3. Select Trusted sites and click the Sites button.
    4. Uncheck the “Require server verification for all sites in this zone” box.
    5. Add “localhost” to the list of Websites and click Close.
    6. Click OK and close Internet Explorer.
  14. Return to the primary lab user’s session.
Note:
Generate a new GUID with the GUID Generator tool. Go to Tools >> Create GUID in the Visual Studio 2010 menu or go to Start >> All Programs >> Visual Studio 2010 >> Microsoft Windows SDK Tools >> GUID Generator, select option 4, click the New GUID button, click the Copy button and paste that value into the app.config file.

Task 2 – Registering the Package

In this task, you will add the application to the computer’s registry for the primary lab user.

  1. In Solution Explorer, open PackageRegistration_LaunchLinkCWE.reg.
  2. Copy the new GUID created in the last task into the registry path.
  3. Change the Path entry to the path of LaunchLinkCWE.exe in the project’s output directory, i.e. bin\Debug. When entering the Path, use “\\” instead of “\”.
  4. Change the InternalURL and ExternalURL values to the URL of the Silverlight XAP:
    1. Highlight the LaunchLinkCWE.Silverlight.Web project in the Solution Explorer window and open its properties.
    2. Click the Web tab.
    3. Make note of the Port that Visual Studio’s Cassini web server will use to host this web application. For this lab, we will use Visual Studio’s built in Cassini web server to host the ASP.NET web application.
    4. Open PackageRegistration_LaunchLinkCWE.reg.
    5. Replace <PORT> in the value of InternalURL and ExternalURL with the port that Visual Studio’s Cassini web server will use to host this web application.
  5. Save the file.
  6. Right-click the LaunchLinkCWE project and select Open in Windows Explorer.
  7. Double click the .reg file to run it.
  8. Open the Registry Editor by going to Start and typing regedit into the search field.
  9. Navigate to HKEY_CURRENT_USER\Software\Microsoft\Communicator\ContextPackages\<GUID>.
    1. This is the GUID from the .reg file.
  10. Copy the .reg file to the clipboard and switch to the secondary lab user’s remote desktop file session.
  11. Paste the file to the desktop and double click to run it and create the same registry settings on the secondary lab user’s desktop.
Note:
If the secondary user does not have permission to view the solution, or is logged in to a different computer, copy the solution over and modify the path in the .reg file to point to the local copy of LaunchLinkCWE.exe. The same applies to the URLs that point to the SilverlightCWE.xap file.

Make sure Cassini is running before trying to access the application. To start Cassini, set LaunchLinkCWE.Silverlight.Web as your startup project. Then go to Start >> Start Without Debugging or press [Ctrl]+[F5]. Once Cassini is running, close Internet Explorer and change your startup project back to LaunchLinkCWE.

Task 3 – Adding the Silverlight Extension to the Conversation Window

In this task, we will add a Silverlight extension to a conversation window.

  1. Navigate to TODO: 9.2.7.
  2. Add the following code after the TODO: 9.2.7 comment. This defines the contextual information and applies that contextual info in the two Lync conversation controls.

    C#

    ConversationContextualInfo context = new ConversationContextualInfo(); context.Subject = selectedAccount.AccountName; context.ApplicationId = _applicationGuid; context.ApplicationData = "AccountId:" + selectedAccount.ID.ToString(); startInstantMessagingButton.ContextualInformation = context; startAudioCallButton.ContextualInformation = context;

  3. Navigate to TODO: 9.2.8.
  4. Add the following code after the TODO: 9.2.8 comment. This identifies the GUID of the SilverLight application.

    C#

    string _applicationGuid = "{<enter your guid here>}";
    Note:
    Change the _applicationGuid to match the value in the registry file.
  5. Navigate to TODO: 9.2.9.
  6. Add the following code after the TODO: 9.2.9 comment. This gets the application data defined by the ConversationContextualInfo.ApplicationData based on the conversation window extension.

    C#

    _appData = conversation.GetApplicationData(_applicationGuid);

  7. Go to Start >> Start Without Debugging or press [Ctrl]+[F5] to start the application.
  8. Select the Separate Parts Corporation account from the list.
  9. Click the IM icon at the bottom of the window.
  10. Type “Can you discuss this account?” into the conversation window and press the Enter key.
  11. Switch to the secondary lab user’s session and click the Toast message to receive the IM.
  12. The invite should display the name of the account selected in the primary lab user’s session.
  13. Verify that the conversation window contains the Silverlight extension.

  14. Click on the link in the conversation window.
  15. Verify that it loads the LaunchLink application and selects the Separate Parts Corporation account from the primary lab user’s session.

  16. Close the IM windows and the application and return to the primary lab user’s session.