本文介绍了拦截双击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想
在桌面上拦截 当代
双击
然后 显示
a菜单


我写了 一些代码
但不起作用
非常好
,有时
我不再
回答。


这是代码

I would like tointercept the contemporarydouble-tap on the tableand then display a menu.
I wrote some code but does not work very well and sometimes I no longer answer.
this is the code:

 protected override void OnTouchUp(TouchEventArgs e)
        {
            base.OnTouchDown(e);
            Point MenuPoint = new Point();
            MainScatterView.CaptureTouch(e.TouchDevice);
            TouchPoint point = e.GetTouchPoint(MainScatterView);
            MenuPoint.X = (double)point.Position.X;
            MenuPoint.Y = (double)point.Position.Y;
            if ((PreviousTouch.X == -1.0) && (PreviousTouch.Y == -1.0))
            {
                PreviousTouch = MenuPoint; //Salva tocco
                Debug.WriteLine("{0} touch", DateTime.Now);
            }
            else
            {
                if ((Math.Abs(MenuPoint.X - PreviousTouch.X) < 250) &&
                    (Math.Abs(MenuPoint.Y - PreviousTouch.Y) < 250))
                {
                    //Start menu
                    PreviousTouch = MenuPoint;
                    ScatterViewItem svi = new ScatterViewItem();
                    SurfaceButton btnLock = new SurfaceButton();
                    btnLock.Content = "Lock";
                    svi.Orientation = 0;
                    svi.Content = btnLock;
                    svi.Center = MenuPoint;
                    MainScatterView.Items.Add(svi);
                    Debug.WriteLine("{0} Exec Double touch", DateTime.Now);
                }
            }

        }

是否有任何想法让这项运作良好?

Any idea to make this working good?

Thaks:)

www.Photoballot.net

www.Photoballot.net

推荐答案

我不明白为什么你需要在用户解决问题时双击。

触摸输入提供单个Tap和Touch事件,这些事件足以处理用户与命令的交互或内容。

I do not understand why do you need the double tap in a user expereince matter.
Touch input provide the single Tap and Touch event which are more than enough to handle user interaction with commands or content.

对于需要小心处理的用户操作,您需要确保用户真的有意执行该操作,并且您可以使用触摸保持处理程序。

For a user action which need to be done with care, you need to be sure that the user is really intented to perform that action and the that you can use the touch hold handler.

问候

serge


这篇关于拦截双击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 16:42