Exemplo n.º 1
0
        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            base.OnBackKeyPress(e);

            if (AppBar.IsOpen)
            {
                AppBar.Close();
                e.Cancel = true;
            }

            if (_textManipulationListener != null && _textManipulationListener.IsAttached)
            {
                ClearTextSelection();
                e.Cancel = true;
            }

            if (TranslationControl.IsOpen)
            {
                TranslationControl.Hide();
                e.Cancel = true;
            }

            if (_oldOffset != null)
            {
                ViewModel.TokenOffset = _oldOffset.Value;
                _oldOffset            = null;
                CreateController();
                e.Cancel = true;
            }
        }
Exemplo n.º 2
0
 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 CopyLink_OnTap(object sender, GestureEventArgs e)
        {
            AppBar.Close();
            Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), () =>
            {
                if (string.IsNullOrEmpty(Link))
                {
                    return;
                }

                Clipboard.SetText(Link);
            });
        }
Exemplo n.º 4
0
        private void ml_Started(object sender, ManipulationStartedEventArgs e)
        {
            var clickPoint = e.ManipulationContainer.TransformToVisual(this).Transform(e.ManipulationOrigin);

            var topToBottomInversed = new Point(clickPoint.X, ActualHeight - clickPoint.Y);

            _link = PageCanvas.CurrentLinks.FirstOrDefault(l => l.Rect.Contains(clickPoint));
            if (_link != null)
            {
                PageCanvas.Manipulator.Pause();
                return;
            }

            bool isAppBarTriangleAreTapped = MathHelper.IsPointInTriangle(
                new Point(0, AppBar.HeightInMinimizedState),
                new Point(ActualWidth / 2, 120 + AppBar.HeightInMinimizedState),
                new Point(ActualWidth, AppBar.HeightInMinimizedState), topToBottomInversed);

            if (isAppBarTriangleAreTapped)
            {
                e.Handled = true;
                e.Complete();

                PageCanvas.Manipulator.CancelNextEvent();
                AppBar.Open();
            }
            else
            {
                if (AppBar.IsOpen)
                {
                    e.Handled = true;
                    e.Complete();

                    PageCanvas.Manipulator.CancelNextEvent();
                    AppBar.Close();
                }
            }
        }