Пример #1
0
        private void listMenuView1_ItemPress(object sender, ListMenuViewItemPressEventArgs e)
        {
            WeiXinShareEntity entity;

            switch (e.Item.SubContent)
            {
            case "Reg":
                this.weiXin1.registerApp(appid, (obj, args) => { }, universalLink);   //每个设备只需注册一次,方法参数中的appid为微信平台注册应用的appid
                break;

            case "Login":
                WeiXinLogin();
                break;

            case "Pay":
                Show(new demoWeixinPay());
                break;

            case "ShareNews":
                entity = new WeiXinShareNewsEntity("百度一下你就知道News", "百度一下你就知道", "https://www.baidu.com/");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "ShareText":
                entity = new WeiXinShareTextEntity("这是一个分享标题Text", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "ShareImage":
                entity = new WeiXinShareImageEntity("这是一个分享标题Image", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "ShareVideo":
                entity = new WeiXinShareVideoEntity("这是一个分享标题Video", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "ShareAudio":
                entity = new WeiXinShareAudioEntity("这是一个分享标题Audio", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineNews":
                entity = new WeiXinShareNewsEntity("百度一下你就知道News", "百度一下你就知道", "https://www.baidu.com/");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineText":
                entity = new WeiXinShareTextEntity("这是一个分享标题Text", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineImage":
                entity = new WeiXinShareImageEntity("这是一个分享标题Image", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineVideo":
                entity = new WeiXinShareVideoEntity("这是一个分享标题Video", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineAudio":
                entity = new WeiXinShareAudioEntity("这是一个分享标题Audio", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;

            case "isWXAppInstalled":
                this.weiXin1.isWXAppInstalled(HandleWeiXinRPCResult);
                break;

            case "isWXAppSupportApi":
                this.weiXin1.isWXAppSupportApi(HandleWeiXinRPCResult);
                break;

            case "getWXAppInstallUrl":
                this.weiXin1.getWXAppInstallUrl((s, ss) => { RedirectUrl(ss.args.ToString()); });
                break;

            case "getApiVersion":
                this.weiXin1.getApiVersion(HandleWeiXinRPCResult);
                break;

            case "openWXApp":
                this.weiXin1.openWXApp(HandleWeiXinRPCResult);
                break;
            }
        }
Пример #2
0
        private void listMenuView1_ItemPress(object sender, ListMenuViewItemPressEventArgs e)
        {
            WeiXinShareEntity entity;

            switch (e.Item.SubContent)
            {
            case "Reg":
                this.weiXin1.registerApp(appid);    //每个设备只需注册一次,方法参数中的appid为微信平台注册应用的appid
                break;

            case "Login":
                WeiXinLogin();
                break;

            case "Pay":
                Show(new demoWeixinPay());
                break;

            case "ShareNews":
                entity = new WeiXinShareNewsEntity("百度一下你就知道News", "百度一下你就知道", "https://www.baidu.com/");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "ShareText":
                entity = new WeiXinShareTextEntity("这是一个分享标题Text", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "ShareImage":
                entity = new WeiXinShareImageEntity("这是一个分享标题Image", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "ShareVideo":
                entity = new WeiXinShareVideoEntity("这是一个分享标题Video", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "ShareAudio":
                entity = new WeiXinShareAudioEntity("这是一个分享标题Audio", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToSession(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineNews":
                entity = new WeiXinShareNewsEntity("百度一下你就知道News", "百度一下你就知道", "https://www.baidu.com/");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineText":
                entity = new WeiXinShareTextEntity("这是一个分享标题Text", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineImage":
                entity = new WeiXinShareImageEntity("这是一个分享标题Image", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineVideo":
                entity = new WeiXinShareVideoEntity("这是一个分享标题Video", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;

            case "TimeLineAudio":
                entity = new WeiXinShareAudioEntity("这是一个分享标题Audio", "这是一个分享文本", "http://www.smobiler.com/images/index/logo.png");
                this.weiXin1.shareToTimeline(entity, HandleWeiXinRPCResult);
                break;
            }
        }