From within the ExecuteAPI method of our Client API, instantiate the form.
Dim lfrmDoSomething As New DoSomethingGUI(SPFWindowsFormsClient, Me)
Notice that the SPFWindowsFormClient is available as a member of the Client API class. You can simply pass in Me for the Client API parameter.
The invocation is different depending on whether you want a modal or modeless operation. If you want a modal operation, do the following.
If lfrmDoSomething.ShowDialog() = Windows.Forms.DialogResult.OK Then
' Complete the mission
End If
If you want a modeless operation, do the following
MainForm.ShowForm(CType(lfrmDoSomething, SPF.Client.Forms.BaseSystemForm), SPF.Client.WinMngr.Common.SPFWindowType.Other)
For this example, let's just display the form in a modal fashion, and your ExecuteAPI method should now look like this:
Protected Overrides Sub ExecuteAPI()
Dim lfrmDoSomething As New SPF.Client.Forms.DoSomethingGUI(SPFWindowsFormsClient, Me)
If lfrmDoSomething.ShowDialog() = Windows.Forms.DialogResult.OK Then
' Complete the mission
End If
End Sub
You can compile and begin the debugging process again. To change to a modeless operation and make the form part of the Desktop Client, you need to change the ExecuteAPI to something like this:
Protected Overrides Sub ExecuteAPI()
Dim lfrmDoSomething As New SPF.Client.Forms.DoSomethingGUI(SPFWindowsFormsClient, Me)
'If lfrmDoSomething.ShowDialog() = Windows.Forms.DialogResult.OK Then
' ' Complete the mission
'End If
MainForm.ShowForm(CType(lfrmDoSomething, SPF.Client.Forms.BaseSystemForm), SPF.Client.WinMngr.Common.SPFWindowType.Other)
End Sub