Export (0) Print
Expand All

Exploring Lync SDK ProposalTracker Sample: Proposal Details (Part 2 of 3)

Summary:   This article describes how to use the ProposalTracker sample application that is included with the Microsoft Lync 2010 SDK.

Applies to:   Microsoft Lync 2010 SDK | Microsoft Lync 2010

Published:   July 2011 | Provided by:   John Austin, Microsoft | About the Author

Contents

This article is the second in a three-part series of articles about how to use the ProposalTracker sample Silverlight application.

Part 2 continues a discussion of the ProposalTracker sample application. Part 1 describes the main page of ProposalTracker, the object model of the sample, and the code that connects Lync controls to the page. Part 2 describes how the Proposal Details page is created, how Lync controls are connected, and how a user starts contextual conversations from the page.

ProposalDetails organizes the page elements by using a PageFrame and a set of Grid elements. The two Lync controls are added as custom content in a user control that is defined by the PortletFrame class. Figure 1 shows you the layout of the child window and the placement of the ContactCard Control and the CustomContactList Control.

Figure 1. The Proposal Details page element layout

The Proposal Details page element layout

ContactCard

The ContactCard Control is added to the page and only two properties are modified from default values. IsExpanded is set to true so that the ContactCard is shown fully expanded on the page. The Source property value is bound to Proposal.SponsorUri in order to show the contact information about the proposal sponsor.

Figure 2. The contact card of the project sponsor

The contact card of the project sponsor.

The following example shows how the ContactCard Control is added to the PortletFrame class instance as a PortletFrame.CustomContent property where CustomContent is defined as the ContentProperty of the element. The LyncControls:ContactCard.Source property is bound to the Proposal.SponsorUri property.

                    <!--Portlet Frame: To display a ContactCard for the sponsor. 
                    Bound to SponsorUri property or a proposal-->
                    <ProposalTracker:PortletFrame
                        PortletTitle="SPONSOR"
                        Grid.Row="2"
                        Grid.Column="0"
                        Grid.RowSpan="2"
                        Margin="3">
                        <ProposalTracker:PortletFrame.PortletIcon>
                            <ContentControl>
                                <Image
                                    Source="{StaticResource FabrikamTransparentLogo}"
                                    Margin="0,0,0,3"
                                   />
                            </ContentControl>
                        </ProposalTracker:PortletFrame.PortletIcon>
                        <ProposalTracker:PortletFrame.CustomContent>
                            <LyncControls:ContactCard
                                IsExpanded="True"
                                Source="{Binding SponsorUri}"
                               />
                        </ProposalTracker:PortletFrame.CustomContent>
                    </ProposalTracker:PortletFrame>


CustomContactList

The members of the CustomContactList Control on the proposal details page are specified by binding the value of the ItemsSource property of the CustomContactList Control to the Proposal.Team property. To provide context to any IM conversation started with a member of the CustomContactList Control, the ContextualInformation property is bound to Proposal.ContextualInfo.

Figure 3. The custom contact list control in the Proposal Details page

The custom contact list control in Proposal Detail

The following example declares an instance of the PortletFrame class and positions it within the page grid. The ItemsSource and ContextualInformation properties of the CustomContactList Control are bound to properties of Proposal.

                    <!--Portlet Frame: To display a Custom Contacts list for the proposal team. 
                    Bound to Team property or a proposal-->
                    <ProposalTracker:PortletFrame
                        PortletTitle="PROPOSAL TEAM"
                        Grid.Row="2"
                        Grid.Column="2"
                        Grid.RowSpan="2"
                        Margin="3">
                        <ProposalTracker:PortletFrame.PortletIcon>
                            <ContentControl>
                                <Image
                                    Source="{StaticResource FabrikamTransparentLogo}"
                                    Margin="0,0,0,3"
                                   />
                            </ContentControl>
                        </ProposalTracker:PortletFrame.PortletIcon>
                        <ProposalTracker:PortletFrame.CustomContent>
                            <!--Contextinfo is set to the context info defined in the proposal-->
                            <!--For more details please refer to the comments in Proposal.cs-->
                            <LyncControls:CustomContactList
                                x:Name="CustomContactListControl"
                                ItemsSource="{Binding Path=Team}" ContextualInformation="{Binding ContextualInfo}">                                
                            </LyncControls:CustomContactList>
                        </ProposalTracker:PortletFrame.CustomContent>
                    </ProposalTracker:PortletFrame>


In a real-world business-intelligence (BI) application, users often have to message other users in the context of application data. The context is typically a transaction or a business document such as a proposal. The ProposalTracker sample shows how to start a conversation that uses a contextual application called Mini ProposalTracker to represent contextual information. Mini ProposalTracker is registered on both the computer that is running ProposalTracker and another user’s computer.

To get the contextual conversation feature to work in ProposalTracker, four steps are required:

Tip Tip

The registration package for Mini ProposalTracker creates a string value in the Mini ProposalTracker key named "InternalURL." This string specifies the location of MiniProposalTracker.xap and the supporting application extension files. Microsoft Lync 2010 locates and starts Mini ProposalTracker based on this string. If you want to give users the option of opening an HTML page in a browser, then you set the ContextualLink property.

The following example instantiates a new instance of Microsoft.Lync.Controls.ConversationContextualInfo and sets the properties appropriate for Mini ProposalTracker.

        //Field to create and return a ContextualInfo of a proposal.
        //This is used in the MiniProposalProject to initiate a Contextual Conversation.
        public ConversationContextualInfo ContextualInfo { 
            get
            {
                //If _conversationContextualInfo is null, create a new one and return it.
                //If not, return itself. 
                return _conversationContextualInfo ??
                       (_conversationContextualInfo = new ConversationContextualInfo{
                                                       //Description is taken from the proposal details
                                                       ApplicationData = Description, 
                                                       //This should be the same GUID you're using in the reg file.
                                                       ApplicationId = "{AFCFD912-E1B7-4CB4-92EE-174D5E7A35DD}",
                                                       //Project name is the current proposal's projectname.
                                                       Subject = ProjectName,
                                                       //This is a link to the main page. It is optional but good to have.
                                                       ContextualLink = "\\\\SharedFilesPath\\ProposalTracker\\ProposalTrackerTestPage.html"
                                                      }
                       );
            }
        
        }

For information about how to use Install Registration to register contextual conversation applications, see Register Contextual Conversation Packages.

TipTip

You can set the ContactBase.ContextualInformation property on any Lync control that inherits Microsoft.Lync.Controls.ContactBase. This includes the ContactCard Control on the Proposal Details page. By using this approach you enable contextual conversations on all such controls.

Part 2 discusses how to position a ContactCard Control and a CustomContactList Control on a Microsoft Silverlight page by dropping the controls on the page and then setting several control properties. In addition, part 2 discusses how to set the CustomContactList Control with the contextual information that is needed to start contextual IM conversations. Exploring Lync SDK ProposalTracker Sample: MiniProposalTracker CWE Application (Part 3 of 3) discusses the Mini ProposalTracker Conversation Window Extension (CWE) application that represents the actual application data context that is shared between conversation participants.

For more information, see the following resources:

John Austin, Microsoft, is a programmer/writer in the Lync client SDK documentation team. He has been writing Microsoft technical documentation for four years. Prior to working for Microsoft, John spent two decades as a software developer.

Show:
© 2014 Microsoft