/// <summary> /// 回调分发 /// </summary> /// <param name="container"></param> public static void Resolvebackcall(IUnityContainer container) { // 当已经注入了新的回调类型时 // 在此分发已经注册的回调类型, 解析完毕后分发到导出的事件进行注册 // 下列代码演示如何将 IEvent_UserExpand 接口实例化并拿到对应的实例 IEvent_UserExpand userExpand = container.Resolve <IEvent_UserExpand> (); UserExport.UserOpenDanmakuWall += userExpand.OpenConsoleWindow; }
/// <summary> /// 回调分发 /// </summary> /// <param name="container"></param> public static void Resolvebackcall(IUnityContainer container) { #region --IEvent_AppStatus-- // 解析 IEvent_AppStatus 接口 IEvent_AppStatus appStatus = container.Resolve <IEvent_AppStatus> (); // 分发 IEvent_AppStatus 接口到事件 LibExport.CqStartup += appStatus.CqStartup; LibExport.CqExit += appStatus.CqExit; LibExport.AppEnable += appStatus.AppEnable; LibExport.AppDisable += appStatus.AppDisable; #endregion #region --IEvent_DiscussMessage-- // 解析 IEvent_DiscussMessage 接口 IEvent_DiscussMessage discussMessage = container.Resolve <IEvent_DiscussMessage> (); // 分发 IEvent_DiscussMessage 接口到事件 LibExport.ReceiveDiscussMessage += discussMessage.ReceiveDiscussMessage; LibExport.ReceiveDiscussPrivateMessage += discussMessage.ReceiveDiscussPrivateMessage; #endregion #region --IEvent_FriendMessage-- // 解析 IEvent_FriendMessage 接口 IEvent_FriendMessage friendMessage = container.Resolve <IEvent_FriendMessage> (); // 分发 IEvent_FriendMessage 接口到事件 LibExport.ReceiveFriendAdd += friendMessage.ReceiveFriendAddRequest; LibExport.ReceiveFriendIncrease += friendMessage.ReceiveFriendIncrease; LibExport.ReceiveFriendMessage += friendMessage.ReceiveFriendMessage; #endregion #region --IEvent_GroupMessage-- // 解析 IEvent_GroupMessage 接口 IEvent_GroupMessage groupMessage = container.Resolve <IEvent_GroupMessage> (); // 分发 IEvent_GroupMessage 接口到事件 LibExport.ReceiveGroupMessage += groupMessage.ReceiveGroupMessage; LibExport.ReceiveGroupPrivateMessage += groupMessage.ReceiveGroupPrivateMessage; LibExport.ReceiveFileUploadMessage += groupMessage.ReceiveGroupFileUpload; LibExport.ReceiveManageIncrease += groupMessage.ReceiveGroupManageIncrease; LibExport.ReceiveManageDecrease += groupMessage.ReceiveGroupManageDecrease; LibExport.ReceiveMemberJoin += groupMessage.ReceiveGroupMemberJoin; LibExport.ReceiveMemberInvitee += groupMessage.ReceiveGroupMemberInvitee; LibExport.ReceiveMemberLeave += groupMessage.ReceiveGroupMemberLeave; LibExport.ReceiveMemberRemove += groupMessage.ReceiveGroupMemberRemove; LibExport.ReceiveGroupAddApply += groupMessage.ReceiveGroupAddApply; LibExport.ReceiveGroupAddInvitee += groupMessage.ReceiveGroupAddInvitee; #endregion #region --IEvent_OtherMessage-- // 解析 IEvent_OtherMessage 接口 IEvent_OtherMessage otherMessage = container.Resolve <IEvent_OtherMessage> (); // 分发 IEvent_OtherMessage 接口到事件 LibExport.ReceiveQnlineStatusMessage += otherMessage.ReceiveOnlineStatusMessage; #endregion // 当已经注入了新的回调类型时 // 在此分发已经注册的回调类型, 解析完毕后分发到导出的事件进行注册 IEvent_UserExpand userExpand = container.Resolve <IEvent_UserExpand> (); UserExport.UserOpenConsole += userExpand.OpenConsoleWindow; }