private void CutOrCopySelectedText(bool cut)
        {
            ContextFlyout.Hide();

            string text = Document.Selection.Text;

            if (text.Length == 0)
            {
                return;
            }

            bool isTrimmed = false;

            if (text[text.Length - 1] == '\r')
            {
                text = text.Substring(0, text.Length - 1);

                isTrimmed = true;
            }

            if (ClipboardHelper.TryCopy(text) && cut)
            {
                if (isTrimmed)
                {
                    Document.Selection.EndPosition--;
                }

                Document.Selection.Text = string.Empty;
            }
        }
        private async void PasteFromClipboard()
        {
            ContextFlyout.Hide();

            if (await ClipboardHelper.TryGetTextAsync() is string text)
            {
                InsertText(text);
            }
        }
Пример #3
0
 private void Context(object sender, RightTappedRoutedEventArgs e)
 {
     ContextFlyout.ShowAt(Site, e.GetPosition(sender as UIElement));
 }