private void WiiLed4_Tapped(object sender, FingerTouchEventArgs e) { bool inversestatus = (WiiLed4.Tag.ToString() == "1" ? false : true); try { wiiremote.SetLed(3, inversestatus); WiiLed4.Tag = (inversestatus ? "1" : "0"); WiiLed4.Fill = new SolidColorBrush(inversestatus ? Color.FromArgb(255, 0x33, 0x33, 0xFF) : Color.FromArgb(255, 0x00, 0x00, 0x44)); } catch (Exception ex) { } }
private void BehaviorExample_Tapped(object sender, FingerTouchEventArgs e) { ButtonTappedSound.Stop(); ButtonTappedSound.Play(); //if (BehaviorRect.Visibility == Visibility.Visible) //{ // BehaviorRect.Visibility = Visibility.Collapsed; //} //else //{ // BehaviorRect.Visibility = Visibility.Visible; //} }
////////////////////////////////////////////////////////////////// private void SwitchRumble_Tapped(object sender, FingerTouchEventArgs e) { bool inversestatus = (SwitchRumble.Tag.ToString() == "1" ? false : true); try { wiiremote.SetRumble(inversestatus); SwitchRumble.Tag = (inversestatus ? "1" : "0"); } catch (Exception ex) { } }
void MultiScaleImage_FingerAdd(object sender, FingerTouchEventArgs e) { if (GesturesInterpreter.Fingers.Count == 0) { _lastlocation = _msi.ElementToLogicalPoint(e.Finger.Position); } }
public void FingerMove(object sender, FingerTouchEventArgs e) { if (!_scrollbarhpressed && !_scrollbarvpressed) { _gesturesinterpreter.FingerUpdate(e.Finger.Identifier, e.Finger.Position); } if (e.Finger.Identifier != _mytouchid || _gesturesinterpreter.Fingers.Count > 1) return; // _scrollertransformhelper.Delay = 0.25; double vxf = this.ActualWidth / _scrollerpanel.ActualWidth; double vyf = this.ActualHeight / _scrollerpanel.ActualHeight; if (_scrollbarhpressed) { _scrollertransformhelper.Translate = new Point(_starttranslate.X - ((e.Finger.Position.X - _dragstart.X) / vxf) , _starttranslate.Y); } else if (_scrollbarvpressed) { _scrollertransformhelper.Translate = new Point(_starttranslate.X, _starttranslate.Y - ((e.Finger.Position.Y - _dragstart.Y) / vyf)); } else { switch (_direction) { case ScrollDirection.Vertical: _scrollertransformhelper.Translate = new Point(_starttranslate.X, _starttranslate.Y + (e.Finger.Position.Y - _dragstart.Y)); break; case ScrollDirection.Horizontal: _scrollertransformhelper.Translate = new Point(_starttranslate.X + (e.Finger.Position.X - _dragstart.X), (e.Finger.Position.Y - _dragstart.Y)); break; case ScrollDirection.Both: if (_gesturesinterpreter.CurrentGesture == TouchGesture.MOVE_EAST || _gesturesinterpreter.CurrentGesture == TouchGesture.MOVE_WEST)// _scrollerpanel.ActualHeight <= this.Height) { _scrollertransformhelper.Translate = new Point(_starttranslate.X + (e.Finger.Position.X - _dragstart.X), _scrollertransformhelper.Translate.Y); } else if (_gesturesinterpreter.CurrentGesture == TouchGesture.MOVE_NORTH || _gesturesinterpreter.CurrentGesture == TouchGesture.MOVE_SOUTH) //_scrollerpanel.ActualWidth <= this.Width) { _scrollertransformhelper.Translate = new Point(_scrollertransformhelper.Translate.X, _starttranslate.Y + (e.Finger.Position.Y - _dragstart.Y)); } //else // { // _scrollertransformhelper.Translate = new Point(_starttranslate.X + (e.Finger.Position.X - _dragstart.X), _starttranslate.Y + (e.Finger.Position.Y - _dragstart.Y)); //} break; } } // _scrollbarsupdate(); // e.Handled = true; }
public void FingerUp(object sender, FingerTouchEventArgs e) { if (_myfinger != null && _myfinger.Identifier != e.Finger.Identifier) return; // if (double.IsInfinity(_dragradius)) if (!DisableAnimation) { _transformhelper.Delay = 0.50; _transformhelper.Scale = _startscale; } this.SetValue(Canvas.ZIndexProperty, _myzindex); // if (Tapped != null && _enabled && _myfinger != null && Utility.Vector2D.Distance(_myfinger.StartPosition, _myfinger.Position) < 10) { sfx.Play(); Tapped(this, new FingerTouchEventArgs(_myfinger.Clone())); } _pressed = false; if (Drop != null && _enabled) Drop(this, new FingerTouchEventArgs( _myfinger.Clone() )); _myfinger = null; // if (Drop == null || !_draglimitreached) { _transformhelper.Translate = _homelocation; } _transformhelper.Delay = 0.0; }
public void FingerMove(object sender, FingerTouchEventArgs e) { int fc = _gesturesinterpreter.Fingers.Count; _gesturesinterpreter.FingerUpdate(e.Finger.Identifier, e.Finger.Position); if (FingerUpdated != null) FingerUpdated(this, e); }
private void MiriaHome_Tapped(object sender, FingerTouchEventArgs e) { ButtonTappedSound.Stop(); ButtonTappedSound.Play(); HtmlPage.Window.Navigate(new Uri("http://miria.codeplex.com/"), "_blank"); }
private void ScaleImage_Tapped(object sender, FingerTouchEventArgs e) { ButtonTappedSound.Stop(); ButtonTappedSound.Play(); //_hideapplications(); MultiScaleDemo.Visibility = Visibility.Visible; _fadetoapplication(); }
void LeggimiButtonClose_Tapped(object sender, FingerTouchEventArgs e) { ButtonTappedSound.Stop(); ButtonTappedSound.Play(); // Leggimi.Visibility = Visibility.Collapsed; ButtonMenuNext.Visibility = System.Windows.Visibility.Visible; Animator.AnimateProperty(MainMenu, "Opacity", 0.25, 1.0, 0.5, null); }
private void Maps_Tapped(object sender, FingerTouchEventArgs e) { //_hideapplications(); ButtonTappedSound.Stop(); ButtonTappedSound.Play(); VirtualEarth.Visibility = Visibility.Visible; _fadetoapplication(); }
private void Gallery_Tapped(object sender, FingerTouchEventArgs e) { ButtonTappedSound.Stop(); ButtonTappedSound.Play(); //_hideapplications(); // OpenImage.Visibility = Visibility.Visible; Gallery.Visibility = Visibility.Visible; _fadetoapplication(); // Gallery.PhotoList.ZoomToElementHeight(Gallery.SectionA); }
private void Contacts_Tapped(object sender, FingerTouchEventArgs e) { ButtonTappedSound.Stop(); ButtonTappedSound.Play(); //_hideapplications(); ButtonMenuNext.Visibility = System.Windows.Visibility.Collapsed; ContactsAndLinks.Opacity = 0.0; ContactsAndLinks.Visibility = Visibility.Visible; Animator.AnimateProperty(ContactsAndLinks, "Opacity", 0.0, 1.0, 0.5, null); Animator.AnimateProperty(MainMenu, "Opacity", 1.0, 0.25, 0.5, null); //_fadetoapplication(); }
private void ButtonMenuPrevious_Tapped(object sender, FingerTouchEventArgs e) { if (_devmenutrhelper.IsRunning) return; // _devmenutrhelper.Delay = 1.75; _devmenutrhelper.Translate = new Point(this.ActualWidth + ((this.ActualWidth - DevicesMenu.ActualWidth) / 2), 0); Animator.AnimateProperty(DevicesMenu, "(UIElement.Projection).(PlaneProjection.RotationY)", 0D, 65D, 0.75, null); // _appmenutrhelper.Delay = 1.5; _appmenutrhelper.Translate = new Point(); Animator.AnimateProperty(MainMenu, "(UIElement.Projection).(PlaneProjection.RotationY)", -65D, 0D, 0.75, null); // ButtonMenuNext.Visibility = System.Windows.Visibility.Visible; ButtonMenuPrevious.Visibility = System.Windows.Visibility.Collapsed; }
public void FingerDown(object sender, FingerTouchEventArgs e) { if (_myfinger != null) return; _starttranslate = _transformhelper.Translate; _dragstart = e.Finger.Position; _draglimitreached = false; _startscale = _transformhelper.Scale; _myzindex = (int)this.GetValue(Canvas.ZIndexProperty); // _transformhelper.Delay = 0.25; // if (!DisableAnimation) { if (double.IsInfinity(_dragradius)) { _transformhelper.Scale = _startscale + .10; } else { _transformhelper.Scale = _startscale - .05; } } this.SetValue(Canvas.ZIndexProperty, 100); // _myfinger = new Finger(e.Finger.Identifier, e.Finger.Position); pz = this.TransformToVisual(this.Parent as UIElement).Transform(new Point()); _pressed = true; if (Pressed != null && _enabled) Pressed(this, new FingerTouchEventArgs( _myfinger.Clone() )); }
private void WiiRemoteDemo_Tapped(object sender, FingerTouchEventArgs e) { ButtonTappedSound.Stop(); ButtonTappedSound.Play(); //_hideapplications(); WiiRemote.Visibility = Visibility.Visible; _fadetoapplication(); }
public void FingerMove(object sender, FingerTouchEventArgs e) { if (_myfinger == null || (_myfinger != null && _myfinger.Identifier != e.Finger.Identifier)) return; _myfinger.Position = e.Finger.Position; if (_pressed) { if (_isdragenabled) { Point l = new Point(_starttranslate.X + (e.Finger.Position.X - _dragstart.X), _starttranslate.Y + (e.Finger.Position.Y - _dragstart.Y)); //l.X += Utility.Transform2d.AdjustToParent(this, _myfinger.Shift).X; //l.Y += Utility.Transform2d.AdjustToParent(this, _myfinger.Shift).Y; // if (_dragvalues == TButtonDragValues.Positive && l.X < 0) { l.X = 0; } else if (_dragvalues == TButtonDragValues.Negative && l.X > 0) { l.X = 0; } if (_dragvalues == TButtonDragValues.Positive && l.Y < 0) { l.Y = 0; } else if (_dragvalues == TButtonDragValues.Negative && l.Y > 0) { l.Y = 0; } // if (!_draglimitreached) { if (Math.Abs(l.X) > _dragradius) { l.X = _dragradius * Math.Sign(l.X); _draglimitreached = true; } if (Math.Abs(l.Y) > _dragradius) { l.Y = _dragradius * Math.Sign(l.Y); _draglimitreached = true; } // if (_draglimitreached && DragLimitReached != null) { DragLimitReached(this, new DragLimitReachedEventArgs(l)); //FingerUp(this, new FingerTouchEventArgs(_myfinger)); } } // if (_dragdirection == TButtonDragDirection.Horizontal) { l.Y = 0; } else if (_dragdirection == TButtonDragDirection.Vertical) { l.X = 0; } // //if (!DisableAnimation) { _transformhelper.Translate = l; } // if (Drag != null && _enabled) Drag(this, new FingerTouchEventArgs(_myfinger.Clone())); // IEnumerable<UIElement> hits = VisualTreeHelper.FindElementsInHostCoordinates(e.Finger.Position, Application.Current.RootVisual); foreach (FrameworkElement uiel in hits) { bool tbutton = uiel is TButton && !uiel.Equals(this); if (uiel != null && tbutton && !((uiel as TButton).TransformHelper.IsRunning) && uiel.Parent.Equals(this.Parent)) { Point pp = (uiel as TButton).HomeLocation; (uiel as TButton).HomeLocation = this.HomeLocation; this.HomeLocation = pp; break; } } } } }
private void _updatechildren(string id, Point p) { if (_auraenabled) { if (_fingersaura.ContainsKey(id)) { _fingersaura[id].SetValue(Canvas.LeftProperty, p.X - (_fingersaura[id].Width / 2)); _fingersaura[id].SetValue(Canvas.TopProperty, p.Y - (_fingersaura[id].Height / 2)); } else { FingerAura aura = new FingerAura(); aura.SetValue(Canvas.LeftProperty, p.X - (aura.Width / 2)); aura.SetValue(Canvas.TopProperty, p.Y - (aura.Height / 2)); _fingersaura.Add(id, aura); _infolayer.Children.Add(aura); } } if (!_propagateinput) return; // controlliamo collisioni if (!hookShape.ContainsKey(id)) { try { IEnumerable<UIElement> hits = VisualTreeHelper.FindElementsInHostCoordinates(_targetelement.TransformToVisual(Application.Current.RootVisual).Transform(p), Application.Current.RootVisual); foreach (UIElement uiel in hits) { // COLLISIONE INTERCETTATA ... =)"; if (typeof(Touchable).IsAssignableFrom(uiel.GetType())) { hookShape.Add(id, uiel); FingerTouchEventArgs e = new FingerTouchEventArgs(new Finger(id, p)); ((Touchable)uiel).FingerDown(this, e); //myUIElement.TransformToVisual(uiel).Transform(p)); if (e.Handled) break; } } } catch (Exception ex) { } } else { try { if (typeof(Touchable).IsAssignableFrom(hookShape[id].GetType())) ((Touchable)hookShape[id]).FingerMove(this, new FingerTouchEventArgs(new Finger(id, p))); //myUIElement.TransformToVisual(hookShape[id]).Transform(p)); } catch (Exception ex) { } } }
public void FingerDown(object sender, FingerTouchEventArgs e) { //_gesturesinterpreter.FingerUpdate(hid, p); if (FingerAdded != null) FingerAdded(this, e); }
void _backgroundcanvas_FingerAdd(object sender, FingerTouchEventArgs e) { if (_mytouchid == "") { _mytouchid = e.Finger.Identifier; _startdragx = e.Finger.Position.X; } _gesturesinterpreter.FingerUpdate(e.Finger.Identifier, e.Finger.Position); }
public void FingerUp(object sender, FingerTouchEventArgs e) { if (FingerRemoved != null) FingerRemoved(this, e); _gesturesinterpreter.FingerRemove(e.Finger.Identifier); }
void _backgroundcanvas_FingerRemove(object sender, FingerTouchEventArgs e) { _dragenable = false; _openeventfired = false; _gesturesinterpreter.FingerRemove(e.Finger.Identifier); if (_currentcanvas != null) { _currentcanvas.SetValue(TCanvas.ZIndexProperty, 1); _currentcanvas.TransformHelper.Delay = 0.5; _currentcanvas.TransformHelper.Scale = 1.0; _currentcanvas.TransformHelper.Delay = 0.0; } _currentcanvas = null; if (e.Finger.Identifier != _mytouchid) return; _mytouchid = ""; _dragenable = false; }
// Touchable interface events (these are fired by TouchListener over any touchable element) public void FingerDown(object sender, FingerTouchEventArgs e) { IEnumerable<UIElement> hitsh = VisualTreeHelper.FindElementsInHostCoordinates(e.Finger.Position, this); if (_gesturesinterpreter.Fingers.Count == 0 && hitsh.Count() > 0) { _firsttouchedelement = hitsh.ElementAt(0); } foreach (FrameworkElement uiel in hitsh) { if (uiel != null) { double vxf = this.ActualWidth / _scrollerpanel.ActualWidth; double vyf = this.ActualHeight / _scrollerpanel.ActualHeight; if (uiel.Equals(_scrollbarh) && uiel.Visibility == Visibility.Visible) { _scrollbarhpressed = true; break; } else if (uiel.Equals(_scrollbarv) && uiel.Visibility == Visibility.Visible) { _scrollbarvpressed = true; break; } } } // _scrollbarv.Opacity = 0.25; _scrollbarh.Opacity = 0.25; // if (_scrollertransformhelper.IsRunning) { _scrollertransformhelper.Stop(); } // double delay = _scrollertransformhelper.Delay; _scrollertransformhelper.Delay = 0; _gesturesinterpreter.FingerUpdate(e.Finger.Identifier, e.Finger.Position); _scrollertransformhelper.Delay = delay; // if (_gesturesinterpreter.Fingers.Count == 1) { _mytouchid = e.Finger.Identifier; _starttranslate = _scrollertransformhelper.Translate; _dragstart = e.Finger.Position; } // // _justtapped = false; e.Handled = true; }
void _backgroundcanvas_FingerUpdate(object sender, FingerTouchEventArgs e) { _gesturesinterpreter.FingerUpdate(e.Finger.Identifier, e.Finger.Position); _dragenable = false; try { Finger finger = _gesturesinterpreter.Fingers.First<Finger>(el => el.Identifier == _mytouchid); double draglen = MIRIA.Utility.Vector2D.Distance(finger.StartPosition, finger.Position); if (draglen > 50) _dragenable = true; } catch (Exception ex) { } if (e.Finger.Identifier != _mytouchid || _gesturesinterpreter.Fingers.Count > 1 || !_dragenable) return; double dx = e.Finger.Position.X - _startdragx; if (Math.Abs(dx) > _maxdraglenght) dx = _maxdraglenght * Math.Sign(dx); _currentangle = (45 / _maxdraglenght) * dx; _currentshift = dx; }
public void FingerUp(object sender, FingerTouchEventArgs e) { // if (e.Finger.Identifier != _mytouchid) // { // _gesturesinterpreter.FingerRemove(e.Finger.Identifier); // return; // } if (e.Finger.Identifier == _mytouchid) { _mytouchid = ""; } // it has to be read before gessture interpreter remove the last finger // otherwise it is going to be set to NONE TouchGesture lastgesture = _gesturesinterpreter.CurrentGesture; Finger lastfinger = _gesturesinterpreter.Fingers.First<Finger>(delegate(Finger f) { return f.Identifier == e.Finger.Identifier; }); // _gesturesinterpreter.FingerRemove(e.Finger.Identifier); // if (_gesturesinterpreter.Fingers.Count == 0 && !_justtapped) { if (!_gesturescale && !(_scrollbarhpressed || _scrollbarvpressed)) { double speed = Utility.Vector2D.Distance(new Point(0, 0), new Point(_gesturesinterpreter.Acceleration.X / 100, _gesturesinterpreter.Acceleration.Y / 100)); // Animator.AnimatePropertyStop(_scrollbarv, "Opacity"); // Animator.AnimatePropertyStop(_scrollbarh, "Opacity"); // _scrollbarv.Opacity = 0.0; // _scrollbarh.Opacity = 0.0; Point t = new Point(); FrameworkElement uiel = GetElementInView(); if (speed <= 8 && lastfinger.PathLength > 20 && lastfinger.PathLength < 150) { _scrollertransformhelper.Delay = 0.75; // *speed; bool hooked = false; if (uiel != null && _elementfitview(uiel)) { Point pc = this.TransformToVisual(Application.Current.RootVisual).Transform(new Point(this.ActualWidth / 2, this.ActualHeight / 2)); uiel = _elementatlocation(pc); _translate(new Point()); hooked = (_elementhook(uiel, lastgesture) != null); if (hooked) return; } if (!hooked) { Point p1 = this.TransformToVisual(_scrollerpanel).Transform(new Point()); Point p2 = this.TransformToVisual(_scrollerpanel).Transform(new Point(this.ActualWidth, this.ActualHeight)); double szx = p2.X - p1.X; double szy = p2.Y - p1.Y; if (lastgesture == TouchGesture.MOVE_NORTH || lastgesture == TouchGesture.MOVE_NORTHEAST || lastgesture == TouchGesture.MOVE_NORTHWEST) { t.Y = -szy + ((-lastfinger.Position.Y + lastfinger.StartPosition.Y) / _scrollertransformhelper.ScaleY); } if (lastgesture == TouchGesture.MOVE_SOUTH || lastgesture == TouchGesture.MOVE_SOUTHEAST || lastgesture == TouchGesture.MOVE_SOUTHWEST) { t.Y = szy + ((-lastfinger.Position.Y + lastfinger.StartPosition.Y) / _scrollertransformhelper.ScaleY); } if (lastgesture == TouchGesture.MOVE_EAST || lastgesture == TouchGesture.MOVE_NORTHEAST || lastgesture == TouchGesture.MOVE_SOUTHEAST) { t.X = szx + ((-lastfinger.Position.X + lastfinger.StartPosition.X) / _scrollertransformhelper.ScaleX); } if (lastgesture == TouchGesture.MOVE_WEST || lastgesture == TouchGesture.MOVE_NORTHWEST || lastgesture == TouchGesture.MOVE_SOUTHWEST) { t.X = -szx + ((-lastfinger.Position.X + lastfinger.StartPosition.X) / _scrollertransformhelper.ScaleX); } } } else { if (speed > 20) speed = 20; _scrollertransformhelper.Delay = 0.50 * speed; // t = new Point(_gesturesinterpreter.Acceleration.X / 100, _gesturesinterpreter.Acceleration.Y / 100); // _gesturesinterpreter.Acceleration; t.X *= (_scrollertransformhelper.Delay * speed * 2); //(speed < 12 ? 3 : 1.2)); t.Y *= (_scrollertransformhelper.Delay * speed * 2); //(speed < 12 ? 3 : 1.2)); // t.X /= _scrollertransformhelper.ScaleX; t.Y /= _scrollertransformhelper.ScaleY; } // _translate(t); } else { _translate(new Point()); } // _scrollbarhpressed = false; _scrollbarvpressed = false; } _justtapped = false; // e.Handled = true; }
void ApplicationButtonClose_Tapped(object sender, FingerTouchEventArgs e) { ButtonTappedSound.Stop(); ButtonTappedSound.Play(); // _hideapplications(); }