public static void Combine(object rcw, Guid iid, int dispid, Delegate d) { rcw = ComEventsHelper.UnwrapIfTransparentProxy(rcw); lock (rcw) { ComEventsInfo local_2 = ComEventsInfo.FromObject(rcw); ComEventsSink local_3 = local_2.FindSink(ref iid) ?? local_2.AddSink(ref iid); (local_3.FindMethod(dispid) ?? local_3.AddMethod(dispid)).AddDelegate(d); } }
/// <summary> /// Adds a delegate to the invocation list of events originating from the COM object. /// </summary> /// <param name="rcw">COM object firing the events the caller would like to respond to</param> /// <param name="iid">identifier of the source interface used by COM object to fire events</param> /// <param name="dispid">dispatch identifier of the method on the source interface</param> /// <param name="d">delegate to invoke when specified COM event is fired</param> public static void Combine(object rcw, Guid iid, int dispid, Delegate d) { lock (rcw) { ComEventsInfo eventsInfo = ComEventsInfo.FromObject(rcw); ComEventsSink sink = eventsInfo.FindSink(ref iid) ?? eventsInfo.AddSink(ref iid); ComEventsMethod method = sink.FindMethod(dispid) ?? sink.AddMethod(dispid); method.AddDelegate(d); } }
public static void Combine(object rcw, Guid iid, int dispid, Delegate d) { rcw = UnwrapIfTransparentProxy(rcw); lock (rcw) { ComEventsInfo info = ComEventsInfo.FromObject(rcw); ComEventsSink sink = info.FindSink(ref iid); if (sink == null) { sink = info.AddSink(ref iid); } ComEventsMethod method = sink.FindMethod(dispid); if (method == null) { method = sink.AddMethod(dispid); } method.AddDelegate(d); } }
public static void Combine(object rcw, Guid iid, int dispid, Delegate d) { rcw = ComEventsHelper.UnwrapIfTransparentProxy(rcw); object obj = rcw; lock (obj) { ComEventsInfo comEventsInfo = ComEventsInfo.FromObject(rcw); ComEventsSink comEventsSink = comEventsInfo.FindSink(ref iid); if (comEventsSink == null) { comEventsSink = comEventsInfo.AddSink(ref iid); } ComEventsMethod comEventsMethod = comEventsSink.FindMethod(dispid); if (comEventsMethod == null) { comEventsMethod = comEventsSink.AddMethod(dispid); } comEventsMethod.AddDelegate(d); } }