[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Translate some Visual Studio code

Status
Not open for further replies.
D

DenDuze

Guest
Hi Gus/jquerijero, The problem is that I also do not know what all this does. We need to put some existing functionality (currently written in vb) in our Progress application. The person who implemented that functionality only executed ths following code: ' Handle payments If RadioButtonShop.Checked = True Then For Each row As DataGridViewRow In DataGridViewInvoicePayments.Rows Dim amount = cVerGeneralSubsAndFunctions.ReturnSingleIfNull(DataGridViewInvoicePayments("PaymentAmount", row.Index).Value) If amount < 0.01 Then Continue For Dim comment = String.Format("{0}-{1}/{2}", TextBoxDocumentNumber.Text, VERPigoMainForm.strBranchCode, Strings.Right(MaskedTextBoxCustomerNumber.Text, VERPigoMainForm.intLengthCustomerNumber)) Dim paymentId = CInt(row.Cells("PaymentMethodID").Value) ExtensionManager.Instance.Invoke(Of IPaymentHandlerExtension)(Sub(x) x.HandlePayment(paymentId, amount, comment)) Next End If He tells me that when he calls that ExtensionManager:instance:Invoke a form is shown where the user can make some payments. So the easiest way for me to implement that functionality is try to do the same but I have no idea what that line of code just does (I'm no .net programmer, I understand a bit but ...) If needed I can provide you the ExtentionManager.vb file but maybe the comment on top of that file can help This class will scan a directory for dll's with types that implement IExtension 'Any types found are instanciated and available to call using the ExtensionMethod.Invoke(Of T) method The Invoke method has the following code: Public Sub Invoke(Of T)(act As Action(Of T)) For Each extension As IExtension In _extensions.Where(Function(e) GetType(t).IsAssignableFrom(e.GetType)) Dim extOfT = DirectCast(extension, T) act(extOfT) Next End Sub The IPaymentHandlerExtension has the following code: Public Interface IPaymentHandlerExtension Inherits IExtension Function HandlePayment(paymentMethodId As Integer, amount As Single, comment As String) As Boolean End Interface There is also a class AdyenPaymentHandlerExtension that Implemants the iPaymentHandlerExtension where the HandlePayment method is implemented For the rest there are some other files but as far as I know (hope) I do not need to know what these do because when I could replace that ExtensionManager.Instance.Invoke(Of IPaymentHandlerExtension)(Sub(x) x.HandlePayment(paymentId, amount, comment)) It should hopefully work (that's what that person who made the vb-code said) regards Didier

Continue reading...
 
Status
Not open for further replies.
Top