示例#1
0
 public Task<ActionEvent> GetContact(ActionEventListener listener = null)
 {
     // 如果直接new一个Action并执行的话也可以,但是不能自动重试
     return new WebWeChatActionFuture(Context, listener)
         .PushAction<GetContactAction>()
         .ExecuteAsync();
 }
示例#2
0
        public Task<ActionEvent> Login(ActionEventListener listener = null)
        {
            return new WebWeChatActionFuture(Context, listener)
                .PushAction<GetUuidAction>()
                .PushAction<GetQRCodeAction>(async (sender, @event) =>
                {
                    if (@event.Type != ActionEventType.EvtOK) return;

                    var verify = (Image)@event.Target;
                    await Context.FireNotifyAsync(WeChatNotifyEvent.CreateEvent(WeChatNotifyEventType.QRCodeReady, verify));
                })
                .PushAction<WatiForLoginAction>(async (sender, @event) =>
                {
                    if (@event.Type != ActionEventType.EvtOK) return;

                    var result = (WatiForLoginResult)@event.Target;
                    switch (result)
                    {
                        case WatiForLoginResult.Success:
                            await Context.FireNotifyAsync(WeChatNotifyEvent.CreateEvent(WeChatNotifyEventType.QRCodeSuccess));
                            break;
                        case WatiForLoginResult.QRCodeInvalid:
                            await Context.FireNotifyAsync(WeChatNotifyEvent.CreateEvent(WeChatNotifyEventType.QRCodeInvalid));
                            @event.Type = ActionEventType.EvtError; // �������������ִ��
                            break;
                        case WatiForLoginResult.ScanCode:
                            @event.Type = ActionEventType.EvtRepeat;
                            break;
                    }
                })
                .PushAction<WebLoginAction>()
                .PushAction<WebwxInitAction>()
                .PushAction<StatusNotifyAction>()
                .PushAction<GetContactAction>(async (sender, @event) =>
                {
                    if (@event.Type != ActionEventType.EvtOK) return;

                    await Context.FireNotifyAsync(WeChatNotifyEvent.CreateEvent(WeChatNotifyEventType.LoginSuccess));
                })
                .ExecuteAsync();
        }
示例#3
0
 public Task <ActionEvent> Login(ActionEventListener listener = null)
 {
     return(GetModule <ILoginModule>().Login(listener));
 }
示例#4
0
 protected WebQQInfoAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
        /// <summary>
        /// 只传一个listener的重载
        /// 当使用lambda表达式传递listener的时候会匹配到这个重载
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="listener"></param>
        /// <returns></returns>
        public WebWeChatActionFuture PushAction <T>(ActionEventListener listener) where T : WebWeChatAction
        {
            var action = ActionFactory.CreateAction <T>(listener);

            return((WebWeChatActionFuture)base.PushAction(action));
        }
 public WatiForLoginAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
 public GetOnlineFriendsAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
示例#8
0
 public SendMsgAction(IWeChatContext context, MessageSent msg, ActionEventListener listener = null) : base(context, listener)
 {
     _msg = msg;
 }
示例#9
0
 public SyncCheckAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
 public GetGroupNameListAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#11
0
        public Task<ActionEvent> Login(ActionEventListener listener)
        {
            return new WebQQActionFuture(Context, listener)
                .PushAction<GetQRCodeAction>(async (sender, @event) => // 1.��ȡ��ά��
                {
                    if (@event.Type == ActionEventType.EvtOK)
                    {
                        var verify = (Image)@event.Target;
                        await Context.FireNotifyAsync(QQNotifyEvent.CreateEvent(QQNotifyEventType.QRCodeReady, verify));
                    }
                })
                .PushAction<CheckQRCodeAction>(async (sender, @event) => // 2.��ȡ��ά��ɨ��״̬
                {
                    if (@event.Type != ActionEventType.EvtOK) return;

                    var args = (CheckQRCodeArgs)@event.Target;
                    switch (args.Status)
                    {
                        case QRCodeStatus.OK:
                            Session.CheckSigUrl = args.Msg;
                            await Context.FireNotifyAsync(QQNotifyEvent.CreateEvent(QQNotifyEventType.QRCodeSuccess));
                            break;

                        case QRCodeStatus.Valid:
                        case QRCodeStatus.Auth:
                            Logger.LogDebug($"��ά��״̬��{args.Status.GetDescription()}");
                            @event.Type = ActionEventType.EvtRepeat;
                            await Task.Delay(3000);
                            break;

                        case QRCodeStatus.Invalid:
                            await Context.FireNotifyAsync(QQNotifyEvent.CreateEvent(QQNotifyEventType.QRCodeInvalid, args.Msg));
                            break;
                    }
                })
                .PushAction<CheckSigAction>()
                .PushAction<GetVfwebqqAction>()
                .PushAction<ChannelLoginAction>(async (sender, @event) =>
                {
                    if (@event.Type != ActionEventType.EvtOK) return;
                    await Context.FireNotifyAsync(QQNotifyEvent.CreateEvent(QQNotifyEventType.LoginSuccess));
                })
                .PushAction<GetFriendsAction>(async (sender, @event) =>
                {
                    if (@event.Type != ActionEventType.EvtOK) return;
                    var obj = Store.FriendDic.FirstOrDefault().Value;
                    if (obj == null) return;
                    await new GetFriendLongNickAction(Context, obj).ExecuteAsyncAuto();
                    await new GetFriendQQNumberAction(Context, obj).ExecuteAsyncAuto();
                    await new GetFriendInfoAction(Context, obj).ExecuteAsyncAuto();
                })
                .PushAction<GetGroupNameListAction>(async (sender, @event) =>
                {
                    if (@event.Type != ActionEventType.EvtOK) return;
                    var group = Store.GroupDic.FirstOrDefault().Value;
                    if (group != null)
                    {
                        await new GetGroupInfoAction(Context, group).ExecuteAsyncAuto();
                    }
                })
                .PushAction<GetDiscussionListAction>(async (sender, @event) =>
                {
                    if (@event.Type != ActionEventType.EvtOK) return;
                    var dis = Store.DiscussionDic.FirstOrDefault().Value;
                    if (dis != null)
                    {
                        await new GetDiscussionInfoAction(Context, dis).ExecuteAsyncAuto();
                    }
                })
                .PushAction<GetSelfInfoAction>()
                .PushAction<GetOnlineFriendsAction>()
                .ExecuteAsync();
        }
示例#12
0
 public Task<ActionEvent> SendMsg(MessageSent msg, ActionEventListener listener = null)
 {
     return new SendMsgAction(Context, msg)
         .ExecuteAsyncAuto();
 }
示例#13
0
 public Task<ActionEvent> GetRobotReply(RobotType robotType, string input, ActionEventListener listener = null)
 {
     return new GetTuringRobotReplyAction(Context, input)
         .ExecuteAsyncAuto();
 }
示例#14
0
 public GetSelfInfoAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
 public GetTuringRobotReplyAction(IWeChatContext context, string input, ActionEventListener listener = null)
     : base(context, listener)
 {
     _input = input;
     _key = Config["TulingApiKey"];
 }
示例#16
0
 public SendMsgAction(IWeChatContext context, MessageSent msg, ActionEventListener listener = null)
     : base(context, listener)
 {
     _msg = msg;
 }
 public GetTuringRobotReplyAction(IWeChatContext context, string input, ActionEventListener listener = null)
     : base(context, listener)
 {
     _input = input;
     _key   = Config["TulingApiKey"];
 }
示例#18
0
 public ChannelLoginAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#19
0
 protected WebQQAction(IQQContext context, ActionEventListener listener = null)
     : base(context.GetSerivce<IHttpService>())
 {
     _context = context; 
     OnActionEvent += listener;
 }
示例#20
0
 public GetUuidAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
     Session.Seq = Timestamp;
 }
 public BatchGetContactAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
 public GetFriendQQNumberAction(IQQContext context, QQFriend friend, ActionEventListener listener = null)
     : base(context, listener)
 {
     _friend = friend;
 }
 public GetGroupInfoAction(IQQContext context, QQGroup group, ActionEventListener listener = null) : base(context, listener)
 {
     _group = group;
 }
 public GetDiscussionListAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
 public GetFriendQQNumberAction(IQQContext context, QQFriend friend, ActionEventListener listener = null)
     : base(context, listener)
 {
     _friend = friend;
 }
示例#26
0
 public ActionFuture(ActionEventListener listener = null)
 {
     _outerListener = listener;
 }
示例#27
0
 public WebLoginAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#28
0
 public Task <ActionEvent> GetGroupMember(ActionEventListener listener = null)
 {
     return(new WebWeChatActionFuture(Context, listener)
            .PushAction <BatchGetContactAction>()
            .ExecuteAsync());
 }
示例#29
0
 public Task<ActionEvent> GetGroupMember(ActionEventListener listener = null)
 {
     return new WebWeChatActionFuture(Context, listener)
        .PushAction<BatchGetContactAction>()
        .ExecuteAsync();
 }
示例#30
0
 public CheckQRCodeAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#31
0
 public GetGroupInfoAction(IQQContext context, QQGroup group, ActionEventListener listener = null)
     : base(context, listener)
 {
     _group = group;
 }
示例#32
0
 public Task <ActionEvent> GetRobotReply(RobotType robotType, string input, ActionEventListener listener = null)
 {
     return(new GetTuringRobotReplyAction(Context, input)
            .ExecuteAsyncAuto());
 }
示例#33
0
 public PollMsgAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#34
0
 public GetQRCodeAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
示例#35
0
 public GetContactAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#36
0
 public WebQQActionFuture(IQQContext context, ActionEventListener listener = null)
     : base(listener)
 {
     ActionFactory = context.GetSerivce <IQQActionFactory>();
 }
示例#37
0
 public GetVfwebqqAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
 public GetGroupNameListAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
示例#39
0
 protected WebQQAction(IQQContext context, ActionEventListener listener = null)
     : base(context.GetSerivce <IHttpService>())
 {
     _context       = context;
     OnActionEvent += listener;
 }
 public GetOnlineFriendsAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#41
0
        public WebQQActionFuture PushAction <T>(object obj, ActionEventListener listener) where T : WebQQAction
        {
            var action = ActionFactory.CreateAction <T>(obj, listener);

            return((WebQQActionFuture)base.PushAction(action));
        }
示例#42
0
 public Task <ActionEvent> GetGroupMember(ActionEventListener listener = null)
 {
     return(GetModule <IContactModule>().GetGroupMember(listener));
 }
示例#43
0
 public GetSelfInfoAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
示例#44
0
 public Task <ActionEvent> SendMsg(MessageSent msg, ActionEventListener listener = null)
 {
     return(GetModule <IChatModule>().SendMsg(msg, listener));
 }
示例#45
0
 protected WebQQInfoAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#46
0
 public Task <ActionEvent> GetRobotReply(RobotType robotType, string input, ActionEventListener listener = null)
 {
     return(GetModule <IChatModule>().GetRobotReply(robotType, input, listener));
 }
示例#47
0
 public GetUuidAction(IWeChatContext context, ActionEventListener listener = null) : base(context, listener)
 {
     Session.Seq = Timestamp;
 }
 public GetDiscussionInfoAction(IQQContext context, QQDiscussion discussion, ActionEventListener listener = null) : base(context, listener)
 {
     _discussion = discussion;
 }
示例#49
0
 public GetVfwebqqAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
示例#50
0
 public Task <ActionEvent> SendMsg(Message msg, ActionEventListener listener = null)
 {
     return(new SendMsgAction(Context, msg, listener).ExecuteAsyncAuto());
 }
示例#51
0
 public PollMsgAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
示例#52
0
 public Task <ActionEvent> GetRobotReply(RobotType robotType, string input, ActionEventListener listener = null)
 {
     throw new NotImplementedException();
     // return new GetTuringRobotReplyAction(Context, input).ExecuteAsyncAuto();
 }
示例#53
0
 public WebwxSyncAction(IWeChatContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
示例#54
0
 public StatusNotifyAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#55
0
 public GetQRCodeAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
示例#56
0
 public StatusNotifyAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }