void controller_CalibrationStateChanged(object sender, EventArgs <Controller.CalibrationStateInfo> e)
 {
     if (e.Value.State > 0)
     {
         BeginInvoke((MethodInvoker) delegate() { TopMost = false; CalibrationForm.ShowCalibration(e.Value.TargetPoint); });
     }
     else
     {
         BeginInvoke((MethodInvoker) delegate() { CalibrationForm.HideCalibration(); UpdateTrackingUtilization(controller.SourceLayout); TopMost = cbAlwaysOnTop.Checked; });
     }
 }
        public static void ShowCalibration(Point point)
        {
            if (form == null)
            {
                form         = new CalibrationForm();
                form.TopMost = true;
            }

            form.ShowCalibration(point, CROSSHAIR_SIZE, p);
            form.Show();
        }
Example #3
0
 void controller_CalibrationStateChanged(object sender, EventArgs <Controller.CalibrationStateInfo> e)
 {
     try
     {
         if (e.Value.State > 0)
         {
             BeginInvoke((MethodInvoker) delegate() { TopMost = false; CalibrationForm.ShowCalibration(e.Value.TargetPoint); });
         }
         else
         {
             BeginInvoke((MethodInvoker) delegate()
             {
                 CalibrationForm.HideCalibration(); UpdateTrackingUtilization(controller.SourceLayout);
                 TopMost = cbAlwaysOnTop.Checked;
             });
         }
     }
     catch (Exception) {
         MessageBox.Show("Error! Problema Con La Wiilib", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
 }
Example #4
0
        public void DoCalibration()
        {
            if (cf == null)
            {
                return;
            }

            int x;
            int y;
            int size = 25;
            Pen p    = new Pen(Color.Red);

            switch (_calibrationState)
            {
            case 1:
                x = (int)(_screenSize.Width * _calibrationMargin);
                y = (int)(_screenSize.Height * _calibrationMargin);
                cf.ShowCalibration(x, y, size, p);
                _dstX[_calibrationState - 1] = x;
                _dstY[_calibrationState - 1] = y;
                break;

            case 2:
                x = _screenSize.Width - (int)(_screenSize.Width * _calibrationMargin);
                y = (int)(_screenSize.Height * _calibrationMargin);
                cf.ShowCalibration(x, y, size, p);
                _dstX[_calibrationState - 1] = x;
                _dstY[_calibrationState - 1] = y;
                break;

            case 3:
                x = (int)(_screenSize.Width * _calibrationMargin);
                y = _screenSize.Height - (int)(_screenSize.Height * _calibrationMargin);
                cf.ShowCalibration(x, y, size, p);
                _dstX[_calibrationState - 1] = x;
                _dstY[_calibrationState - 1] = y;
                break;

            case 4:
                x = _screenSize.Width - (int)(_screenSize.Width * _calibrationMargin);
                y = _screenSize.Height - (int)(_screenSize.Height * _calibrationMargin);
                cf.ShowCalibration(x, y, size, p);
                _dstX[_calibrationState - 1] = x;
                _dstY[_calibrationState - 1] = y;
                break;

            case 5:
                //compute warp
                _warper.SetDestination(_dstX[0], _dstY[0], _dstX[1], _dstY[1], _dstX[2], _dstY[2], _dstX[3], _dstY[3]);
                _warper.SetSource(_srcX[0], _srcY[0], _srcX[1], _srcY[1], _srcX[2], _srcY[2], _srcX[3], _srcY[3]);
                _warper.ComputeWarp();
                _calibrationState = 0;
                _cursorControl    = true;
                BeginInvoke((MethodInvoker) delegate() { cf.Close(); cbCursorControl.Checked = _cursorControl; });
                SaveCalibrationData();
                UpdateTrackingUtilization();
                break;

            default:
                break;
            }
        }