Kbase P179666: How to modify Dynamics icfstart.p to load a .NET form
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  12/28/2010 |
|
Status: Unverified
GOAL:
How to modify Dynamics icfstart.p to load a .NET form
GOAL:
Is it possible to use .NET forms in a Dynamics application?
FACT(s) (Environment):
Windows
OpenEdge 10.2x
Dynamics
FIX:
To allow the Dynamics framework to load a .NET form upon startup, modify the main block in the icfstart.p file before the publish of of "ICFSTART_BeforeShutdown" to load your .NET form.
For example, the following internal procedure could be added to parse the -param startup parameter for the name of the form to load:
PROCEDURE ipStartupForm:
DEFINE VARIABLE cClassFormName AS CHARACTER NO-UNDO.
DEFINE VARIABLE clForm AS CLASS Progress.Windows.Form NO-UNDO.
/* Get the Form Class name */
cClassFormName = fnGetFormClassName().
IF cClassFormName BEGINS "Error: ":U THEN
UNDO, THROW NEW Progress.Lang.AppError(SUBSTRING(cClassFormName, 8), 1).
clForm = DYNAMIC-NEW cClassFormName().
WAIT-FOR System.Windows.Forms.Application:Run ( clForm ).
/* We're done. Cleanup in the Finally block. */
RETURN "":U.
CATCH e AS Progress.Lang.Error:
RETURN e:GetMessage(1).
END CATCH.
FINALLY:
IF VALID-OBJECT (clForm) THEN
DELETE OBJECT clForm.
END FINALLY.
END PROCEDURE.
The above procedure procedure can be called from the main block as the following code fragment shows:
/* This is the spot where we changed icfstart to run the GUI for .NET form */
RUN ipStartupForm.
IF RETURN-VALUE <> "":U THEN DO:
MESSAGE RETURN-VALUE VIEW-AS ALERT-BOX.
END.
lICF = DYNAMIC-FUNCTION("isICFRunning":U IN THIS-PROCEDURE) = YES NO-ERROR.
ERROR-STATUS:ERROR = NO.
/* Publish the shutdown event. This allows other code, such as RoundTable
* to trap this event and set a special -icfparam parameter if they want to. */
PUBLISH "ICFSTART_BeforeShutdown".