示例#1
0
        private void appbar_nextClick(object sender, RoutedEventArgs e)
        {
            if (TempPointerDictionary.Count == 0)
            {
                return;
            }
            List <uint> keys     = TempPointerDictionary.Keys.ToList();
            uint        key      = keys.Min();
            Polyline    polyline = TempPointerDictionary[key];

            CanvasLine.Children.Add(polyline);
            PointerDictionary.AddValue(key, polyline);
            TempPointerDictionary.RemoveValue(key);
        }
示例#2
0
        protected override void OnPointerPressed(PointerRoutedEventArgs e)
        {
            base.OnPointerPressed(e);
            if (this.cVsCover.Visibility == Visibility.Visible)
            {
                this.cVsCover.Visibility = Visibility.Collapsed;
            }
            PointerPoint point = e.GetCurrentPoint(this);
            var          line  = new Crossline(Colors.White, point);

            line.Tag = point.PointerId;
            Color color = colors[random.Next(0, colors.Count - 1)];

            line.LineColor = color;
            CanvasLine.Children.Add(line.HorizontalPath);
            CanvasLine.Children.Add(line.VerticalPath);
            points.Add(line);
            if (points.Count > Config.supportMaxTouchs.Value)
            {
                Config.supportMaxTouchs.Value = points.Count;
            }
            if (Config.isNeedShowTrace.Value)
            {
                //var pointForTrace = new Point(point.Position.X, point.Position.Y - Config.TOUCH_Y_OFFSET);
                var pointForTrace = new Point(point.Position.X, point.Position.Y);
                var polyline      = new Polyline();
                polyline.Stroke          = new SolidColorBrush(color);
                polyline.StrokeThickness = Config.TraceThickness.Value;
                CanvasLine.Children.Add(polyline);
                PointerDictionary.AddValue(point.PointerId, polyline);
            }
            if (Config.isShowCoord.Value)
            {
                TextBlock textBlock = new TextBlock();
                textBlock.TextWrapping = TextWrapping.Wrap;
                textBlock.Width        = StackPanelCoords.Width;
                textBlock.Height       = 40;
                textBlock.Tag          = point.PointerId;
                textBlock.Foreground   = new SolidColorBrush(color);
                textBlocks.Add(textBlock);
                textBlock.Text = string.Format("Point{0}:  x:{1:N0} y:{2:N0}", textBlocks.IndexOf(textBlock) + 1, point.Position.X * Config.scaleFactor,
                                               point.Position.Y * Config.scaleFactor);
                StackPanelCoords.Children.Add(textBlock);
            }
        }