Dot BuildControlPoint(Point location, int index, Brush color, bool isUser) { Dot knotPoint = new Dot() { Center = location, Fill = color, Radius = isUser? 16 : 8}; knotPoint.Tag = index; return knotPoint; }
void NewSession() { if (Test.Count == conditions.Count) return; int[] condition = conditions[Test.SelectionIndex % conditions.Count]; int rIndex = condition[1]; int dIndex = condition[2]; float radius = sizes[rIndex]; float maxDistance = distances[dIndex]; Indicator.Fill = Brushes.Red; if (targets != null && targets.Count > 0) { foreach (UIElement d in targets) Canvas.Children.Remove(d); targets.Clear(); } Point[] points = GeoHelper.ChooseTrianglePoints(new Point(960, 540), maxDistance, radius); Dot target1 = new Dot() { Fill = Brushes.Red, Radius = 32, Center = points[0], Tag = 1 }; Marker target2 = new Marker() { Fill = Brushes.Blue, Side= radius*2, Center = points[1], Tag = 2 }; Marker target3 = new Marker() { Fill = Brushes.Green, Side = radius* 2, Center = points[2], Tag = 3 }; targets = new List<IDot>() { target1, target2, target3 }; Canvas.Children.Add(target1); Canvas.Children.Add(target2); Canvas.Children.Add(target3); gazeOn = true; // Participant, Rep, Size, Distance, Time ClockLabel.Visibility = Visibility.Hidden; }
void Init() { gazeRadius = (int)CrossHair.Width / 2; tracker = new TrackerWrapper(); knotPoints = new Dictionary<TouchDevice, Dot>(); dots = new List<Dot>(); InitializeComponent(); startPoint = UserCurve.Points[0]; Canvas.Children.Add(BuildEndPoint(UserCurve.Points[0])); for (int i = 1; i < UserCurve.Points.Count - 1; i++) { Point p = UserCurve.Points[i]; Dot knotPoint = new Dot() { Center = p }; knotPoint.Tag = i; Canvas.Children.Add(knotPoint); dots.Add(knotPoint); } Canvas.Children.Add(BuildEndPoint(UserCurve.Points[4])); endPoint = UserCurve.Points[4]; Loaded += new RoutedEventHandler(SplineTask_Loaded); TouchDown += new EventHandler<TouchEventArgs>(ellipse_TouchDown); TouchMove += new EventHandler<TouchEventArgs>(ellipse_TouchMove); LostTouchCapture += new EventHandler<TouchEventArgs>(ellipse_LostTouchCapture); bConnect.TouchUp += (sender, e) => {tracker.Connect();}; bStart.TouchUp += (sender, e) => { tracker.StartTracking(); }; tracker.GazeDataReceived += new EventHandler<GazeEventArgs>(tracker_GazeDataReceived); Ellipse ellipseRadius = new System.Windows.Shapes.Ellipse() { Width = 2 * radiusSize, Height = 2 * radiusSize, Stroke = Brushes.Black, RenderTransform = new TranslateTransform(8, 1070) }; Canvas.Children.Add(ellipseRadius); }
public Dot BuildControlPoint(Point location, Brush color) { Dot knotPoint = new Dot() { Center = location, Fill = color, Radius = 4 }; return knotPoint; }