Exemplo n.º 1
0
 public Task<ActionEvent> GetContact(ActionEventListener listener = null)
 {
     // 如果直接new一个Action并执行的话也可以,但是不能自动重试
     return new WebWeChatActionFuture(Context, listener)
         .PushAction<GetContactAction>()
         .ExecuteAsync();
 }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
 public Task <ActionEvent> Login(ActionEventListener listener = null)
 {
     return(GetModule <ILoginModule>().Login(listener));
 }
Exemplo n.º 4
0
 protected WebQQInfoAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 5
0
        /// <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));
        }
Exemplo n.º 6
0
 public WatiForLoginAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 7
0
 public GetOnlineFriendsAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
Exemplo n.º 8
0
 public SendMsgAction(IWeChatContext context, MessageSent msg, ActionEventListener listener = null) : base(context, listener)
 {
     _msg = msg;
 }
Exemplo n.º 9
0
 public SyncCheckAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 10
0
 public GetGroupNameListAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 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();
        }
Exemplo n.º 12
0
 public Task<ActionEvent> SendMsg(MessageSent msg, ActionEventListener listener = null)
 {
     return new SendMsgAction(Context, msg)
         .ExecuteAsyncAuto();
 }
Exemplo n.º 13
0
 public Task<ActionEvent> GetRobotReply(RobotType robotType, string input, ActionEventListener listener = null)
 {
     return new GetTuringRobotReplyAction(Context, input)
         .ExecuteAsyncAuto();
 }
Exemplo n.º 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"];
 }
Exemplo n.º 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"];
 }
Exemplo n.º 18
0
 public ChannelLoginAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 19
0
 protected WebQQAction(IQQContext context, ActionEventListener listener = null)
     : base(context.GetSerivce<IHttpService>())
 {
     _context = context; 
     OnActionEvent += listener;
 }
Exemplo n.º 20
0
 public GetUuidAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
     Session.Seq = Timestamp;
 }
Exemplo n.º 21
0
 public BatchGetContactAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 22
0
 public GetFriendQQNumberAction(IQQContext context, QQFriend friend, ActionEventListener listener = null)
     : base(context, listener)
 {
     _friend = friend;
 }
Exemplo n.º 23
0
 public GetGroupInfoAction(IQQContext context, QQGroup group, ActionEventListener listener = null) : base(context, listener)
 {
     _group = group;
 }
Exemplo n.º 24
0
 public GetDiscussionListAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 25
0
 public GetFriendQQNumberAction(IQQContext context, QQFriend friend, ActionEventListener listener = null)
     : base(context, listener)
 {
     _friend = friend;
 }
Exemplo n.º 26
0
 public ActionFuture(ActionEventListener listener = null)
 {
     _outerListener = listener;
 }
Exemplo n.º 27
0
 public WebLoginAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 28
0
 public Task <ActionEvent> GetGroupMember(ActionEventListener listener = null)
 {
     return(new WebWeChatActionFuture(Context, listener)
            .PushAction <BatchGetContactAction>()
            .ExecuteAsync());
 }
Exemplo n.º 29
0
 public Task<ActionEvent> GetGroupMember(ActionEventListener listener = null)
 {
     return new WebWeChatActionFuture(Context, listener)
        .PushAction<BatchGetContactAction>()
        .ExecuteAsync();
 }
Exemplo n.º 30
0
 public CheckQRCodeAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 31
0
 public GetGroupInfoAction(IQQContext context, QQGroup group, ActionEventListener listener = null)
     : base(context, listener)
 {
     _group = group;
 }
Exemplo n.º 32
0
 public Task <ActionEvent> GetRobotReply(RobotType robotType, string input, ActionEventListener listener = null)
 {
     return(new GetTuringRobotReplyAction(Context, input)
            .ExecuteAsyncAuto());
 }
Exemplo n.º 33
0
 public PollMsgAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 34
0
 public GetQRCodeAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
Exemplo n.º 35
0
 public GetContactAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 36
0
 public WebQQActionFuture(IQQContext context, ActionEventListener listener = null)
     : base(listener)
 {
     ActionFactory = context.GetSerivce <IQQActionFactory>();
 }
Exemplo n.º 37
0
 public GetVfwebqqAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 38
0
 public GetGroupNameListAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
Exemplo n.º 39
0
 protected WebQQAction(IQQContext context, ActionEventListener listener = null)
     : base(context.GetSerivce <IHttpService>())
 {
     _context       = context;
     OnActionEvent += listener;
 }
Exemplo n.º 40
0
 public GetOnlineFriendsAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 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));
        }
Exemplo n.º 42
0
 public Task <ActionEvent> GetGroupMember(ActionEventListener listener = null)
 {
     return(GetModule <IContactModule>().GetGroupMember(listener));
 }
Exemplo n.º 43
0
 public GetSelfInfoAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
Exemplo n.º 44
0
 public Task <ActionEvent> SendMsg(MessageSent msg, ActionEventListener listener = null)
 {
     return(GetModule <IChatModule>().SendMsg(msg, listener));
 }
Exemplo n.º 45
0
 protected WebQQInfoAction(IQQContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 46
0
 public Task <ActionEvent> GetRobotReply(RobotType robotType, string input, ActionEventListener listener = null)
 {
     return(GetModule <IChatModule>().GetRobotReply(robotType, input, listener));
 }
Exemplo n.º 47
0
 public GetUuidAction(IWeChatContext context, ActionEventListener listener = null) : base(context, listener)
 {
     Session.Seq = Timestamp;
 }
Exemplo n.º 48
0
 public GetDiscussionInfoAction(IQQContext context, QQDiscussion discussion, ActionEventListener listener = null) : base(context, listener)
 {
     _discussion = discussion;
 }
Exemplo n.º 49
0
 public GetVfwebqqAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
Exemplo n.º 50
0
 public Task <ActionEvent> SendMsg(Message msg, ActionEventListener listener = null)
 {
     return(new SendMsgAction(Context, msg, listener).ExecuteAsyncAuto());
 }
Exemplo n.º 51
0
 public PollMsgAction(IQQContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
Exemplo n.º 52
0
 public Task <ActionEvent> GetRobotReply(RobotType robotType, string input, ActionEventListener listener = null)
 {
     throw new NotImplementedException();
     // return new GetTuringRobotReplyAction(Context, input).ExecuteAsyncAuto();
 }
Exemplo n.º 53
0
 public WebwxSyncAction(IWeChatContext context, ActionEventListener listener = null) : base(context, listener)
 {
 }
Exemplo n.º 54
0
 public StatusNotifyAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 55
0
 public GetQRCodeAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }
Exemplo n.º 56
0
 public StatusNotifyAction(IWeChatContext context, ActionEventListener listener = null)
     : base(context, listener)
 {
 }