Esempio n. 1
0
        partial void Login(UIButton sender)
        {
            //var permissions = ["get_user_info", "get_simple_userinfo"];
            var permissions = new NSString[] { Constants.kOPEN_PERMISSION_GET_OTHER_INFO, Constants.kOPEN_PERMISSION_GET_SIMPLE_USER_INFO };

            _tencentOAuth.Authorize(permissions);
        }
Esempio n. 2
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            var appid = "1110584378";

            MessagingCenter.Subscribe <object>(this, MainPage.QQShare, o =>
            {
                var tencentOAuth = new TencentOAuth(appid, new OAuthTencentSessionDelegate());
                var textObj      = new QQApiTextObject("这是来自Xamarin的QQ分享");
                var req          = SendMessageToQQReq.ReqWithContent(textObj);
                QQApiInterface.SendReq(req);
            });
            MessagingCenter.Subscribe <object>(this, MainPage.QQLogin, o =>
            {
                var k1           = TencentOpenAPI.sdkdef.Constants.kOPEN_PERMISSION_GET_USER_INFO;
                var k2           = TencentOpenAPI.sdkdef.Constants.kOPEN_PERMISSION_GET_SIMPLE_USER_INFO;
                var para         = new NSObject[] { k1, k2 };
                var tencentOAuth = new TencentOAuth(appid, new OAuthTencentSessionDelegate());
                var result       = tencentOAuth.Authorize(para);
            });

            return(base.FinishedLaunching(app, options));
        }