コード例 #1
0
        public BookDetailsViewModel(Book selectedBook)
        {
            this.client = new ReadmillClient(AppContext.ClientId);
            this.SelectedBook = selectedBook;

            //find out if a reading exists for this book
        }
コード例 #2
0
        public Task<string> PostBookAsync(string accessToken, Book newBook)
        {
            IDictionary<string, string> parameters = GetInitializedParameterCollection();
            parameters.Add(ReadmillConstants.AccessToken, accessToken);

            var booksUrl = booksUriTemplates[BooksUriTemplateType.Books].BindByName(this.readmillBaseUri, parameters);

            return PostAsync<Book>(newBook, booksUrl);
        }
コード例 #3
0
ファイル: AppContext.cs プロジェクト: totobogy/ReadmillDotNet
        /// <summary>
        /// Must only be called after the actual operation on Readmill has succeeded.
        /// This is only an optimization to avoid extra web service call
        /// </summary>
        /// <param name="book"></param>
        public void AddBookToLocalCollection(Book book)
        {
            lock (this)
            {
                //should never happen
                if (collectedBooks == null)
                    throw new InvalidOperationException("Book collection must be already initialized.");

                if (!collectedBooks.ContainsKey(book.Id))
                    collectedBooks.Add(book.Id, book);
            }
        }
コード例 #4
0
 public BookHighlightsViewModel(Book selectedBook)
     : base(selectedBook)
 {
     client = new ReadmillClient(AppContext.ClientId);
 }