Пример #1
0
 public EventItemViewModel(Avatar avatar, string eventType, string createdOn)
 {
     Avatar    = avatar;
     EventType = eventType;
     CreatedOn = createdOn;
     GoToCommand.Subscribe(_ => Tapped?.Invoke());
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
 void OnTappedEvent(object sender, TappedRoutedEventArgs e)
 {
     if (e.Handled == false)
     {
         Tapped?.Invoke(this, e);
     }
 }
Пример #5
0
            public override async Task OnInitializing()
            {
                await base.OnInitializing();

                Text = "Back";
                Tapped.Handle(() => buttonTapped.Raise());
            }
Пример #6
0
        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
        }
Пример #7
0
 public void OnTapped()
 {
     if (Tapped != null)
     {
         Tapped.Invoke(this, null);
     }
 }
Пример #8
0
            async Task InitializeComponents()
            {
                AutoFlash = true;

                Tapped.Handle(ViewButtonTapped);

                await Add(PhotoImage = new ImageView { Id = "PhotoImage", CssClass = "icon", Path = Item.Photo.Path }
                          .Set(x => x.Style.Visible = (Module.ShowPhotoColumn && Item.Photo.HasValue()))
                          .Set(x => x.Style.Ignored = !(Module.ShowPhotoColumn)));

                await Add(NameColumn = new Stack { Id = "NameColumn" });

                await NameColumn.Add(Name = new TextView { Id = "Name", CssClass = "title", Text = Item.Name });

                await NameColumn.Add(ContactDetails = new TextView
                {
                    Id   = "ContactDetails",
                    Text = (new[] { Item.Email, Item.Tel }.Trim().ToString(", "))
                }
                                     );

                await Add(ViewButton = new ImageView
                {
                    Id        = "ViewButton",
                    CssClass  = "view-row",
                    Path      = "Images/Icons/Arrow-Right.png",
                    AutoFlash = true
                }

                          .On(x => x.Tapped, ViewButtonTapped));

                await SlideIn.Add(DeleteButton = new Button { Id = "DeleteButton", Text = "Delete", CssClass = "delete-button" }
                                  .On(x => x.Tapped, DeleteButtonTapped));
            }
 /// <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);
     }
 }
Пример #10
0
        protected virtual void TapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            var args = new ArtistEventArgs {
                Artist = Artist
            };

            Tapped?.Invoke(this, args);
        }
Пример #11
0
        private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            var args = new SongEventArgs {
                Song = Song
            };

            Tapped?.Invoke(this, args);
        }
Пример #12
0
 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);
 }
        private void ClickGesture_Tapped(object sender, EventArgs e)
        {
            Tapped?.Invoke(this, e);

            if (TappedCommand != null && TappedCommand.CanExecute(CommandParameter))
            {
                TappedCommand?.Execute(CommandParameter);
            }
        }
Пример #14
0
 /// <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);
     }
 }
Пример #15
0
        //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);
        }
Пример #16
0
        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());
        }
Пример #17
0
 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);
        }
Пример #19
0
        public LifeCell()
        {
            BackgroundColor = Color.White;

            TapGestureRecognizer tapGesture = new TapGestureRecognizer();

            tapGesture.Tapped += (sender, args) =>
            {
                Tapped?.Invoke(this, EventArgs.Empty);
            };
            GestureRecognizers.Add(tapGesture);
        }
Пример #20
0
        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);
        }
Пример #21
0
        public Slider()
        {
            Id = "Slider";

            Handles.Do(x => x.Css.Size(0)); // Without this the sizing goes wrong.

            ActiveHandle = Handle;

            Tapped.Handle(UserTapped);
            PanFinished.Handle(() => UserTapped(LastPanEnd));
            Panning.Handle(OnPanning);
        }
        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);
            }
        }
Пример #23
0
        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);
            }
        }
Пример #24
0
 public ExpandableView()
 {
     _defaultTapGesture = new TapGestureRecognizer
     {
         Command = new Command(() =>
         {
             Command?.Execute(null);
             Tapped?.Invoke();
             if (!IsTouchToExpandEnabled)
             {
                 return;
             }
             IsExpanded = !IsExpanded;
         })
     };
 }
Пример #25
0
        public ExpandableView()
        {
            _defaultTapGesture = new TapGestureRecognizer
            {
                Command = new Command(() =>
                {
                    Command?.Execute(CommandParameter);
                    Tapped?.Invoke();
                    if (!IsTouchToExpandEnabled)
                    {
                        return;
                    }
                    IsExpanded = !IsExpanded;
                })
            };

            ForceUpdateSizeCommand = new Command(ForceUpdateSize);
        }
Пример #26
0
        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);
        }
        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);
        }
Пример #29
0
        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);
            }
        }
Пример #30
0
        /// <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;
        }