示例#1
0
 void Device_StackingTouchEvent(object sender, StackingTouchEventArgs e)
 {
     Dispatcher.Invoke(DispatcherPriority.Background,
       (Action)delegate()
       {
     UIThreadDevice_StackingTouchEvent(sender, e);
       });
 }
示例#2
0
        private void UIThreadDevice_StackingTouchEvent(object sender, StackingTouchEventArgs e)
        {
            if (e.Action == TouchAction.Down)
              {
            StylusPointCollection points = new StylusPointCollection();
            points.Add(new StylusPoint(e.Location.X, e.Location.Y));
            stackingSelectionStroke = new Stroke(points, inkCScribble.DefaultDrawingAttributes);
            inkCScribble.Strokes.Add(stackingSelectionStroke);
              }
              else if (e.Action == TouchAction.Move)
              {
            stackingSelectionStroke.StylusPoints.Add(new StylusPoint(e.Location.X, e.Location.Y));
            foreach (ScribbleCollection collection in ActualDocument[ActualPage].ScribblingCollections)
            {
              foreach (Stroke stroke in collection.Scribbles)
              {
            if (!stroke.HitTest(e.Location))
              continue;
            Synch.SendContent(ActualDocument.ID, ActualPage, stroke);
              }
            }

            var line = cHighlights.InputHitTest(e.Location);
            if (line == null || !(line is Line))
              return;
            Highlight highlight = (Highlight)ActualDocument[ActualPage].Highlights.SingleOrDefault(tmp => (tmp as Highlight).Line == line);
            if (highlight == null)
              return;
            Synch.SendContent(ActualDocument.ID, ActualPage, highlight);
              }
              else if (e.Action == TouchAction.Up)
              {
            if (inkCScribble.Strokes.Contains(stackingSelectionStroke))
              inkCScribble.Strokes.Remove(stackingSelectionStroke);
              }
        }