예제 #1
0
        /* Pre:
         *  Checks if points are detected.
         */
        public void Visit(Touchscreen ts)
        {
            if (ts == null)
            {
                return;
            }

            TouchPoint[] points = ts.GetTouches();
            if (points.Length == 0)
            {
                MessageBox.Show("Diagnostics: Couldn't find any points from touch screen!");
            }
            else
            {
                MessageBox.Show("Diagnostics: Could find points: " + points.Length);
            }
        }
예제 #2
0
        /* Pre:
         * Simulation : process touch screen for interacting with interface of app
         */
        public void Visit(Touchscreen ts)
        {
            if (ts == null)
            {
                return;
            }

            TouchPoint[] points  = ts.GetTouches();
            int          index   = points.Length;
            TouchPoint   average = new TouchPoint {
                x = 0, y = 0
            };

            while (--index > 0)
            {
                average.x += points[index].x;
                average.y += points[index].y;
            }
            average.x /= points.Length;
            average.y /= points.Length;

            MessageBox.Show("Mobile app: Average point position: { x = " + average.x + ", y = " + average.y + " } of " + points.Length + " points");
        }