public void SetWiiRemoteListener(MIG.Client.Devices.Wii.Remote remote) { //_wiiremote = remote; //_wiiremote.RemoteConnected += new MIG.Client.Devices.Wii.Remote.RemoteConnectedHandler(_wiiremote_RemoteConnected); //_wiiremote.RemoteDisconnected += new MIG.Client.Devices.Wii.Remote.RemoteDisconnectedHandler(_wiiremote_RemoteDisconnected); WiiRemote.SetWiiRemoteListener(remote); }
void _wiiremote_ButtonPressed(object sender, MIG.Client.Devices.Wii.ButtonEventArgs args) { _targetelement.Dispatcher.BeginInvoke(() => { if (_currentelement == null) return; // if (typeof(Touchable).IsAssignableFrom(_currentelement.GetType()) && args.Button == MIG.Client.Devices.Wii.ButtonEventArgs.WiiRemoteButton.A) { ((Touchable)_currentelement).FingerDown(this, new FingerTouchEventArgs(new Finger("WHAND:0", _handtransform.Centroid))); _selectDateTime = DateTime.Now; _selectButtonPressed = true; } }); }
public bool HandUpdate(object sender, MIG.Client.Devices.NiteKinect.KinectHandUpdateEventArgs args) { if (_handdetail.HandId != 0 && args.HandId != _handdetail.HandId || (_handdetail.HandId == 0 && args.State != KinectHandState.Created)) return false; // if (args.State == MIG.Client.Devices.NiteKinect.KinectHandState.Created && _handdetail.HandId == 0) { _handdetail.HandId = args.HandId; _handdetail.EnterLocation = args.Location; _handdetail.CurrentLocation = args.Location; // _depth = args.Location.Z; // if (HandEnter != null) HandEnter(this, new HandEventArgs(_handdetail, new Point(_handdetail.GetRelativeLocation(_offset).X, _handdetail.GetRelativeLocation(_offset).Y))); // return true; } else if (args.State == MIG.Client.Devices.NiteKinect.KinectHandState.Destroyed) { // if (HandExit != null) HandExit(this, new HandEventArgs(_handdetail, new Point(_handdetail.GetRelativeLocation(_offset).X, _handdetail.GetRelativeLocation(_offset).Y))); // //_handdetail.HandId = 0; return true; } // _handdetail.CurrentLocation = args.Location; // if (_handdetail.HandId != 0) { _depth = args.Location.Z; // if (HandMove != null) HandMove(this, new HandEventArgs(_handdetail, new Point(_handdetail.GetRelativeLocation(_offset).X, _handdetail.GetRelativeLocation(_offset).Y))); } // return true; }
public void SetKinectListener(MIG.Client.Devices.NiteKinect.Kinect kinect) { //_kinect = kinect; //_kinect.UserUpdate += new MIG.Client.Devices.NiteKinect.Kinect.UserUpdateHandler(_kinect_UserUpdate); Skelton.SetKinectListener(kinect); }
void _nitekinect_SkeltonUpdate(object sender, MIG.Client.Devices.NiteKinect.KinectSkeltonUpdateEventArgs args) { }
// MAIN UIKIT CONTROLS KINECT INTERACTION LOGIC // //bool _already_adding = false; void _nitekinect_HandUpdate(object sender, MIG.Client.Devices.NiteKinect.KinectHandUpdateEventArgs args) { if (args.State == MIG.Client.Devices.NiteKinect.KinectHandState.GestureClick) { // TODO: .... } else if (args.State == MIG.Client.Devices.NiteKinect.KinectHandState.GestureRaiseHand) { // TODO: .... } if (_hands.ContainsKey("HAND_" + args.HandId) && _hands["HAND_" + args.HandId] != null) { _hands["HAND_" + args.HandId].HandGestures.HandUpdate(this, args); } else { //if (_already_adding) return; //_already_adding = true; _targetelement.Dispatcher.BeginInvoke(() => { HandManager hand = new HandManager(); /* if (_hands.Count > 0 && _hands.Count % 2 != 0) { // left hand hand.HandGestures.SetTargetElement(_targetelement, new Point(_targetsize.Width / 4D, _targetsize.Height / 2)); } else { // right hand hand.HandGestures.SetTargetElement(_targetelement, new Point(_targetsize.Width / 4D * 3D, _targetsize.Height / 2)); }*/ hand.HandGestures.SetTargetElement(_targetelement, new Point(_targetsize.Width / 2D, _targetsize.Height / 2D)); // hand.HandGestures.HandEnter += new HandEnterEventHandler(_handgestures_HandEnter); hand.HandGestures.HandMove += new HandMoveEventHandler(_handgestures_HandMove); hand.HandGestures.HandExit += new HandExitEventHandler(_handgestures_HandExit); hand.HandGestures.GestureRecognized += new GestureRecognizedEventHandler(_handgestures_GestureRecognized); // _hands["HAND_" + args.HandId] = hand; // hand.HandGestures.HandUpdate(this, args); // //_already_adding = false; }); } return; }
void _wiiremote_ButtonReleased(object sender, MIG.Client.Devices.Wii.ButtonEventArgs args) { _targetelement.Dispatcher.BeginInvoke(() => { if (_currentelement == null) return; // lock (this) { if (!_selectButtonPressed && _currentelement.GetType() == typeof(UIKit.ScrollView)) { UIKit.ScrollView sv = (_currentelement as UIKit.ScrollView); //if (!sv.ScrollerTransformHelper.IsRunning) { sv.ScrollerTransformHelper.Delay = 0.5; switch (args.Button) { case MIG.Client.Devices.Wii.ButtonEventArgs.WiiRemoteButton.RIGHT: sv.SimulateGesture(TouchGesture.MOVE_WEST); break; case MIG.Client.Devices.Wii.ButtonEventArgs.WiiRemoteButton.LEFT: sv.SimulateGesture(TouchGesture.MOVE_EAST); break; case MIG.Client.Devices.Wii.ButtonEventArgs.WiiRemoteButton.UP: sv.SimulateGesture(TouchGesture.MOVE_SOUTH); break; case MIG.Client.Devices.Wii.ButtonEventArgs.WiiRemoteButton.DOWN: sv.SimulateGesture(TouchGesture.MOVE_NORTH); break; case MIG.Client.Devices.Wii.ButtonEventArgs.WiiRemoteButton.B: sv.ZoomToFullHeight(); break; } } } else if (typeof(Touchable).IsAssignableFrom(_currentelement.GetType()) && args.Button == MIG.Client.Devices.Wii.ButtonEventArgs.WiiRemoteButton.A) { _overlay.Hand.Circle.Visibility = Visibility.Collapsed; _selectButtonPressed = false; ((Touchable)_currentelement).FingerUp(this, new FingerTouchEventArgs(new Finger("WHAND:0", _handtransform.Centroid))); } } }); }
void _wiiremote_AccelerationUpdate(object sender, MIG.Client.Devices.Wii.WiiAccelerationUpdateEventArgs args) { //throw new NotImplementedException(); }
void _wiiremote_InfraredUpdate(object sender, MIG.Client.Devices.Wii.WiiInfraredUpdateEventArgs args) { if (args.X == 0 && args.Y == 0) return; // _targetelement.Dispatcher.BeginInvoke(() => { _handtransform.Translate = new Point(args.X * (Application.Current.RootVisual.RenderSize.Width / 560), args.Y * (Application.Current.RootVisual.RenderSize.Height / 420)); if (_selectButtonPressed && _currentelement != null && typeof(Touchable).IsAssignableFrom(_currentelement.GetType())) { TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - _selectDateTime.Ticks); if (ts.TotalMilliseconds > 350) { _overlay.Hand.Circle.Visibility = Visibility.Visible; ((Touchable)_currentelement).FingerMove(this, new FingerTouchEventArgs(new Finger("WHAND:0", _handtransform.Centroid))); } } else { UIElement newelement = null; List<UIElement> cls = Utility.Transform2d.GetCollisionsAt(_targetelement, _handtransform.Translate, new Size(_overlay.Hand.RenderSize.Width, _overlay.Hand.RenderSize.Height)); foreach (UIElement uiel in cls) { if (typeof(Touchable).IsAssignableFrom(uiel.GetType())) { newelement = uiel; break; } } // _currentelement = newelement; } }); }
private void kinect_UserUpdate(object sender, MIG.Client.Devices.NiteKinect.KinectUserStateEventArgs args) { this.Dispatcher.BeginInvoke(() => { this.UserState.Text = args.State.ToString(); if (args.Location != null) { this.UserTrack.SetValue(Canvas.LeftProperty, (double)args.Location.X); this.UserTrack.SetValue(Canvas.TopProperty, (double)args.Location.Y); } }); }
void MultiTouchListener_FingerUp(object sender, MIG.Client.Devices.MultiTouch.FingerInputEventArgs e) { _cursordel("TUIO:" + e.Identifier); e.Handled = true; }
void MultiTouchListener_FingerMove(object sender, MIG.Client.Devices.MultiTouch.FingerInputEventArgs e) { Point p = new Point(_targetsize.Width * e.Position.Value.X, _targetsize.Height * e.Position.Value.Y); _cursorupd("TUIO:" + e.Identifier, p); e.Handled = true; }
// MIG MultiTouch TUIO input void MultiTouchListener_AccelerationUpdate(object sender, MIG.Client.Devices.MultiTouch.AccelerationUpdateEventArgs e) { if (AccelerationUpdate != null) AccelerationUpdate(this, new AccelerationUpdateEventArgs(e.X, e.Y, e.Z)); }