public async Task SetContent(string Content, ReaderStartMode mode = ReaderStartMode.First, int startLength = 0) { _isSizeChangeLoaded = false; _content = Content; LoadingStatusChanged?.Invoke(this, LoadingStatus.Loading); await CreateContent(); _startTextIndex = startLength; IsCoreSelectedChanged = true; var index = 0; switch (mode) { case ReaderStartMode.First: index = 0; break; case ReaderStartMode.Last: index = Count - 1; break; case ReaderStartMode.Stay: index = Index > Count - 1 ? Count - 1 : Index; break; } if (startLength != 0) { index = AddonOffset(startLength); } Index = index; GoToIndex(Index, false); IsCoreSelectedChanged = false; LoadingStatusChanged?.Invoke(this, LoadingStatus.Completed); }
public async void SetContent(string Content, ReaderStartMode mode = ReaderStartMode.First, int startLength = 0) { _isSizeChangeLoaded = false; _content = Content; LoadingStatusChanged?.Invoke(this, LoadingStatus.Loading); await CreateContent(); _startTextIndex = startLength; IsCoreSelectedChanged = true; var index = 0; switch (mode) { case ReaderStartMode.First: index = 0; break; case ReaderStartMode.Last: index = Count - 1; break; case ReaderStartMode.Stay: index = Index > Count - 1 ? Count - 1 : Index; break; } if (startLength != 0) { int childrenCount = _tempOverflowList.Count; var signNumber = Content.Length / childrenCount; index = Convert.ToInt32(Math.Floor(startLength / (signNumber * 1.0))); index = Convert.ToInt32(Math.Round(index / (_columns * 1.0))); index = index > Count - 1 ? Count - 1 : index; } Index = index; GoToIndex(Index, false); IsCoreSelectedChanged = false; LoadingStatusChanged?.Invoke(this, LoadingStatus.Completed); }