//public virtual event EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>> MessageContextRemoved //{ // add // { // EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>> eventHandler = this.MessageContextRemoved; // EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>> eventHandler2; // do // { // eventHandler2 = eventHandler; // EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>> value2 = (EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>>)Delegate.Combine(eventHandler2, value); // eventHandler = Interlocked.CompareExchange<EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>>>(ref this.MessageContextRemoved, value2, eventHandler2); // } // while ((object)eventHandler != eventHandler2); // } // remove // { // EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>> eventHandler = this.MessageContextRemoved; // EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>> eventHandler2; // do // { // eventHandler2 = eventHandler; // EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>> value2 = (EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>>)Delegate.Remove(eventHandler2, value); // eventHandler = Interlocked.CompareExchange<EventHandler<WeixinContextRemovedEventArgs<TRequest, TResponse>>>(ref this.MessageContextRemoved, value2, eventHandler2); // } // while ((object)eventHandler != eventHandler2); // } //} private void OnMessageContextRemoved(WeixinContextRemovedEventArgs <TRequest, TResponse> e) { EventHandler <WeixinContextRemovedEventArgs <TRequest, TResponse> > messageContextRemoved = this.MessageContextRemoved; if (messageContextRemoved != null) { messageContextRemoved(this, e); } }
public virtual void OnRemoved() { WeixinContextRemovedEventArgs <TRequest, TResponse> e = new WeixinContextRemovedEventArgs <TRequest, TResponse>(this); this.OnMessageContextRemoved(e); }