示例#1
0
        public AuthorPage(string name)
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, true);
            ((NavigationPage)Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#efefef");
            Author authorClass = new Author();

            authorClass        = authorData.GetAuthorbyName(name);
            AuthorImage.Source = authorClass.AuthorPhoto;
            AuthorInfo.Text    = authorClass.AuthorDescription;
            AuthorNAME.Text    = authorClass.AuthorName;

            List <Model.Book> BookList = authorData.GetBooks(name);

            for (int i = 0; i < BookList.Count; i++)
            {
                Image bookImage = new Image {
                    Source = BookList[i].BookPhoto
                };
                MyStackLayout.Children.Add(bookImage);
                var tapGestureRecognizer = new TapGestureRecognizer();
                tapGestureRecognizer.Tapped += (s, e) => {
                    ImageTapped(bookImage.Source.ToString().Replace("Uri: ", ""));
                };
                bookImage.GestureRecognizers.Add(tapGestureRecognizer);
            }
        }
示例#2
0
        public BookPage(string name)
        {
            InitializeComponent();
            ((NavigationPage)Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#efefef");
            Book book = BookDataAccess.GetBookByName(name);

            Bookphoto.Source     = book.BookPhoto;
            Bookname.Text        = book.BookName;
            BookDescription.Text = book.Description;
            AuthorName.Text      = book.AuthorName;
            Author authorClass = author.GetAuthorbyName(book.AuthorName);

            AuthorPhoto.Source = authorClass.AuthorPhoto;
            nameOfPage         = name;

            CommentDataAccess commentDataAccess = new CommentDataAccess();
            List <Comment>    comments          = commentDataAccess.GetCommentOfBook(name);

            foreach (Comment comment in comments)
            {
                AddCommentToPage(comment);
            }
        }