238 lines
8.9 KiB
C#
238 lines
8.9 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Api.Framework.Events;
|
|||
|
using Chat.Framework.QQSdk.Events;
|
|||
|
using Chat.Framework.WXSdk;
|
|||
|
using Chat.Framework.WXSdk.Events;
|
|||
|
|
|||
|
namespace Api.Framework.SDK
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// SDK事件管理
|
|||
|
/// </summary>
|
|||
|
public class SDKEvent
|
|||
|
{
|
|||
|
public SDKEvent(Plugin plugin)
|
|||
|
{
|
|||
|
this.plugin = plugin;
|
|||
|
}
|
|||
|
Plugin plugin;
|
|||
|
internal void OnEvent(object sender, object e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var type = e.GetType();
|
|||
|
if (type == typeof(ReciveIMEvent))
|
|||
|
{
|
|||
|
var item = e as ReciveIMEvent;
|
|||
|
var robot = item.RobotInfo;
|
|||
|
if (ReciveIMEvent != null)
|
|||
|
ReciveIMEvent.Invoke(sender, e as ReciveIMEvent);
|
|||
|
}
|
|||
|
else if (type == typeof(MemberPointChangeEvent))
|
|||
|
{
|
|||
|
if (MemberPointChangeEvent != null)
|
|||
|
MemberPointChangeEvent.Invoke(sender, e as MemberPointChangeEvent);
|
|||
|
}
|
|||
|
else if (type == typeof(WXReiceveFriendMsg))
|
|||
|
{
|
|||
|
if (WXReiceveFriendMsgEvent != null)
|
|||
|
WXReiceveFriendMsgEvent.Invoke(sender, e as WXReiceveFriendMsg);
|
|||
|
}
|
|||
|
else if (type == typeof(WXApplyGroup))
|
|||
|
{
|
|||
|
if (WXApplyGroupEvent != null)
|
|||
|
WXApplyGroupEvent.Invoke(sender, e as WXApplyGroup);
|
|||
|
}
|
|||
|
else if (type == typeof(WXChangeStatus))
|
|||
|
{
|
|||
|
if (WXChangeStatusEvent != null)
|
|||
|
WXChangeStatusEvent.Invoke(sender, e as WXChangeStatus);
|
|||
|
}
|
|||
|
else if (type == typeof(WXNewFriend))
|
|||
|
{
|
|||
|
if (WXNewFriendEvent != null)
|
|||
|
WXNewFriendEvent.Invoke(sender, e as WXNewFriend);
|
|||
|
}
|
|||
|
else if (type == typeof(WXNewMemer))
|
|||
|
{
|
|||
|
if (WXNewMemerEvent != null)
|
|||
|
WXNewMemerEvent.Invoke(sender, e as WXNewMemer);
|
|||
|
}
|
|||
|
else if (type == typeof(WXApplyFriend))
|
|||
|
{
|
|||
|
if (WXApplyFriendEvent != null) WXApplyFriendEvent.Invoke(sender, e as WXApplyFriend);
|
|||
|
}
|
|||
|
else if (type == typeof(WXReceiveGroupMsg))
|
|||
|
{
|
|||
|
if (WXReceiveGroupMsgEvent != null)
|
|||
|
WXReceiveGroupMsgEvent.Invoke(sender, e as WXReceiveGroupMsg);
|
|||
|
}
|
|||
|
else if (type == typeof(OrderNoticeEvent))
|
|||
|
{
|
|||
|
if (OrderNoticeEvent != null) OrderNoticeEvent.Invoke(sender, e as OrderNoticeEvent);
|
|||
|
}
|
|||
|
|
|||
|
else if (type == typeof(WXSendMessage))
|
|||
|
{
|
|||
|
if (WXSendMessage != null) WXSendMessage.Invoke(sender, e as WXSendMessage);
|
|||
|
}
|
|||
|
else if (type == typeof(WXRefreshContactSuccess))
|
|||
|
{
|
|||
|
if (WXRefreshContactSuccess != null) WXRefreshContactSuccess.Invoke(sender, e as WXRefreshContactSuccess);
|
|||
|
}
|
|||
|
else if (type == typeof(WXReicevePay))
|
|||
|
{
|
|||
|
if (WXReicevePay != null) WXReicevePay.Invoke(sender, e as WXReicevePay);
|
|||
|
}
|
|||
|
else if (type == typeof(SharedEvents))
|
|||
|
{
|
|||
|
if (SharedEvent != null) SharedEvent.Invoke(sender, e as SharedEvents);
|
|||
|
}
|
|||
|
else if (type == typeof(WebRequestEvents))
|
|||
|
{
|
|||
|
if (WebRequestEvent != null) WebRequestEvent.Invoke(sender, e as WebRequestEvents);
|
|||
|
}
|
|||
|
else if (type == typeof(WXOpenWindow))
|
|||
|
{
|
|||
|
if (WXOpenWindowEvent != null) WXOpenWindowEvent.Invoke(sender, e as WXOpenWindow);
|
|||
|
}
|
|||
|
else if (type == typeof(QQReceiveFriendMsgEvents))
|
|||
|
{
|
|||
|
if (QQReceiveFriendMsgEvents != null) QQReceiveFriendMsgEvents.Invoke(sender, e as QQReceiveFriendMsgEvents);
|
|||
|
}
|
|||
|
else if (type == typeof(QQAddMeNeedAuthEvents))
|
|||
|
{
|
|||
|
if (QQAddMeNeedAuthEvents != null) QQAddMeNeedAuthEvents.Invoke(sender, e as QQAddMeNeedAuthEvents);
|
|||
|
}
|
|||
|
else if (type == typeof(QQNewFriendEvents))
|
|||
|
{
|
|||
|
if (QQNewFriendEvents != null) QQNewFriendEvents.Invoke(sender, e as QQNewFriendEvents);
|
|||
|
}
|
|||
|
else if (type == typeof(QQNewGroupMemberEvents))
|
|||
|
{
|
|||
|
if (QQNewGroupMemberEvents != null) QQNewGroupMemberEvents.Invoke(sender, e as QQNewGroupMemberEvents);
|
|||
|
}
|
|||
|
else if (type == typeof(QQAddToClusterNeedAuthEvents))
|
|||
|
{
|
|||
|
if (QQAddToClusterNeedAuthEvents != null) QQAddToClusterNeedAuthEvents.Invoke(sender, e as QQAddToClusterNeedAuthEvents);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
plugin.OnLog("不支持事件:" + type);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
plugin.OnLog(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 打开窗口事件
|
|||
|
/// </summary>
|
|||
|
|
|||
|
public event EventHandler<WXOpenWindow> WXOpenWindowEvent;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// web请求事件
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<WebRequestEvents> WebRequestEvent;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 微信收到支付
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<WXReicevePay> WXReicevePay;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 通用解析事件
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<ReciveIMEvent> ReciveIMEvent;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 用户积分变动通知事件
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<MemberPointChangeEvent> MemberPointChangeEvent;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 收到微信群消息
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<Chat.Framework.WXSdk.Events.WXReceiveGroupMsg> WXReceiveGroupMsgEvent;
|
|||
|
/// <summary>
|
|||
|
/// 微信 - 收到微信好友消息
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<Chat.Framework.WXSdk.Events.WXReiceveFriendMsg> WXReiceveFriendMsgEvent;
|
|||
|
/// <summary>
|
|||
|
/// 微信 - 申请添加我为好友,需要审核
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<Chat.Framework.WXSdk.Events.WXApplyFriend> WXApplyFriendEvent;
|
|||
|
/// <summary>
|
|||
|
/// 微信 - 申请进入群,需要审核
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<Chat.Framework.WXSdk.Events.WXApplyGroup> WXApplyGroupEvent;
|
|||
|
/// <summary>
|
|||
|
/// 微信 - 在线状态发生改变
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<Chat.Framework.WXSdk.Events.WXChangeStatus> WXChangeStatusEvent;
|
|||
|
/// <summary>
|
|||
|
/// 微信 - 新增微信好友
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<Chat.Framework.WXSdk.Events.WXNewFriend> WXNewFriendEvent;
|
|||
|
/// <summary>
|
|||
|
/// 微信 - 新增群成员
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<Chat.Framework.WXSdk.Events.WXNewMemer> WXNewMemerEvent;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 订单通知接口
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<OrderNoticeEvent> OrderNoticeEvent;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 微信发送消息成功
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<Chat.Framework.WXSdk.Events.WXSendMessage> WXSendMessage;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 微信刷新好友成功
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<Chat.Framework.WXSdk.Events.WXRefreshContactSuccess> WXRefreshContactSuccess;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 共享自定义事件
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<SharedEvents> SharedEvent;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 收到QQ消息
|
|||
|
/// </summary>
|
|||
|
|
|||
|
public event EventHandler<Chat.Framework.QQSdk.Events.QQReceiveFriendMsgEvents> QQReceiveFriendMsgEvents;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 有人添加我为好友,需要审核
|
|||
|
/// </summary>
|
|||
|
|
|||
|
public event EventHandler<QQAddMeNeedAuthEvents> QQAddMeNeedAuthEvents;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 有人添加我为好友
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<QQNewFriendEvents> QQNewFriendEvents;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// QQ群新增成员
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<QQNewGroupMemberEvents> QQNewGroupMemberEvents;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 有人申请进群,需要审核
|
|||
|
/// </summary>
|
|||
|
public event EventHandler<QQAddToClusterNeedAuthEvents> QQAddToClusterNeedAuthEvents;
|
|||
|
|
|||
|
}
|
|||
|
}
|