private async void ReadPage_OrientationChanged(object sender, OrientationChangedEventArgs e) { PageCanvas.SetSize(ActualWidth, ActualHeight, ActualWidth, ActualHeight - AppBar.HeightInMinimizedState); PageCanvas.Clear(); UpdateTrayVisibility(); Redraw(); }
public async void Redraw() { if (!_isLoaded) { return; } using (await BusyOverlay.Create()) { await _event.WaitAsync(); _pageManipulationListener = InitializePageManipulationListener(); _textManipulationListener = InitializeTextManipulationListener(); ManipulationService.SetManipulationListener(PageCanvas, _pageManipulationListener); SystemTray.IsVisible = true; SystemTray.SetForegroundColor(this, AppSettings.Default.ColorScheme.SystemTrayForegroundColor); Background = AppSettings.Default.ColorScheme.BackgroundBrush; SupportedOrientations = AppSettings.Default.Orientation; PageCanvas.Clear(); PageCanvas.SetSize(ActualWidth, ActualHeight, ActualWidth, ActualHeight - AppBar.HeightInMinimizedState); PageCanvas.AddBookmark -= AddBookmark; PageCanvas.AddBookmark += AddBookmark; PageCanvas.Translate -= Translate; PageCanvas.Translate += Translate; PageCanvas.Copy -= Copy; PageCanvas.Copy += Copy; PageCanvas.Share -= ShareText; PageCanvas.Share += ShareText; PageCanvas.Manipulator = new ManipulatorFactory(PageCanvas).CreateManipulator(AppSettings.Default.FlippingStyle, AppSettings.Default.FlippingMode); AppBar.Visibility = Visibility.Visible; AppBar.ApplicationBarMinimizedStateView = AppSettings.Default.HideMenu ? ApplicationBarMinimizedState.Hidden : ApplicationBarMinimizedState.Minimized; AppBar.Background = AppSettings.Default.ColorScheme.ApplicationBarBackgroundBrush; AppBar.SliderForegroundBrush = AppSettings.Default.ColorScheme.ProgressBarBrush; AppBar.PageSelected -= AppBar_PageSelected; AppBar.PageSelected += AppBar_PageSelected; AppBar.PageSelectionCancelled -= AppBarOnPageSelectionCancelled; AppBar.PageSelectionCancelled += AppBarOnPageSelectionCancelled; AppBar.PageSelectionApplied -= AppBarOnPageSelectionApplied; AppBar.PageSelectionApplied += AppBarOnPageSelectionApplied; UpdateFontMenuItemAvailability(); _offsetX = AppSettings.Default.Margin.Left; _offsetY = AppSettings.Default.Margin.Top; Brightness.Opacity = 1 - AppSettings.Default.Brightness / 100f; PageCanvas.Manipulator.TurnForward += () => TurnPage(true); PageCanvas.Manipulator.TurnBackward += () => TurnPage(false); if (!string.IsNullOrEmpty(ViewModel.BookId)) { _data = new BookData(ViewModel.BookId); PageCanvas.Bookmarks = _bookmarkRepository.GetBookmarks(ViewModel.BookId); } await CreateController(); AppBar.IconButtons[1].IsEnabled = _data.HasTableOfContents; UpdateTrayVisibility(); _event.Release(); } }