public VideoWindow(GestureDirection direction, GestureType type) { InitializeComponent(); this.Title = type + " " + direction; vlc = new AxVLCPlugin2(); formHost.Child = vlc; vlc.CreateControl(); var videoPath = CreateUriTo(type, direction); MoveScreen(true); GestureParser.Pause(true); vlc.playlist.add(videoPath); vlc.playlist.play(); EventHandler handler = null; handler = (sender, e) => { vlc.MediaPlayerEndReached -= handler; GestureParser.Pause(false); MoveScreen(false); canvasWindow.Activate(); vlc.playlist.play(); vlc.MediaPlayerEndReached += (senderI, eI) => { vlc.playlist.play(); }; }; vlc.MediaPlayerEndReached += handler; }
private void Da_Completed(object sender, EventArgs e, Cell cell) { GestureParser.Pause(false); if (target == null) { return; } Cell t = target; if (nextTarget == null) { runningTest = false; } target = null; t.GridCell.Fill = Brushes.White; targetColor = accuracyTest ? Brushes.White : Brushes.DarkGray; canvas.Children.Remove(cell.Shape); cell.Shape = null; }
public void PointAt(double xFromMid, double yFromMid) { if (pointerFigure == null) { pointerFigure = ShapeFactory.CreatePointer(accuracyTest); canvas.Children.Add(pointerFigure); Canvas.SetZIndex(pointerFigure, 10000); xPoint = xFromMid; yPoint = yFromMid; } if (target != null) { target.GridCell.Fill = targetColor; } if (extraTarget != null) { extraTarget.GridCell.Fill = targetColor; } DrawNextTargets(); if (AttemptRepository.SaveStatus == DatabaseSaveStatus.Saving && !savingToDB) { savingToDB = true; ShowStatusMessage("Saving to database..."); } if (savingToDB && AttemptRepository.SaveStatus != DatabaseSaveStatus.Saving) { savingToDB = false; string status = AttemptRepository.SaveStatus == DatabaseSaveStatus.Failed ? "Failed!" : "Success!"; ShowStatusMessage(status); Background = AttemptRepository.SaveStatus == DatabaseSaveStatus.Failed ? Brushes.Red : Brushes.Blue; } Point currentGyroPoint = new Point(GyroPositionX, -GyroPositionY); if (currentGyroPoint != lastGyroPoint) { lastGyroPoint = new Point(GyroPositionX, -GyroPositionY); } xPoint = xFromMid; yPoint = yFromMid; if (!lockedPointer) { pointer = GetPoint(xPoint, yPoint); } MoveShape(pointerFigure, pointer); if (!accuracyTest) { ColorCell(pointer); } KinectGesture gesture = GestureParser.AwaitingGesture; if (runningTest && runningGesture) { if (gesture != null) { UnlockPointer(); GestureParser.Pause(true); Cell currCell = GetCell(pointer); bool hit = currCell == target; bool correctShape = true; string shape = target.Shape is Ellipse ? "circle" : "square"; GestureDirection direction = GestureParser.GetDirectionContext(); GestureType type = GestureParser.GetTypeContext(); if (direction == GestureDirection.Push) { correctShape = shape == gesture.Shape; } currentTest.TargetHit(hit, correctShape, target, pointer, currCell, currentLength); if (hit && !correctShape) { hit = false; } TargetHit(target, hit); } } ExtendedDraw(gesture); }