private void ShowNextChapter() { if (this.ChapterIndex == book.ChapterCount - 1) { return; } this.ChapterIndex++; ChapterView temp = PrevChapterView; PrevChapterView = CurrChapterView; CurrChapterView = NextChapterView; NextChapterView = temp; UpdateChapterViewVisibilities(); CurrChapterView.ScrollToStart(); if (this.ChapterIndex == book.ChapterCount - 1) { return; } NextChapterView.ShowChapter(book.ReadChapter(this.ChapterIndex + 1)); }
private void ShowPrevChapter() { if (this.ChapterIndex == 0) { return; } this.ChapterIndex--; ChapterView temp = NextChapterView; NextChapterView = CurrChapterView; CurrChapterView = PrevChapterView; PrevChapterView = temp; UpdateChapterViewVisibilities(); CurrChapterView.ScrollToEnd(); if (this.ChapterIndex == 0) { return; } PrevChapterView.ShowChapter(book.ReadChapter(this.ChapterIndex - 1)); }
public Chapter(ChapterView chapter, int creativeId) { Name = chapter.Name; Text = chapter.Text; Position = chapter.Position; CreativeId = creativeId; }
public async Task Setup() { var chapter = new ChapterView { Title = RandomData.Name, ChapterNumber = 1 }; _response = await Client.PostObject($"/libraries/{LibraryId}/books/{-RandomData.Number}/chapters", chapter); }
public async Task Setup() { var book = BookBuilder.WithLibrary(LibraryId).Build(); var chapter = new ChapterView { Title = new Faker().Random.String(), ChapterNumber = 1 }; _response = await Client.PostObject($"/libraries/{LibraryId}/books/{book.Id}/chapters", chapter); }
public async Task Setup() { var chapters = ChapterBuilder.WithLibrary(LibraryId).WithContents().Build(4); var chapter = chapters.PickRandom(); var chapter2 = new ChapterView { Title = RandomData.Name }; _response = await Client.PutObject($"/libraries/{LibraryId}/books/{chapter.BookId}/chapters/{chapter.ChapterNumber}", chapter2); }
public async Task Setup() { var book = BookBuilder.WithLibrary(LibraryId).Build(); _newChapter = new ChapterView { Title = RandomData.Name, BookId = book.Id, ChapterNumber = RandomData.Number }; _response = await Client.PutObject($"/libraries/{LibraryId}/books/{book.Id}/chapters/{_newChapter.ChapterNumber}", _newChapter); _chapterAssert = ChapterAssert.FromResponse(_response, LibraryId); }
public async Task Setup() { var chapters = ChapterBuilder.WithLibrary(LibraryId).Build(4); var chapter = chapters.PickRandom(); newChapter = new ChapterView { Title = RandomData.Name, BookId = chapter.BookId }; _response = await Client.PutObject($"/libraries/{LibraryId}/books/{chapter.BookId}/chapters/{chapter.ChapterNumber}", newChapter); _assert = ChapterAssert.FromResponse(_response, LibraryId); }
public async Task Setup() { _libBuilder = Services.GetService <LibraryDataBuilder>(); var library2 = _libBuilder.Build(); var book = BookBuilder.WithLibrary(library2.Id).Build(); var chapter = new ChapterView { Title = RandomData.Name, ChapterNumber = 1, BookId = book.Id }; _response = await Client.PostObject($"/libraries/{LibraryId}/books/{book.Id}/chapters", chapter); }
public static ChapterModel Map(this ChapterView source) => new ChapterModel { Id = source.Id, Title = source.Title, ChapterNumber = source.ChapterNumber, BookId = source.BookId, Status = source.Status.ToEnum(EditingStatus.Available), WriterAccountId = source.WriterAccountId, WriterAccountName = source.WriterAccountName, WriterAssignTimeStamp = source.WriterAssignTimeStamp, ReviewerAccountId = source.ReviewerAccountId, ReviewerAccountName = source.ReviewerAccountName, ReviewerAssignTimeStamp = source.ReviewerAssignTimeStamp, };
public async Task <IActionResult> CreateChapter(int libraryId, int bookId, [FromBody] ChapterView chapter, CancellationToken token = default(CancellationToken)) { if (!ModelState.IsValid) { return(new BadRequestObjectResult(ModelState)); } var request = new AddChapterRequest(libraryId, bookId, _userHelper.Account?.Id, chapter.Map()); await _commandProcessor.SendAsync(request, cancellationToken : token); if (request.Result != null) { var renderResult = _chapterRenderer.Render(request.Result, libraryId, bookId); return(new CreatedResult(renderResult.Links.Self(), renderResult)); } return(new BadRequestResult()); }
private void ConfigureChapterViews() { chv1 = FindViewById <ChapterView>(Resource.Id.chapterView1); PrevChapterView = chv1; chv2 = FindViewById <ChapterView>(Resource.Id.chapterView2); CurrChapterView = chv2; chv3 = FindViewById <ChapterView>(Resource.Id.chapterView3); NextChapterView = chv3; this.RelativePageNumberChanged += database.OnRelativePageIndexChanged; ConfigureChapterView(PrevChapterView); ConfigureChapterView(CurrChapterView); ConfigureChapterView(NextChapterView); UpdateChapterViewVisibilities(); }
///////////////////////////////////////////////////////////////////// private void ConfigureChapterView(ChapterView chv) { chv.Settings.JavaScriptCanOpenWindowsAutomatically = true; chv.Settings.JavaScriptEnabled = true; chv.HorizontalScrollBarEnabled = false; chv.VerticalScrollBarEnabled = false; chv.SetWebViewClient(new WebViewClient()); chv.SetWebChromeClient(new MyWebChromeClient()); (chv.MyWebChromeClient).SwipeLeft += () => { ScrollToNextPage(); }; (chv.MyWebChromeClient).SwipeRight += () => { ScrollToPrevPage(); }; chv.MyWebChromeClient.SwipeDown += () => { topMenuLayout.Visibility = ViewStates.Visible; }; chv.MyWebChromeClient.WordSelected += (string word, string sentence) => { GlobalData.CurrentWord = word; GlobalData.CurrentContext = sentence; Intent nextActivityIntent = new Intent(this, typeof(TranslationActivity)); StartActivity(nextActivityIntent); }; chv.BaseURL = "file://" + book.RootFolderPath + "/"; }
internal void ShouldMatch(ChapterView view) { _chapter.Title.Should().Be(view.Title); _chapter.BookId.Should().Be(view.BookId); _chapter.ChapterNumber.Should().Be(view.ChapterNumber); }
public async Task <IActionResult> UpdateChapter(int libraryId, int bookId, int chapterNumber, [FromBody] ChapterView chapter, CancellationToken token = default(CancellationToken)) { if (!ModelState.IsValid) { return(new BadRequestObjectResult(ModelState)); } var request = new UpdateChapterRequest(libraryId, bookId, chapterNumber, chapter.Map()); await _commandProcessor.SendAsync(request, cancellationToken : token); var renderResult = _chapterRenderer.Render(request.Result.Chapter, libraryId, bookId); if (request.Result.HasAddedNew) { return(new CreatedResult(renderResult.Links.Self(), renderResult)); } return(new OkObjectResult(renderResult)); }
public ChapterAssert(ChapterView view, int libraryId) { _libraryId = libraryId; _chapter = view; }
internal static ChapterAssert FromObject(ChapterView view, int libraryId) { return(new ChapterAssert(view, libraryId)); }
internal static ChapterAssert ShouldMatch(this ChapterView view, ChapterDto dto, int libraryId) { return(ChapterAssert.FromObject(view, libraryId).ShouldBeSameAs(dto)); }
public ChapterAssert(HttpResponseMessage response, int libraryId) { _response = response; _libraryId = libraryId; _chapter = response.GetContent <ChapterView>().Result; }