public static void SetManipulationListener(UIElement element, ManipulationListener listener)
 {
     element.SetValue(ManipulationService.ManipulationListenerProperty, (object)listener);
 }
Пример #2
0
        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();
            }
        }
Пример #3
0
 private ManipulationListener InitializePageManipulationListener()
 {
     var ml = new ManipulationListener();
     ml.Hold += PageOnHold;
     ml.Started += ml_Started;
     ml.Tap += PageOnTap;
     ml.Delta += MlOnDelta;
     ml.Completed += MlOnCompleted;
     return ml;
 }
Пример #4
0
 private ManipulationListener InitializeTextManipulationListener()
 {
     var manipulationListener = new ManipulationListener();
     manipulationListener.Tap += OnTextTap;
     manipulationListener.Hold += PageOnHold;
     manipulationListener.Started += OnTextManipulatonStated;
     manipulationListener.Delta += OnTextManipulatonDelta;
     manipulationListener.Completed += OnTextManipulatonCompeted;
     return manipulationListener;
 }
 public static void SetManipulationListener(UIElement element, ManipulationListener listener)
 {
     element.SetValue(ManipulationService.ManipulationListenerProperty, (object)listener);
 }