Example #1
0
        public bool OnItemLongClick(AdapterView parent, View view, int position, long id)
        {
            var args = new EventHandledEventArgs();
            var cell = view as ICell;

            LongClicked?.Invoke(cell?.Pair ?? cell, args);
            return(args.IsHandled);
        }
Example #2
0
 public void SendLongClick()
 {
     LongClicked?.Invoke(this, new EventArgs());
     if (LongClickCommand != null && LongClickCommand.CanExecute(null))
     {
         LongClickCommand.Execute(LongClickCommandParameter);
     }
 }
Example #3
0
        public bool OnItemLongClick(AdapterView parent, View view, int position, long id)
        {
            Device.Log.Platform($"Cell long-clicked at position {position}");
            var args = new EventHandledEventArgs();
            var cell = RetrieveCell(view);

            LongClicked?.Invoke(cell?.Pair ?? cell, args);
            return(args.IsHandled);
        }
Example #4
0
 public void SendLongClicked(Coordinate pos)
 {
     LongClicked?.Invoke(this, new MapLongClickedEventArgs(pos));
 }
 public void OnLongClicked()
 {
     LongClicked?.Invoke(this, EventArgs.Empty);
 }
Example #6
0
        /// <summary>
        /// GUI部品を更新する。
        /// </summary>
        /// <param name="mouse">マウス。</param>
        /// <param name="pointX">マウスの相対X座標。</param>
        /// <param name="pointY">マウスの相対Y座標。</param>
        public virtual void Update(Mouse mouse = null, int?pointX = null, int?pointY = null)
        {
            if (mouse == null)
            {
                LeftJudge = (false, (0, 0));

                LongClickCounter.Stop();
                LongClickCounter.Reset();

                Dragging = false;
                return;
            }

            if (!pointX.HasValue || !pointY.HasValue)
            {
                MousePoint = (mouse.Point.x - X, mouse.Point.y - Y);
            }
            else
            {
                MousePoint = (pointX.Value - X, pointY.Value - Y);
            }

            var outSide = IsOutSide();

            if (!outSide)
            {
                OnHovering?.Invoke(this, new MouseClickEventArgs(MousePoint.x, MousePoint.y));
                if (!Hovering)
                {
                    OnMouseEnter?.Invoke(this, new MouseClickEventArgs(MousePoint.x, MousePoint.y));
                    Hovering = true;
                }
            }
            else
            {
                if (Hovering)
                {
                    OnMouseLeave?.Invoke(this, new MouseClickEventArgs(MousePoint.x, MousePoint.y));
                    Hovering = false;
                }
            }

            if (mouse.IsPushedButton(MouseButton.Left))
            {
                // マウス初回クリック処理
                if (!outSide)
                {
                    LeftJudge = (true, MousePoint);
                    LongClickCounter?.Start();
                    OnMouseDown?.Invoke(this, new MouseClickEventArgs(MousePoint.x, MousePoint.y));
                }
            }
            else if (mouse.IsPushingButton(MouseButton.Left))
            {
                // マウスが要素内をクリックしてるかどうかの判定
                if (LeftJudge.Item1)
                {
                    if (outSide)
                    {
                        LeftJudge = (false, MousePoint);
                        OnMouseUp?.Invoke(this, new MouseClickEventArgs(MousePoint.x, MousePoint.y));
                        LongClickCounter.Stop();
                        LongClickCounter.Reset();
                    }
                    else
                    {
                        LongClickCounter?.Tick();
                        if (LongClickCounter.State == TimerState.Stopped)
                        {
                            // ロングタップ
                            LeftJudge = (false, MousePoint);
                            OnMouseUp?.Invoke(this, new MouseClickEventArgs(MousePoint.x, MousePoint.y));
                            if (!Dragging)
                            {
                                LongClicked?.Invoke(this, new MouseClickEventArgs(MousePoint.x, MousePoint.y));
                            }
                            LongClickCounter.Stop();
                            LongClickCounter.Reset();

                            Dragging = false;
                        }
                    }
                }
            }
            else if (mouse.IsLeftButton(MouseButton.Left))
            {
                // クリック判定
                if (LeftJudge.Item1)
                {
                    if (!Dragging)
                    {
                        Clicked?.Invoke(this, new MouseClickEventArgs(MousePoint.x, MousePoint.y));
                    }
                    OnMouseUp?.Invoke(this, new MouseClickEventArgs(MousePoint.x, MousePoint.y));
                }
                LongClickCounter.Stop();
                LongClickCounter.Reset();

                Dragging = false;
            }

            foreach (var item in Child)
            {
                item.Update(mouse, MousePoint.x, MousePoint.y);
            }
        }
Example #7
0
 public void OnLongClicked(object item)
 {
     LongClicked?.Invoke(this, new ItemTappedEventArgs(this, item));
 }
 private void OnLongClick(object s, View.LongClickEventArgs e)
 {
     LongClicked?.Invoke(this, AdapterPosition);
     LongClickedWithItem?.Invoke(this, Item);
 }
Example #9
0
 public void OnLongClicked()
 {
     LongClicked?.Invoke(this, new ItemTappedEventArgs(this, SelectedItem));
 }