/>Сейчас html представлен в виде коллекции
Код: Выделить всё
public ObservableCollection ParsedChapters { get; set; } = new ObservableCollection();
Код: Выделить всё
private void PopulateContent()
{
ParsedChapters.Clear();
double lineHeight = FontSize * 1.2;
int linesPerPage = (int)(_screenHeight / lineHeight);
double avgCharWidth = _fontSize * 0.6;
int charsPerLine = (int)(_sreenWidth / avgCharWidth);
int charsPerPage = linesPerPage * charsPerLine;
int totalLength = _bookContent.Length;
int chunkCount = (int)Math.Ceiling((double)totalLength / charsPerPage);
Pages = chunkCount;
OnPropertyChanged(nameof(CurrentPageDisplay));
for (int i = 0; i < chunkCount; i++)
{
int start = i * charsPerPage;
int length = Math.Min(charsPerPage, totalLength - start);
string chunk = new string(_bookContent.Slice(start, length).ToArray());
ParsedChapters.Add(chunk);
}
}
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/786 ... ike-a-book
Мобильная версия