public override void ViewDidLoad() { base.ViewDidLoad(); backBtn.TouchDown += HandleBackBtnBackBarButtonItemClicked; /* UIGraphics.BeginImageContext(facebookBtn.Frame.Size); CGContext context = UIGraphics.GetCurrentContext(); context.SetFillColor(0.0f,1.0f,0.0f,1.0f); context.FillRect(facebookBtn.Frame); UIImage image = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); FacebookBtn.SetBackgroundImage(image,UIControlState.Normal); */ // Facebook facebookApp = new FaceBook.FaceBookApplication(this); facebookBtn.TouchDown += delegate { if (facebookApp.LoggedIn()) { facebookApp.Publish("21Off", imageUrl, image.Name ?? "No comment", imageUrl); AppDelegateIPhone.ShowMessage(View, "Posted on facebook", null, 2); } else { var _MSP = AppDelegateIPhone.tabBarController.SelectedViewController as UINavigationController; var vc = new SocialNetworksParentViewController(_MSP); _MSP.PushViewController(vc, true); } }; // Twitter twitterApp = new Twitter.TwitterApplication(this); TwitterBtn.TouchDown += delegate { if (twitterApp.LoggedIn()) { twitterApp.Publish("21Off", imageUrl, image.Name ?? "No comment" , imageUrl); AppDelegateIPhone.ShowMessage(View, "Posted on twitter", null, 2); } else { var _MSP = AppDelegateIPhone.tabBarController.SelectedViewController as UINavigationController; var vc = new SocialNetworksParentViewController(_MSP); _MSP.PushViewController(vc, true); } }; // 21Off if (this.image.UserId == AppDelegateIPhone.AIphone.MainUser.Id) { SelfshareLbl.Hidden = SelfshareBtn.Hidden = selfShareSubLbl.Hidden = true; } else { SelfshareBtn.TouchDown += delegate { Action act = ()=> { AppDelegateIPhone.AIphone.ShareServ.PhotoShare(image); }; AppDelegateIPhone.ShowRealLoading(null, "Sharing post", null, act); }; } }
private void NetworkPost(Image image) { try { string img = string.Format("{0}/{1}/{2}.jpg", UrlStore.streamingUrl, image.UserId, image.Id); if (_Settings.twitter.Value) { var twitterApp = new Twitter.TwitterApplication(this); if (twitterApp.LoggedIn()) { twitterApp.Publish("21Off", img, image.Name ?? "No comment" , img); } else { using(var alert = new UIAlertView("Warning","Not logged in",null,"OK",null)) { alert.Show();} } } if (_Settings.facebook.Value) { var faceBookApp = new FaceBook.FaceBookApplication(this); if (faceBookApp.LoggedIn()) { faceBookApp.Publish(image.Name ?? "No comment", img, "Posted with 21Off", img); } else { using(var alert = new UIAlertView("Warning","Not logged in",null,"OK",null)) { alert.Show();} } } } catch (Exception ex) { Util.LogException("NetworkPost", ex); } }