示例#1
0
        /// <summary>
        /// Perform all necessary calls
        /// </summary>
        public virtual void Init()
        {
            EventInfo myEventBinding = SenderObject.GetType().GetEvent(SenderEvent);

            if (myEventBinding == null)
            {
                throw new NullReferenceException(SenderEvent);
            }

            MethodInfo mInfo = ReceiverObject.GetType().GetMethod(ReceiverMethod);

            if (mInfo == null)
            {
                throw new MissingMethodException(ReceiverObject.GetType().ToString(), ReceiverMethod);
            }

            try {
                System.Delegate del = System.Delegate.CreateDelegate(myEventBinding.EventHandlerType, ReceiverObject, mInfo);
                myEventBinding.AddEventHandler(SenderObject, del);
            } catch (Exception e) {
                throw new Exception(
                          String.Format("Cannot subscribe '{0}' method on '{1}' event: {2}",
                                        ReceiverMethod, SenderEvent, e.Message), e);
            }
        }
示例#2
0
 public void SetDataReceiveHandler(NSObject obj, IntPtr context)
 {
     receiver = null;
     _SetDataReceiveHandler(obj, context);
 }
示例#3
0
 public void SetDataReceiveHandler(NSObject obj, IntPtr context)
 {
     receiver = null;
     _SetDataReceiveHandler (obj, context);
 }