| Platform SDK: Team Productivity Update |
The code discussed in this topic uses the three methods provided by the TeamAppManager object of the Application Instantiation Model (AIM).
The following code handles the Click event for the Register button on the form that gathers the parameters for the call to the TeamAppManager.RegisterAppFactory method.
Private Sub cmdRegister_Click()
Dim oTK As TeamAppManagerLib.TeamAppManager
On Error GoTo ErrorHandler
' Create a new instance of the TeamAppManager
Set oTK = New TeamAppManagerLib.TeamAppManager
' Register the application with the TPU and display the new FactoryID (GUID)
txtFactoryIDResult.Text = oTK.RegisterAppFactory( _
txtInstantiateURL.Text, _
cmbTeamFactoryType.ItemData(cmbTeamFactoryType.ListIndex), _
txtFriendlyName.Text, _
txtIconPath.Text, _
txtDescription.Text)
' Cleanup
Set oTK = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Description
End Sub
The following code handles the Click event for the Friendly Name button on the form that gathers the parameters for the call to the TeamAppManager.FriendlyNameFromGUID method.
Private Sub cmdFriendlyName_Click()
Dim oTK As TeamAppManagerLib.TeamAppManager
Dim sFactoryID As String
On Error GoTo ErrorHandler
' Create a new instance of the TeamAppManager
Set oTK = New TeamAppManagerLib.TeamAppManager
' Get and display the friendly name based on the FactoryID (GUID)
txtFriendlyNameResult.Text = oTK.FriendlyNameFromGUID(txtFactoryIDResult.Text)
' Cleanup
Set oTK = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Description
End Sub
The following code handles the Click event for the Unregister button, which calls the TeamAppManager.UnregisterAppFactory method. The method takes the return value from the call to RegisterAppFactory, which returns a GUID that uniquely identifies the application template. The call to UnregisterAppFactory removes the application template from the TPU database.
Private Sub cmdUnregister_Click()
Dim oTK As TeamAppManagerLib.TeamAppManager
Dim sFactoryID As String
On Error GoTo ErrorHandler
' Create a new instance of the TeamAppManager
Set oTK = New TeamAppManagerLib.TeamAppManager
' Unregister the application using the FactoryID (GUID)
Call oTK.UnregisterAppFactory(txtFactoryIDResult.Text)
' Display the Unregistered
txtFactoryIDResult.Text = ""
txtFriendlyNameResult.Text = ""
' Cleanup
Set oTK = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Description
End Sub