public override void ViewDidLoad() { base.ViewDidLoad(); backBtn.TouchDown += HandleBackBtnBackBarButtonItemClicked; okBtn.TouchDown+= HandleOkBtnTouchDown; // Facebook facebookApp = new FaceBook.FaceBookApplication(this); /* facebookApp.OnLoginComplete+= ()=> { GraphUser guser = AppDelegateIPhone.AIphone.FacebookServ.GetMyProfile(); if (guser != null) { NSUserDefaults.StandardUserDefaults.SetDouble((double)guser.id,"FacebookId"); var id = AppDelegateIPhone.AIphone.MainUser.Id; AppDelegateIPhone.AIphone.UsersServ.UpdateSocialdId(guser.id, id, 1); } }; */ facebookApp.OnExtraLoginComplete+= (GraphUser u)=> { GraphUser guser = u;//AppDelegateIPhone.AIphone.FacebookServ.GetMyProfile(); if (guser != null) { NSUserDefaults.StandardUserDefaults.SetDouble((double)guser.id,"FacebookId"); var id = AppDelegateIPhone.AIphone.MainUser.Id; AppDelegateIPhone.AIphone.UsersServ.UpdateSocialdId(guser.id, id, 1); } }; SwitchFacebook.ValueChanged += delegate { if (SwitchFacebook.On) { facebookApp.Login(); } else { facebookApp.Logout(); } }; // Twitter twitterApp = new Twitter.TwitterApplication(this); SwitchTwitter.ValueChanged += delegate { if (SwitchTwitter.On) { twitterApp.Login(); } else { twitterApp.Logout(); } }; var view = new UIView(new RectangleF(0, 40 , 320, 1)); view.Layer.BackgroundColor = UIColor.LightGray.CGColor; this.View.AddSubview(view); }
void FacebookAuth () { facebookApp = new FaceBook.FaceBookApplication (this); facebookApp.OnExtraLoginComplete += (GraphUser u) => { GraphUser guser = u;//AppDelegateIPhone.AIphone.FacebookServ.GetMyProfile (); if (guser != null) { NSUserDefaults.StandardUserDefaults.SetDouble ((double)guser.id, "FacebookId"); PostAuth(guser.name, guser.id); } }; facebookApp.Login (); }