protected void Reply(IAssociable <TKey> repliedData) { //如果返回的数据为空或者“Replied”事件为空则直接退出 if (repliedData == null || this.Replied == null) { return; } //获取返回对象的关联对象的键值 var associatedKey = repliedData.GetAssociatedKey(); //回调当前返回数据对应的所有回调方法 RaiseReplied(associatedKey, new DispatcherRepliedEventArgs(repliedData, DispatcherRepliedReason.Reply)); }
private void Channel_Dispatched(object sender, DispatchEventArgs e) { IAssociable <TKey> associable = e.Data as IAssociable <TKey>; if (associable == null) { return; } var key = associable.GetAssociatedKey(); //if(e.Succeed) // _dispatching[key].Channels.Remove((IDispatch)sender); //else // _dispatching[key].Channels[(IDispatch)sender] = true; if (_dispatching[key].Channels.Count < 1) { this.Reply(associable); } }