How to pass value/parameter into a "public delegate void"?

jaYCee.1750jaYCee.1750 USMember ✭✭

Hi guys! Please help me with this. Let's say I have this code here...

        void IScanSuccessCallback.barcodeDetected(MWResult result)
        {
            if (result != null)
            {
                try
                {
                    var scan = Element as BarcodeScannerModal;

                    if (scan == null)
                        return;
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
            }
        }

...and I want that value of MWResult result be passed to this one...

    [System.Runtime.InteropServices.ComVisible(true)]
            public delegate void EventScanHandler(MWResult result);

I'm really having trouble with this one.

Answers

  • You can pass the result as a parameter when making call to method of this delegate e.g.

    EventScanHandler handler=new EventScanHandler(methodtobecalled);
    handler(result);

    Hope this helps.

Sign In or Register to comment.