public ListDetailViewController(string listId, string listName, FacebookListType type) : base(UITableViewStyle.Grouped, null, true)
        {
            Root = new RootElement(listName);

            // Ask for the members within the group
            var request           = new GraphRequest("/" + listId + "/members?fields=id,name", null, AccessToken.CurrentAccessToken.TokenString, null, "GET");
            var requestConnection = new GraphRequestConnection();

            requestConnection.AddRequest(request, (connection, result, error) => {
                // Handle if something went wrong
                if (error != null)
                {
                    new UIAlertView("Error...", error.Description, null, "Ok", null).Show();
                    return;
                }

                // Get the name and the userId of all the memebers
                NSArray membersData = (result as NSDictionary) ["data"] as NSArray;

                var listSection = new List <Section> ();

                // Add the name and the picture profile to the view
                for (nuint i = 0; i < membersData.Count; i++)
                {
                    // Get the info of one of the members
                    var memberData  = membersData.GetItem <NSDictionary> (i);
                    var pictureView = new ProfilePictureView(new CGRect(48, 0, 220, 220))
                    {
                        ProfileId = memberData ["id"].ToString(),
                        TranslatesAutoresizingMaskIntoConstraints = false
                    };

                    listSection.Add(new Section(memberData ["name"].ToString())
                    {
                        new UIViewElement("", pictureView, true)
                        {
                            Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent
                        }
                    });
                }

                Root = new RootElement(listName)
                {
                    listSection
                };
            });

            requestConnection.Start();
        }
		public ListDetailViewController (string listId, string listName, FacebookListType type) : base (UITableViewStyle.Grouped, null, true)
		{
			Root = new RootElement (listName);

			// Ask for the members within the group
			var request = new GraphRequest ("/" + listId + "/members?fields=id,name", null, AccessToken.CurrentAccessToken.TokenString, null, "GET");
			var requestConnection = new GraphRequestConnection ();
			requestConnection.AddRequest (request, (connection, result, error) => {
				// Handle if something went wrong
				if (error != null) {
					new UIAlertView ("Error...", error.Description, null, "Ok", null).Show ();
					return;
				}

				// Get the name and the userId of all the memebers
				NSArray membersData = (result as NSDictionary) ["data"] as NSArray;

				var listSection = new List<Section> ();

				// Add the name and the picture profile to the view
				for (nuint i = 0; i < membersData.Count; i++) {
					// Get the info of one of the members
					var memberData = membersData.GetItem<NSDictionary> (i);
					var pictureView = new ProfilePictureView (new CGRect (48, 0, 220, 220)) {
						ProfileId = memberData ["id"].ToString (),
						TranslatesAutoresizingMaskIntoConstraints = false
					};

					listSection.Add (new Section (memberData ["name"].ToString ()) {
						new UIViewElement ("", pictureView, true) {
							Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent
						}
					});
				}

				Root = new RootElement (listName) {
					listSection
				};
			});

			requestConnection.Start ();
		}
예제 #3
0
        public ListViewController(FacebookListType type) : base(UITableViewStyle.Grouped, null, true)
        {
            var kindListName = type == FacebookListType.Friends ? "friendlists?fields=id,name" : "groups?fields=id,name";

            Root = new RootElement(type == FacebookListType.Friends ? "Friendlists" : "Managed Groups");

            // Depends of what you want to see, list all your groups or all your friendslist that you have
            var request           = new GraphRequest("/" + Profile.CurrentProfile.UserID + "/" + kindListName, null, AccessToken.CurrentAccessToken.TokenString, null, "GET");
            var requestConnection = new GraphRequestConnection();

            requestConnection.AddRequest(request, (connection, result, error) => {
                // Handle if something went wrong
                if (error != null)
                {
                    new UIAlertView("Error...", error.Description, null, "Ok", null).Show();
                    return;
                }

                // Get all the info of all the friends or group list that you belong
                NSArray listsData = (result as NSDictionary) ["data"] as NSArray;

                var listSection = new Section();

                for (nuint i = 0; i < listsData.Count; i++)
                {
                    var data = listsData.GetItem <NSDictionary> (i);
                    listSection.Add(new StringElement(data ["name"].ToString(), () => {
                        // Ask for all the FB user members that belong to the groups
                        // For security reasons, FB doesn't let you see who is in your friendlist anymore
                        if (type == FacebookListType.Groups)
                        {
                            NavigationController.PushViewController(new ListDetailViewController(data ["id"].ToString(), data ["name"].ToString(), type), true);
                        }
                    }));
                }

                Root.Add(listSection);
            });

            requestConnection.Start();
        }
예제 #4
0
		public ListViewController (FacebookListType type) : base (UITableViewStyle.Grouped, null, true)
		{
			var kindListName = type == FacebookListType.Friends ? "friendlists?fields=id,name" : "groups?fields=id,name";

			Root = new RootElement (type == FacebookListType.Friends ? "Friendlists" : "Managed Groups");

			// Depends of what you want to see, list all your groups or all your friendslist that you have
			var request = new GraphRequest ("/" + Profile.CurrentProfile.UserID + "/" + kindListName, null, AccessToken.CurrentAccessToken.TokenString, null, "GET");
			var requestConnection = new GraphRequestConnection ();
			requestConnection.AddRequest (request, (connection, result, error) => {
				// Handle if something went wrong
				if (error != null) {
					new UIAlertView ("Error...", error.Description, null, "Ok", null).Show ();
					return;
				}

				// Get all the info of all the friends or group list that you belong
				NSArray listsData = (result as NSDictionary) ["data"] as NSArray;

				var listSection = new Section ();

				for (nuint i = 0; i < listsData.Count; i++) {
					var data = listsData.GetItem <NSDictionary> (i);
					listSection.Add (new StringElement (data ["name"].ToString (), () => {
						// Ask for all the FB user members that belong to the groups
						// For security reasons, FB doesn't let you see who is in your friendlist anymore
						if (type == FacebookListType.Groups)
							NavigationController.PushViewController (new ListDetailViewController (data ["id"].ToString (), data ["name"].ToString (), type), true);
					}));
				}

				Root.Add (listSection);
			});

			requestConnection.Start ();
		}