Beispiel #1
0
        /// <summary>
        /// Displays the book information.
        /// </summary>
        /// <param name="url">The URL.</param>
        private async void DisplayBookInfo(string url)
        {
            MyGridView.Opacity = 0.5;
            IsLoading(true);
            try
            {
                Book book = await CreateBookObjectFromApiObject.CreateBookFromGoogleApi(url);

                var contentDialog = new ContentDialogController().CreateBookContentDialog(book);
                if (LoggedInUser.CurrentLoggedInUser == null)
                {
                    contentDialog.IsPrimaryButtonEnabled = false;
                }


                ContentDialogResult result = await contentDialog.ShowAsync();

                if (result == ContentDialogResult.Primary)
                {
                    await DonauApi.ApiHelper.PostBook(LoggedInUser.CurrentLoggedInUser, book);

                    UpdateCollection();
                }
            }
            catch (Exception e)
            {
                new ContentDialogController().CreateErrorContentDialog(e.Message);
            }
            IsLoading(false);
            MyGridView.Opacity = 1;
        }
Beispiel #2
0
        /// <summary>Fills the grid view.</summary>
        /// <param name="list">The list.</param>
        /// <returns>true if list is populated, false if not </returns>
        private async Task <bool> FillGridView(List <JObject> list)
        {
            if (list.Count > 0)
            {
                foreach (var item in list)
                {
                    Book b = await CreateBookObjectFromApiObject.CreateBookFromGoogleApiLightWeight(item["selfLink"].ToString());

                    searchResultCollection.Add(b);
                }
                ;
                return(true);
            }
            else
            {
                return(false);
            }
        }