예제 #1
0
        protected override void OnTouchUp(TouchEventArgs e)
        {
            base.OnTouchUp(e);

            int x, y;

            e.GetPosition(this, 0, out x, out y);

            CalibrationManager.CalibrationPoints.TouchX[idx] = (short)x;
            CalibrationManager.CalibrationPoints.TouchY[idx] = (short)y;

            idx++;

            if (idx == CalibrationManager.CalibrationPoints.Count)
            {
                // The last point has been reached.
                CalibrationManager.ApplyCalibrationPoints();
                CalibrationManager.SaveCalibrationPoints();

                Close();

                if (CalibrationComplete != null)
                {
                    CalibrationComplete(this, EventArgs.Empty);
                }
            }

            Invalidate();
        }
예제 #2
0
        public GraphicsManager(int width, int height)
        {
            //mouseManager = new MouseManager(canvas);
            //mouseManager.OnMouseDblClick = InterceptMouseDblClick;
            //mouseManager.OnMouseDown = InterceptMouseDown;
            //mouseManager.OnMouseUp = InterceptMouseUp;
            //mouseManager.OnMouseMove = InterceptMouseMove;
            //mouseManager.OnMouseOut = InterceptMouseOut;

            TouchManager.TouchDown           += new TouchEventHandler(TouchManager_TouchDown);
            TouchManager.TouchMove           += new TouchEventHandler(TouchManager_TouchMove);
            TouchManager.TouchUp             += new TouchEventHandler(TouchManager_TouchUp);
            TouchManager.TouchGestureStarted += new TouchGestureEventHandler(TouchManager_TouchGestureStarted);
            TouchManager.TouchGestureChanged += new TouchGestureEventHandler(TouchManager_TouchGestureChanged);
            TouchManager.TouchGestureEnded   += new TouchGestureEventHandler(TouchManager_TouchGestureEnded);
            TouchManager.Initialize();

            bitmap  = new Bitmap(width, height);
            desktop = new Desktop(width, height, this);
            cw      = new CalibrationWindow(width, height, this)
            {
                Background   = new SolidColorBrush(Color.CornflowerBlue),
                CrosshairPen = new Pen(Color.Red, 1)
            };

            if (CalibrationManager.IsCalibrated)
            {
                CalibrationManager.ApplyCalibrationPoints();
            }

            desktop.Invalidate();
        }