Application sharing modality event handling

Lync 2013

Beyond the basics topic

Learn about making your application UI responsive to the events raised by Microsoft Lync 2013 API application sharing modality in Lync 2013 conversations.

Last modified: January 09, 2013

Applies to: Lync 2013 | Lync Server 2013

The events on the Microsoft.Lync.Model.Conversation.Sharing.ApplicationSharingModality class inform you about changes to available resources, resource control requests, sharing participant state changes, and currently sharing participant.

Important note Important

Application sharing events are raised for all shareable resources, including the user’s desktop and any display attached to the computer. The set of running applications, desktop, and monitors is known as locally shareable resources.

Handling all application sharing events in your Lync 2013 API-enabled application is critical to the functionality of application sharing. All the events described in this topic are raised on the conversation Microsoft.Lync.Model.Conversation.Sharing.ApplicationSharingModality object, not on an application sharing modality owned by an individual participant.

Application sharing modality state and property changed events

The application sharing modality Modality.ModalityStateChanged event lets you know when the Microsoft.Lync.Model.Conversation.Sharing.ApplicationSharingModality in a conversation is connected and resource sharing can begin. You can monitor the progress of the modality connection operation by handling this event.

To give a user an optimal sharing experience, you should not connect the modality until the local user has selected a resource to share. In the Modality.ModalityStateChanged, start sharing the selected resource if the new state of the modality is ModalityState.Connected. For information about sharing a resource, see How to: Get a shareable resource and share it in a conversation.

Shared resources collection changed

Most of the locally shareable resources on a computer are processes that can be started and stopped by the user at any time. On the other hand, the desktop and attached displays are usually available when the conversation is connected. Use the ApplicationSharingModality.LocalSharedResourcesChanged event to catch a notification of a new process or removed process to update the shareable resource list in your UI.

Resource sharer changed

In a multi-party conversation that has more than one presenter, the current resource sharer changes whenever a presenter shares a resource. Use this event to get and display the name of the participant who is now sharing a resource.

Tip Tip

To share a resource, a user uploads and presents a resource that he or she owns. To control a resource, a user requests or is granted control of a resource that is shared by another user.

Resource controller changed

Your application should always show the name of the current resource controller. Although you can read the ApplicationSharingModality.Controller property to get the participant that is controlling the resource on the sharing stage, you can simply react to the ApplicationSharingModality.ControllerChanged event to get notification when resource control is changed.

Resource control request received

The owner of a resource can give permission to another participant to control a resource. Permission can be granted when requested by another user or permission can be offered to another user without a prior request. For information about handling control requests, see How to: Accept or decline a request to control a shared resource.