Click or drag to resize

Using launch service

Overview

The FlexPendant SDK provides a launch service, which enables a FlexPendant SDK application to start a standard ABB application, such as the program editor or the jogging view.

It is also possible to start another custom application by specifying proxy assembly name and the application view class.

For more information about how to add and launch another view of your own application, see Adding a view to a custom application.

Note Note

To launch a view in order to edit a specified rapid data instance, another mechanism is available. For more information, see Using standard dialog box to modify data.

Installing ITpsViewSetup

It is only classes that inherit the ITpsViewSetup interface that can launch other applications. The Install method, which is called when your custom application is launched, has a sender argument. Your application needs to save this object to use the ITpsViewLaunchServices interface. It is used by the launch service to call LaunchView and CloseView.

C#
//declaration
private ITpsViewLaunchServices iTpsSite;
......
//Install method of the TpsView class
bool ITpsViewSetup.Install(object sender,object data)
{
if (sender is ITpsViewLaunchServices) {
// Save the sender object for later use
this.iTpsSite = sender as ITpsViewLaunchServices;
return true;
}
return false;
}
VB
 //declaration
 Private iTpsSite As ITpsViewLaunchServices
.....
 //Install method of the TpsView class
 Function Install(ByVal sender As System.Object, ByVal data As System.Object) As Boolean Implements ITpsViewSetup.Install
 If TypeOf sender Is ITpsViewLaunchServices Then
 // Save the sender object for later use
 Me.iTpsSite = DirectCast(sender, ITpsViewLaunchServices)
 Return True
 End If
 Return False
 End Function
Launching standard views

Using the FpStandardView enumerator, the following standard views can be started using the launch services:

  • Program editor

  • Program data

  • Jogging

  • Logoff

  • Backup/Restore

Tip Tip
Launching the Program data view is the best way to let end-users create new RAPID data.
Note Note

To launch the program editor an initialization object of RapidEditorInitData type can be used as argument. It specifies the task, module and row that the Program editor should display when it opens. For the other standard views no InitData can be used.

LaunchView / CloseView example

In the following example, the program editor is launched at a specified routine. First initData is created. Then the reference to the sender object, retrieved by the Install method in the previous example, is used to call LaunchView.

The cookie out argument is later used to specify the view to be closed by the CloseView method.

C#
RapidEditorInitData initData = new RapidEditorInitData(task, module,routine.TextRange.Begin.Row;
if(this.iTpsSite.LaunchView(FpStandardView.RapidEditor,initData,true,out this.cookieRapidEd)!= true) {
GTPUMessageBox.Show(this, null,"Could not start RapidEditor application");
return;
}
.....
this.iTpsSite.CloseView(this.cookieRapidEd);
VB
Dim initData As RapidEditorInitData = New RapidEditorInitData (ATask, AModule, ARoutine.TextRange.Begin.Row)
If Not (Me.iTpsSite.LaunchView(FpStandardView.RapidEditor, initData, True, Me.cookieRapidEd) = True) Then
GTPUMessageBox.Show(Me, Nothing, "Could not start RapidEditor application")
Return
End If
......
Me.iTpsSite.CloseView(Me.cookieRapidEd)

What happens if the specified view is already open when the call is made? The third argument specifies application behavior in this case. If true, another instance of the view is launched. If false, the already opened view gets focus. Notice, however, that creating a new instance is not possible for all standard views. The Jogging view, for example, is not allowed multiple instances.

Launching custom applications

The launch service can also be used to launch another FlexPendant SDK application. The name of the proxy assembly along with the fully qualified class name should be used as arguments.

C#
if (this.iTpsSite.LaunchView("TpsViewCustomApp.gtpu.dll", "ABB.Robotics.SDK.Views.TpsViewCustomApp", null, true, out this.cookieUser)!= true) {
GTPUMessageBox.Show(this, null,"Could not start User application");
return;
}
VB
If Not (Me.iTpsSite.LaunchView("TpsViewCustomApp.gtpu.dll", "ABB.Robotics.SDK.Views.TpsViewCustomApp", Nothing, True, Me.cookieUser) = True) Then
GTPUMessageBox.Show(Me, Nothing, "Could not start User application")
Return
End If
Note Note

It is the namespace of the proxy assembly, ABB.Robotics.SDK.Views, which should be used to specify the TpsView class.

Note Note

By using the argument cookieUser your application can close the launched custom application in the same way as in the preceding Using launch service example.