Example #1
0
        public DVCLogIn() : base(UITableViewStyle.Grouped, null, true)
        {
            loginView = new FBLoginView(ExtendedPermissions)
            {
                Frame = new RectangleF(74, 0, 151, 43)
            };
            loginView.FetchedUserInfo += (sender, e) => {
                if (Root.Count < 3)
                {
                    user = e.User;
                    pictureView.ProfileID = user.Id;

                    Root.Add(new Section("Hello " + user.Name)
                    {
                        new StringElement("Actions Menu", () => {
                            var dvc = new DVCActions(user);
                            NavigationController.PushViewController(dvc, true);
                        })
                        {
                            Alignment = UITextAlignment.Center
                        }
                    });
                }
            };
            loginView.ShowingLoggedOutUser += (sender, e) => {
                pictureView.ProfileID = null;
                if (Root.Count >= 3)
                {
                    InvokeOnMainThread(() => {
                        var section = Root[2];
                        section.Remove(0);
                        Root.Remove(section);
                        ReloadData();
                    });
                }
            };

            pictureView = new FBProfilePictureView()
            {
                Frame = new RectangleF(40, 0, 220, 220)
            };

            Root = new RootElement("Facebook Sample")
            {
                new Section()
                {
                    new UIViewElement("", loginView, true)
                    {
                        Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent,
                    }
                },
                new Section()
                {
                    new UIViewElement("", pictureView, true)
                    {
                        Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent,
                    },
                }
            };
        }
Example #2
0
        public DVCLogIn()
            : base(UITableViewStyle.Grouped, null, true)
        {
            loginView = new FBLoginView (ExtendedPermissions);

            if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
                loginView.Frame = new RectangleF (51, 0, 218, 46);
            } else {
                loginView.Frame = new RectangleF (40, 0, 218, 46);
            }

            loginView.FetchedUserInfo += (sender, e) => {
                if (Root.Count < 3) {
                    user = e.User;
                    pictureView.ProfileID = user.Id;

                    Root.Add (new Section ("Hello " + user.Name) {
                        new StringElement ("Actions Menu", () => {
                            var dvc = new DVCActions (user);
                            NavigationController.PushViewController (dvc, true);
                        }) {
                            Alignment = UITextAlignment.Center
                        }
                    });
                }
            };
            loginView.ShowingLoggedOutUser += (sender, e) => {
                pictureView.ProfileID = null;
                if (Root.Count >= 3) {
                    InvokeOnMainThread (() => {
                        var section = Root [2];
                        section.Remove (0);
                        Root.Remove (section);
                        ReloadData ();
                    });
                }
            };

            pictureView = new FBProfilePictureView () ;

            if (UIDevice.CurrentDevice.CheckSystemVersion (7,0)) {
                pictureView.Frame = new RectangleF (50, 0, 220, 220);
            }
            else {
                pictureView.Frame = new RectangleF (40, 0, 220, 220);
            }

            Root = new RootElement ("Facebook Sample") {
                new Section () {
                    new UIViewElement ("", loginView, true) {
                        Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent,
                    }
                },
                new Section () {
                    new UIViewElement ("", pictureView, true) {
                        Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent,
                    },
                }
            };
        }
Example #3
0
		public DVCLogIn () : base (UITableViewStyle.Grouped, null, true)
		{
			 
			// If was sent true to Profile.EnableUpdatesOnAccessTokenChange method
			// this notification will be called once the user is logged in
			Profile.Notifications.ObserveDidChange ((sender, e) => {
				if (e.NewProfile != null) {
					Root.Add (new Section ("Hello " + e.NewProfile.Name) {
						new StringElement ("Actions Menu", () => {
							var dvc = new DVCActions ();
							NavigationController.PushViewController (dvc, true);
						}) {
							Alignment = UITextAlignment.Center
						}
					});
				}
			});

			// If you use Native login behavior, you will get all read and publish permisions
			// otherwise, set the Read and Publish permissions you want to get
			loginView = new LoginButton (new CGRect (51, 0, 218, 46)) {
				LoginBehavior = LoginBehavior.Native,
				// ReadPermissions = extendedPermissions,
				// PublishPermissions = publishPermissions
			};

			// Handle actions once the user is logged in
			loginView.Completed += (sender, e) => {
				if (e.Error != null) {
					new UIAlertView ("Ups", e.Error.Description, null, "Ok", null).Show ();
					return;
				}
			};

			// Handle actions once the user is logged out
			loginView.LoggedOut += (sender, e) => {
				if (Root.Count >= 3) {
					InvokeOnMainThread (() => {
						var section = Root [2];
						section.Remove (0);
						Root.Remove (section);
						ReloadData ();
					});
				}
			};

			// The user image profile is set automatically once is logged in
			pictureView = new ProfilePictureView (new CGRect (50, 0, 220, 220));

			Root = new RootElement ("Facebook Sample") {
				new Section () {
					new UIViewElement ("", loginView, true) {
						Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent,
					}
				},
				new Section () {
					new UIViewElement ("", pictureView, true) {
						Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent,
					}, 
				}
			};
		}