Some may have seen this Add-In somewhere already as it has been around for some time. This is a high level explanation to how it was actually done.
First thing to mention here is that the base for this Add-In is a publicly available sample of Presence Controls intended for Office Communicator 2007. You can find the Sample Code, prerequisites and updates as well as related stuff here: Microsoft Office Communicator 2007 Presence Controls. You can use these Presence Controls with either Microsoft Office Communicator 2007 or with Microsoft Lync.
So in order to build this Sample Presence Add-In Control for Dynamics NAV, you can simply use the output from the above sample, which is a Set of Presence Controls contained in – PresenceControls.dll
Next, create a new Project and include a reference to the Presence Control Set – this is the Dynamics NAV Add-In Project.
For more details on the basics structure and references for a Dynamics NAV Add-In: How to: Create a RoleTailored Client Control Add-in.
After that you have your CreateControl() function which is returning the Add-In control to NAV. The two main things you want to return here are the Objects to be shown in your add-in on screen together The Presence Control and a Textbox:
Dim persona As New persona ‘the presence control, a persona object from the Presence Controls Set
Dim txtbox As New System.Windows.Forms.TextBox ‘a regular text box
In order to display these two controls nicely “as one” you may want to place them in some kind of parent container/containers to have them Size and move properly together. I used System.Windows.Forms.TableLayoutPanel but there are probably better ways to do this.
Finally you will have to need to ensure the control is updated properly:
The Persona Control has a SipUri property, which is basically what you need to bind your Add-In Value to, so you need to ensure that changes to the value are passed both to the Textbox and the Persona Object.
As usual there are a number of ways some nicer than other to achieve this, you could either bind the Persona property SipUri to the Textbox Value itself or handle the updates of the value to both controls manually in your add-in, but the basics are to simply ensure the SipUri of the Persona always needs to be kept as the same as the value of the TextBox, for example:
' Copyright © Microsoft Corporation. All Rights Reserved.
' This code released under the terms of the
' Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)
Public Property Value() As String Implements Microsoft.Dynamics.Framework.UI.Extensibility.IValueControlAddInDefinition(Of String).Value
Set(ByVal value As String)
persona.SipUri = value
txtbox.Text = value
If all works out well you’ll end up with an Add-in control looking something like this. (See video)