public ExpandableView() { _defaultTapGesture = new TapGestureRecognizer { CommandParameter = this, Command = new Command(p => { var view = (p as View).Parent; while (view != null && !(view is Page)) { if (view is ExpandableView ancestorExpandable) { ancestorExpandable.SecondaryView.HeightRequest = -1; } view = view.Parent; } Command?.Execute(CommandParameter); Tapped?.Invoke(); if (!IsTouchToExpandEnabled) { return; } IsExpanded = !IsExpanded; }) }; ForceUpdateSizeCommand = new Command(ForceUpdateSize); }
void OnTappedEvent(object sender, TappedRoutedEventArgs e) { if (e.Handled == false) { Tapped?.Invoke(this, e); } }
public EventItemViewModel(Avatar avatar, string eventType, string createdOn) { Avatar = avatar; EventType = eventType; CreatedOn = createdOn; GoToCommand.Subscribe(_ => Tapped?.Invoke()); }
private void OnReleased(PointerInput input, double time) { if (!activeGestures.TryGetValue(input.InputId, out var existingGesture)) { // Probably caught by UI, or the input was otherwise lost return; } activeGestures.Remove(input.InputId); existingGesture.SubmitPoint(input.Position, time); if (IsValidSwipe(ref existingGesture)) { var swipeInput = new SwipeInput(existingGesture); Swiped?.Invoke(swipeInput); onSwiped?.Invoke(swipeInput); } if (IsValidTap(ref existingGesture)) { var tapInput = new TapInput(existingGesture); Tapped?.Invoke(tapInput); onTapped?.Invoke(tapInput); } #if UNITY_EDITOR DebugInfo(existingGesture); #endif }
public void OnTapped() { if (Tapped != null) { Tapped.Invoke(this, null); } }
private void OnReleased(PointerInput input, double time) { if (!activeGestures.TryGetValue(input.InputId, out var existingGesture)) { // Probably caught by UI, or the input was otherwise lost return; } activeGestures.Remove(input.InputId); existingGesture.SubmitPoint(input.Position, time); var swipeOrTap = false; if (IsValidSwipe(ref existingGesture)) { Swiped?.Invoke(new SwipeInput(existingGesture)); swipeOrTap = true; } if (IsValidTap(ref existingGesture)) { Tapped?.Invoke(new TapInput(existingGesture)); swipeOrTap = true; } if (!swipeOrTap) { DragFinished?.Invoke(new DragInput(existingGesture)); } DebugInfo(existingGesture); }
protected virtual void TapGestureRecognizer_Tapped(object sender, EventArgs e) { var args = new ArtistEventArgs { Artist = Artist }; Tapped?.Invoke(this, args); }
private void TapGestureRecognizer_Tapped(object sender, EventArgs e) { var args = new SongEventArgs { Song = Song }; Tapped?.Invoke(this, args); }
/// <summary> /// Invoke the tapped event. /// </summary> /// <param name="sender">The sender.</param> internal void InvokeTapped(View sender) { Tapped?.Invoke(sender, new TapEventArgs(NumberOfTouchesRequired, NumberOfTapsRequired)); if (Command is ICommand cmd && cmd.CanExecute(CommandParameter)) { cmd.Execute(CommandParameter); } }
//A method that will be ran when the ContentView is clicked and will call the command defined in the property OnClick and/or the event Clicked private void TapAction() { if (Command != null) { Command.Execute(CommandParameter); } Tapped?.Invoke(this, EventArgs.Empty); }
protected virtual void OnTapped(UITouch touch) { var devicePoint = previewLayer.CaptureDevicePointOfInterestForPoint(touch.LocationInView(this)); //FocusWithMode(AVCaptureFocusMode.AutoFocus, AVCaptureExposureMode.AutoExpose, devicePoint, true); Console.WriteLine("Tapped {0}", devicePoint); Tapped?.Invoke(this, new EventArgs()); }
public void SetGame(GameDefinition game) { if (GameDefinition == null) { CellButton.TouchUpInside += (sender, e) => Tapped?.Invoke(this, new EventArgs()); } GameDefinition = game; CellButton.SetTitle(game.DisplayIndex.ToString(), UIControlState.Normal); }
/// <summary> /// Invoked when the given element has been selected by the user. /// </summary> /// <param name="dvc"> /// The <see cref="DialogViewController"/> where the selection took place /// </param> /// <param name="tableView"> /// The <see cref="UITableView"/> that contains the element. /// </param> /// <param name="path"> /// The <see cref="NSIndexPath"/> that contains the Section and Row for the element. /// </param> public virtual void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { Tapped?.Invoke(); SelectedCommand?.Execute(null); if (ShouldDeselectAfterTouch) { tableView.DeselectRow(path, true); } }
private void ClickGesture_Tapped(object sender, EventArgs e) { Tapped?.Invoke(this, e); if (TappedCommand != null && TappedCommand.CanExecute(CommandParameter)) { TappedCommand?.Execute(CommandParameter); } }
public override void EndTracking(UITouch uitouch, UIEvent uievent) { if (pressed && Enabled) { Tapped?.Invoke(this); } pressed = false; SetNeedsDisplay(); base.EndTracking(uitouch, uievent); }
public CustomGradientButton() { // Enable touch events (allows for custom filtering) EnableTouchEvents = true; // Custom tap event, instead of gestures TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (sender, e) => Tapped?.Invoke(sender, e); GestureRecognizers.Add(tapGestureRecognizer); }
public LifeCell() { BackgroundColor = Color.White; TapGestureRecognizer tapGesture = new TapGestureRecognizer(); tapGesture.Tapped += (sender, args) => { Tapped?.Invoke(this, EventArgs.Empty); }; GestureRecognizers.Add(tapGesture); }
public UpdateCell() { BackgroundColor = Color.White; TapGestureRecognizer tapGesture = new TapGestureRecognizer(); tapGesture.Tapped += (sender, args) => { this.isAlive = true; Tapped?.Invoke(this.BackgroundColor = Color.Black, EventArgs.Empty); }; GestureRecognizers.Add(tapGesture); }
private void OnTap(LeanFinger finger) { var screenPos = finger.ScreenPosition; var worldPos = finger.GetWorldPosition(10, Camera.current); Utils.LogConditional($"{nameof(InputManager)} + tap " + $"| {nameof(screenPos)} = {screenPos} " + $"| {nameof(worldPos)} = {worldPos}"); if (Physics2D.OverlapPoint(worldPos, _selectableLayer.AsMask)) { Tapped?.Invoke(worldPos); } }
private void Handle_ItemTapped(object sender, ItemTappedEventArgs e) { if (sender == null) { return; } Tapped?.Invoke(this, e); if (ItemSelectedCommand != null && ItemSelectedCommand.CanExecute(e.Item)) { ItemSelectedCommand?.Execute(e.Item); } }
public ExpandableView() { _defaultTapGesture = new TapGestureRecognizer { Command = new Command(() => { Command?.Execute(null); Tapped?.Invoke(); if (!IsTouchToExpandEnabled) { return; } IsExpanded = !IsExpanded; }) }; }
public ExpandableView() { _defaultTapGesture = new TapGestureRecognizer { Command = new Command(() => { Command?.Execute(CommandParameter); Tapped?.Invoke(); if (!IsTouchToExpandEnabled) { return; } IsExpanded = !IsExpanded; }) }; ForceUpdateSizeCommand = new Command(ForceUpdateSize); }
protected void OnButtonTapped(object sender, EventArgs args) { object resolvedParameter; if (CommandParameter != null) { resolvedParameter = CommandParameter; } else { resolvedParameter = args; } if (Command?.CanExecute(resolvedParameter) ?? true) { Tapped?.Invoke(this, args); Command?.Execute(resolvedParameter); } }
private void OnReleasedFirst(PointerInput input, double time) { if (!activeGestures.TryGetValue(input.InputId, out var existingGesture)) { // Probably caught by UI, or the input was otherwise lost return; } activeGestures.Remove(input.InputId); existingGesture.SubmitPoint(input.Position, time); if (IsValidSwipe(ref existingGesture)) { Swiped?.Invoke(new SwipeInput(existingGesture)); } if (IsValidTap(ref existingGesture)) { Tapped?.Invoke(new TapInput(existingGesture)); } if (_pinching) { _pinching = false; var pinchDistance = Vector2.Distance(_posLastFirst, _posLastSecond); PinchFinished?.Invoke(new PinchInput() { InputId = input.InputId, PinchDistance = pinchDistance, PinchDeltaDistance = pinchDistance - _pinchLastDistance, Pointer0CurrentPosition = _posLastFirst, Pointer0StartPosition = _pinchPosStartFirst, Pointer1CurrentPosition = _posLastSecond, Pointer1StartPosition = _pinchPosStartSecond }); } DebugInfo(existingGesture); }
protected override bool OnSingleTap(MotionEvent e) { try { var pointer = e.GetPointer(0); var args = new TappedRoutedEventArgs(new Point(e.GetX(), e.GetY())) { OriginalSource = this, PointerDeviceType = pointer.PointerDeviceType }; Tapped?.Invoke(Target, args); return(args.Handled); } catch (Exception ex) { Windows.UI.Xaml.Application.Current.RaiseRecoverableUnhandledExceptionOrLog(ex, this); return(false); } }
public CustomImageButton(Color text_SelectedColor, Color text_UnselectedColor) { // Save the color options Text_SelectedColor = text_SelectedColor; Text_UnselectedColor = text_UnselectedColor; // Create the controls InitializeComponent(); // Update the text color if (Label != null) { Label.TextColor = IsSelected ? Text_SelectedColor : Text_UnselectedColor; } // Custom tap event, instead of gestures TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (sender, e) => Tapped?.Invoke(sender, e); GestureRecognizers.Add(tapGestureRecognizer); }
/// <summary> /// Eventverarbeitung wenn ein Ankreuzfeld in Spielfarbe getapped wurde /// </summary> /// <param name="sender">View der getapped wurde</param> /// <param name="e"></param> async void OnTileTappedAsync(object sender, EventArgs args) { if (isBusy) { return; } isBusy = true; //Ermitteln welches TileAnkreuzFeldSpielfarbe zum getappeden View gehört View tileView = (View)sender; TileAnkreuzFeldSpielfarbe tappedTile = TileAnkreuzFeldSpielfarbe.Dictionary[tileView]; //Für User-Feedback Animation starten: Scale ContentView out and in await tappedTile.TileContentView.ScaleTo(1.5, 250, Easing.SinOut); await tappedTile.TileContentView.ScaleTo(1, 250, Easing.SinIn); Tapped?.Invoke(tappedTile.Spielfarbe, tappedTile.Augenzahl); isBusy = false; }
public SvgImage() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); CheckAndAddAssemblyResources(executingAssembly); Assembly entryAssembly = Assembly.GetEntryAssembly(); CheckAndAddAssemblyResources(entryAssembly); if (Device.RuntimePlatform != Device.UWP) { // Calling Assembly.GetCallingAssembly on UWP (Release config) will throw Operation not supported exception, so don't call it for UWP. Assembly callingAssembly = Assembly.GetCallingAssembly(); CheckAndAddAssemblyResources(callingAssembly); } PropertyChanged += SvgImage_PropertyChanged; Aspect = Aspect.AspectFit; // Custom tap event, instead of gestures _tapGestureRecognizer.Tapped += (sender, e) => Tapped?.Invoke(sender, e); GestureRecognizers.Add(_tapGestureRecognizer); }
protected internal virtual void OnTapped() => Tapped?.Invoke(this, EventArgs.Empty);
private void SpringboardButtonTapped(object sender, EventArgs args) { Tapped?.Invoke(sender, args); }