J
jquerijero
Guest
[quote user="DenDuze"] Hi, We need to replace some Visual studio code with Progress code but I have no idea how i need to translate the following: ExtensionManager.Instance.Invoke(Of IPaymentHandlerExtension)(Sub(x) x.HandlePayment(paymentId, amount, comment)) Can someone give me a direction? Regards Didier [/quote] Not so sure if ExtensionManager Invoke method is just the System.Reflection Invoke method, but here is a sample code to dynamically invoke a class method in ABL. DEFINE VARIABLE oMethod AS System.Reflection.MethodInfo NO-UNDO. DEFINE VARIABLE oType AS System.TYPE NO-UNDO. DEFINE VARIABLE bindingAttr AS BindingFlags NO-UNDO. DEFINE VARIABLE arrayVar AS System.Object EXTENT 2 NO-UNDO. bindingAttr = BindingFlags:Instance. bindingAttr = CAST(EnumHelper:Or(bindingAttr, BindingFlags:NonPublic), BindingFlags). oType = Progress.Util.TypeHelper:GetType("System.Windows.Forms.Control"). // IPaymentHandlerExtension oMethod = oType:GetMethod("RemovePendingMessages", bindingAttr). // HandlePayment IF VALID-OBJECT(oMethod) THEN oMethod:Invoke(THIS-OBJECT, arrayVar). THIS-OBJECT - is the object instance (x in your sample) arrayVar - parameters to method you are calling
Continue reading...
Continue reading...