Exemplo n.º 1
0
        public UserDetailPage(User user)
        {
            _user = user;
            Title = string.Format ("  {0}", "Friend Detail");

            #region Initialize some properties on the Page
            Padding = new Thickness(20);
            BindingContext = user;
            #endregion

            #region Initialize the command that will be execute when the user clicks on the delete button.
            _deleteCommand =  new Command(() => {
                //App.Groups.Remove(_user);
                Navigation.PopAsync();
            });
            #endregion

            #region Create the controls for the Page.
            Image userImage = new Image
            {
                HeightRequest = 200,
                Source = ImageSource.FromFile(_user.ImageFile),
            };

            // Put the two buttons inside a grid
            Grid buttonsLayout = new Grid
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) },
                },
                Children =
                {
                    { CreateDeleteButton(), 0, 0 },
                    { CreateSaveButton(), 1, 0 }
                }
                };

            // Create a grid to hold the Labels & Entry controls.
            Grid inputGrid = new Grid
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition { Width = GridLength.Auto },
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                },
                Children =
                {
                    { new Label { Text = "Name:", FontFamily = Fonts.SmallTitle.FontFamily, FontSize = Fonts.SmallTitle.FontSize, TextColor = AppColors.SubTitle }, 0, 0 },
                    { new Label { Text = "Biography:", FontFamily = Fonts.SmallTitle.FontFamily, FontSize = Fonts.SmallTitle.FontSize, TextColor = AppColors.SubTitle }, 0, 1 },
                    { new Label { Text = "Gender: ", XAlign = TextAlignment.End, FontFamily = Fonts.SmallTitle.FontFamily, FontSize = Fonts.SmallTitle.FontSize, TextColor = AppColors.SubTitle }, 0, 2 },
                    { CreateEntryFor("Name"), 1, 0 },
                    { CreateEntryFor("Biography"), 1, 1 },
                    { CreateEntryFor("Gender"), 1, 2 }
                }
                };
            #endregion

            // Add the controls to a StackLayout
            Content = new StackLayout
            {
                Children =
                {
                    userImage,
                    inputGrid,
                    buttonsLayout
                }
                };
        }
Exemplo n.º 2
0
 public static int SaveTask(User item)
 {
     return me.db.SaveItem(item);
 }