Пример #1
0
 public void Click()
 {
     imageSelected.SetActive(true);
     imageUnselected.SetActive(false);
     TextSelected.SetActive(true);
     TextUnselected.SetActive(false);
     anotherTextSelected.SetActive(false);
     anotherTextUnselected.SetActive(true);
 }
        private void SelectFromStartToEnd()
        {
            ResetSelectionTextRange();
            TextRange textRange = new TextRange(StartSelectPosition, EndSelectPosition);

            textRange.ApplyPropertyValue(TextElement.ForegroundProperty, SystemColors.HighlightTextBrush);
            textRange.ApplyPropertyValue(TextElement.BackgroundProperty, SystemColors.HighlightBrush);

            SelectedText = textRange.Text;
            TextSelected?.Invoke(SelectedText);
        }
Пример #3
0
        public void FireTextSelected(string selectedText, int pageNumber, float percentalTopLeftX, float percentalTopLeftY, float percentalWidth, float percentalHeight)
        {
            var areaInfo = new PercentalAreaInfo()
            {
                PageNumber = pageNumber,
                TopLeftX   = percentalTopLeftX,
                TopLeftY   = percentalTopLeftY,
                Width      = percentalWidth,
                Height     = percentalHeight
            };

            TextSelected?.Invoke(selectedText, areaInfo);
        }
        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            base.OnMouseUp(e);
            Point mouseUpPoint = e.GetPosition(this);

            EndSelectPosition = this.GetPositionFromPoint(mouseUpPoint, true);

            TextRange otr = new TextRange(this.ContentStart, this.ContentEnd);

            otr.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(Colors.Transparent));

            if (StartSelectPosition != null && EndSelectPosition != null)
            {
                TextRange ntr = new TextRange(StartSelectPosition, EndSelectPosition);
                ntr.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(Colors.Gray));

                SelectedText = ntr.Text;
                TextSelected?.Invoke(SelectedText);
            }
        }
        protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
        {
            if (DefaultBehaviour)
            {
                base.OnMouseLeftButtonUp(e);
            }

            // Verify that we actually selected something before updating the state
            if (!String.IsNullOrEmpty(selection.Selected))
            {
                state = SelectionState.Selected;
                // If the event is bound, we pass it the currently selected text
                // we also make sure it's not the same text as last time
                if (selection.Selected != previousSelection)
                {
                    TextSelected?.Invoke(selection.Selected);
                }
                previousSelection = selection.Selected;
            }
            else
            {
                state = SelectionState.None;
            }
        }
Пример #6
0
 private void ViewerControlBase_TextSelected(string selectedText, PercentalAreaInfo areaInfo)
 {
     TextSelected?.Invoke(selectedText, areaInfo);
 }