private void ClearTextSelection() { TouchPanel.EnabledGestures = GestureType.None; PageCanvas.ClearSelection(); ManipulationService.SetManipulationListener(PageCanvas, _pageManipulationListener); PageCanvas.Manipulator.Resume(); AppBar.Visibility = Visibility.Visible; }
private void InitTextSelection(TextRenderData word, TextRenderData wordContinuation) { AppBar.Close(); PageCanvas.Manipulator.Pause(); PageCanvas.SetSelection(word, wordContinuation); ManipulationService.SetManipulationListener(PageCanvas, _textManipulationListener); TouchPanel.EnabledGestures = GestureType.FreeDrag; AppBar.Visibility = Visibility.Collapsed; PageCanvas.ShowActionButtons(); }
private void AddBookmark(string text, TextRenderData first, TextRenderData last) { ColorSelector.Show(); ClearTextSelection(); ManipulationService.SetManipulationListener(PageCanvas, _dummyManipulationListenner); _bookmarkText = text; _bookmarkFirstTextContext = first; _bookmarkLastTextContext = last; }
private void ColorSelectorOnClosed() { ManipulationService.SetManipulationListener(PageCanvas, _pageManipulationListener); }
private void ColorSelectorOnColorSelected(Color color) { ColorSelector.Hide(); ManipulationService.SetManipulationListener(PageCanvas, _pageManipulationListener); AddBookmark(_bookmarkText, _bookmarkFirstTextContext, _bookmarkLastTextContext, color); }
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(); } }