예제 #1
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            //请填写您的AppID,否则不会激活微信页面
            WXApi.RegisterApp("");

            return(true);
        }
        //
        // 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)
        {
            wxApiDelegate = new CustomizeWXApiDelegate();
            MessagingCenter.Subscribe <object>(this, PubSubMessage.Register, d =>
            {
                var result = WXApi.RegisterApp(appid: "", universalLink: "");
                MessagingCenter.Send(new object(), PubSubMessage.Registered, result);
            });

            MessagingCenter.Subscribe <object>(this, PubSubMessage.ShareToFriend, d =>
            {
                var req = new SendMessageToWXReq()
                {
                    Scene = (int)WXScene.Session,
                    Text  = "这是Xamarin发送的消息!",
                    BText = true,
                };
                WXApi.SendReq(req, isOK =>
                {
                });
            });

            MessagingCenter.Subscribe <object>(this, PubSubMessage.ShareToFavourite, d =>
            {
                var req = new SendMessageToWXReq()
                {
                    Scene = (int)WXScene.Favorite,
                    Text  = "这是Xamarin发送的消息!",
                    BText = true,
                };
                WXApi.SendReq(req, isOK =>
                {
                });
            });

            MessagingCenter.Subscribe <object>(this, PubSubMessage.ShareToTimeline, d =>
            {
                var req = new SendMessageToWXReq()
                {
                    Scene = (int)WXScene.Timeline,
                    Text  = "这是Xamarin发送的消息!",
                    BText = true,
                };
                WXApi.SendReq(req, isOK =>
                {
                });
            });

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
예제 #3
0
        void BtnWeichat_TouchUpInside(object sender, EventArgs e)
        {
            // 使用 WXApi.IsWXAppInstalled 之前注意事项
            // 1. 配置 NSAppTransportSecurity
            // 2. LSApplicationQueriesSchemes 增加 weixin
            // 3. 注册 App: WXApi.RegisterApp("");
            WXApi.RegisterApp("wx4e176430f6f0560d");
            UMSocialWechatHandler.DefaultManager.SetAppId("wx4e176430f6f0560d", "586b357cd07033b781b0f66520720547", "http://www.umeng.com/social");

            var result = WXApi.IsWXAppInstalled;

            var alertView = new UIAlertView("微信", result ? "已安装" : "未安装", null, "OK", null);

            alertView.Show();
        }
예제 #4
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            //注册微信程序
            WXApi.RegisterApp("wx3f94d21d67c4ae76"); //wxd930ea5d5a258f4f
            // create a new window instance based on the screen size
            Window = new UIWindow(UIScreen.MainScreen.Bounds);
            TestViewController vc = new TestViewController();

            Window.RootViewController = vc;
            // If you have defined a root view controller, set it here:
            // Window.RootViewController = myViewController;

            // make the window visible
            Window.MakeKeyAndVisible();

            return(true);
        }
예제 #5
0
        //微信登录
        public bool Log(string appID)
        {
            var result = WXApi.RegisterApp(appID);

            return(result);
        }
예제 #6
0
 /// <summary>
 /// 注册微信sdk
 /// </summary>
 public bool Register(string appId)
 {
     return(WXApi.RegisterApp(appId, "[Your-Universal-Links]"));
 }
예제 #7
0
 public iOSWeChatExampleViewController(IntPtr handle) : base(handle)
 {
     WXApi.RegisterApp(APP_ID);
 }