public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { tableView.DeselectRow (path, true); //base.Selected (dvc, tableView, path); var evc = new EmptyViewController(()=> { nav.PopViewControllerAnimated(true); }, Caption); var vc = new WebViewController (this) { Autorotate = dvc.Autorotate }; var web = new UIWebView (UIScreen.MainScreen.ApplicationFrame){ BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; web.LoadStarted += delegate { NetworkActivity = true; var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator); indicator.StartAnimating(); }; web.LoadFinished += delegate { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; }; web.LoadError += (webview, args) => { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; if (web != null) web.LoadHtmlString (String.Format ("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null); }; vc.NavigationItem.Title = Caption; vc.View.AddSubview (web); //vc.View.Frame = new RectangleF(0, 41 , 320, 480 - 41); evc.Add(vc.View); nav.PushViewController(evc, true); web.LoadRequest (NSUrlRequest.FromUrl (new NSUrl (Url))); }
public void LoadFacebookFriends() { var facebookApp = new FaceBook.FaceBookApplication(this); if (!facebookApp.LoggedIn()) { InvokeOnMainThread(()=> { var soc = new SocialNetworksParentViewController(_MSP); _MSP.PushViewController(soc, true); }); return; } List<Decimal> friends = AppDelegateIPhone.AIphone.FacebookServ.GetFriends(); if (friends == null) { Util.LogException("friends", new Exception()); return; } var socialIds = new List<long>(); foreach (decimal d in friends) { socialIds.Add((long)d); } var fBresp = AppDelegateIPhone.AIphone.UsersServ.GetSocialIds(socialIds, 1); List<User> facebookFriends = fBresp.Subscribers; if (facebookFriends == null) { Util.LogException("facebookFriends", new Exception()); return; } if (facebookFriends.Count == 0) { InvokeOnMainThread(()=> { var alert = new UIAlertView("Search", "No facebook friend found", null, "Ok"); alert.Show(); }); return; } facebookApp = new FaceBook.FaceBookApplication (this); InvokeOnMainThread(()=> { var root = new RootElement("") { new Section() }; var dv = new DialogViewController(root, true); foreach (User fuser in facebookFriends) { var user = new UserElementII(fuser, RelationType.Friends); root[0].Add(user); } foreach (long socialId in fBresp.Others) { var guser = new GraphUser() { id = socialId }; var fbUser = new FbUserElement(guser, u => { WebViewController.OpenUrl (dv, "https://www.facebook.com/dialog/apprequests?app_id=168889879843414&message=Welcome to 21Off!&redirect_uri=http://www.21off.net"); }); root[0].Add(fbUser); } var ev = new EmptyViewController(() => _MSP.PopViewControllerAnimated(true), "Facebook friends"); dv.TableView.BackgroundView = new UIImageView(UIImage.FromBundle("Images/Ver4/fond")); dv.View.Frame = new RectangleF(0, 40, 320, 480 - 40); ev.Add(dv.View); _MSP.PushViewController(ev, false); }); }