Exemplo n.º 1
0
            public int InsertPaddingChapters()
            {
                int chCount = Chapters.Count;

                if (chCount == 0)
                {
                    return(0);
                }

                var ch = Chapters.First();

                if (ch.Time.Begin > TimeSpan.Zero && !ch.IsPaddingChapter)
                {
                    var preChapter = new Chapter(ch.Time.Begin)
                    {
                        IsPaddingChapter = true
                    };
                    Chapters.Insert(0, preChapter);
                }

                ch = Chapters.Last();
                if (ch.Time.End < this.Duration && !ch.IsPaddingChapter)
                {
                    var postChapter = new Chapter(ch.Time.End, this.Duration)
                    {
                        IsPaddingChapter = true
                    };
                    Chapters.Add(postChapter);
                }

                return(Chapters.Count - chCount);
            }
Exemplo n.º 2
0
 private async Task LoadChapter()
 {
     if (SelectedChapter is null)
     {
         return;
     }
     try
     {
         var chapter = SelectedChapter;
         Chapters.First(ch => ch.Id == chapter.Id).ChapterRead = true;
         //await _historyService.MarkChapter(Work.WorkId, SelectedChapter.Id);
         await Navigator.NavigateToAsync("ChapterReading",
                                         new Dictionary <string, object> {
             { "chapter", chapter }, { "work", Work }
         });
     }
     catch (Exception ex)
     {
         await Alerts.CallAlertAsync(ex);
     }
     finally
     {
         SelectedChapter = null;
     }
 }
Exemplo n.º 3
0
        protected TestSuite(List <SvgTest> tests)
        {
            testsByChapter = new Dictionary <string, List <SvgTest> >();

            foreach (var test in tests)
            {
                List <SvgTest> chapterTests;
                if (!testsByChapter.TryGetValue(test.Chapter, out chapterTests))
                {
                    chapterTests = new List <SvgTest>();
                    testsByChapter.Add(test.Chapter, chapterTests);
                }

                chapterTests.Add(test);
            }

            selectedChapter = Chapters.First();
            SelectedTest    = Tests[0];

            BackgroundDownloadTestData();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Установить текущую главу по наименованию
 /// </summary>
 /// <param name="chapterCaption"></param>
 /// <param name="saveOnDisk"></param>
 public void SetCurrentChapterByCaption([NotNull] string chapterCaption, bool saveOnDisk)
 {
     RuntimeEnvironment.ChapterSelected = true;
     _currentChapter = Chapters.FirstOrDefault(x => x.Caption == chapterCaption) ?? Chapters.First();
     if (saveOnDisk)
     {
         Helpers.WriteDiscContent(TestsManager.CURRENT_CHAPTER_FILE, chapterCaption);
     }
 }