Пример #1
0
        private void Recorder_Captured(object sender, Vision.Point e)
        {
            Dispatcher.Invoke(() =>
            {
                Ellipse el = new Ellipse();
                if (white == null)
                {
                    white         = new SolidColorBrush(Colors.White);
                    white.Opacity = 0.3;
                    white.Freeze();

                    stroke = new SolidColorBrush(Colors.Cyan);
                    stroke.Freeze();
                }

                el.Fill            = white;
                el.Width           = 20;
                el.Height          = 20;
                el.Stroke          = stroke;
                el.StrokeThickness = 1;

                cv_points.Children.Add(el);

                Canvas.SetLeft(el, e.X - 10);
                Canvas.SetTop(el, e.Y - 10);
            });
        }
Пример #2
0
 void Cursor_Clicked(object sender, Vision.Point e)
 {
     Window.Dispatcher.Invoke(() =>
     {
         Window.Click(false);
     });
 }
Пример #3
0
        private void Recorder_SetPoint(object sender, EyeGazePointArg e)
        {
            canvas.Dispatcher.Invoke(() =>
            {
                if (storyboard != null)
                {
                    storyboard.Stop();
                    storyboard = null;
                }

                storyboard = new Storyboard();

                Duration d           = new Duration(TimeSpan.FromMilliseconds(e.WaitTime * 0.66));
                DoubleAnimation aniX = new DoubleAnimation(lastpoint.X, e.Point.X, d);
                DoubleAnimation aniY = new DoubleAnimation(lastpoint.Y, e.Point.Y, d);

                Storyboard.SetTargetProperty(aniX, new PropertyPath("(Canvas.Left)"));
                Storyboard.SetTargetProperty(aniY, new PropertyPath("(Canvas.Top)"));
                Storyboard.SetTarget(aniX, pointer);
                Storyboard.SetTarget(aniY, pointer);

                storyboard.Children.Add(aniX);
                storyboard.Children.Add(aniY);

                storyboard.Begin();

                lastpoint = e.Point;

                SolidColorBrush brush = new SolidColorBrush(Color.FromArgb((byte)e.Color.Value4, (byte)e.Color.Value1, (byte)e.Color.Value2, (byte)e.Color.Value3));
                brush.Freeze();
                ellipse.Fill = brush;
            });
        }