예제 #1
0
 /// <summary>
 /// Creates a wrapper object for persisting calibration data.
 /// </summary>
 /// <param name="pSource">The source calibration rectangle</param>
 /// <param name="pDestination">The destination calibration rectangle</param>
 /// <param name="vScreenSize">The screen size</param>
 public PersistentCalibrationData(WiiProvider.CalibrationRectangle pSource, WiiProvider.CalibrationRectangle pDestination, Vector vScreenSize)
 {
     this.Source      = pSource;
     this.Destination = pDestination;
     this.ScreenSize  = vScreenSize;
     this.TimeStamp   = DateTime.Now;
 }
예제 #2
0
        /// <summary>
        /// This is called when calibration is finished.
        /// </summary>
        private void CalibrationCanvas_OnCalibrationFinished(WiiProvider.CalibrationRectangle pSource, WiiProvider.CalibrationRectangle pDestination, Vector vScreenSize)
        {
            // Persist the calibration data
            if (!savePersistentCalibration("./Calibration.dat", new PersistentCalibrationData(pSource, pDestination, vScreenSize)))
            {
                // Error - Failed to save calibration data
                MessageBox.Show("Failed to save calibration data", "Touchmote", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            // Close the calibration window.
            if (pCalibrationWindow != null)
            {
                pCalibrationWindow.Visibility = System.Windows.Visibility.Hidden;
            }
        }
예제 #3
0
        /// <summary>
        /// Method to begin calibration.
        /// </summary>
        /// <param name="pWiiProvider">A reference to the input provider we want to calibrate.</param>
        public void beginCalibration(WiiProvider pWiiProvider)
        {
            // Store a reference to the WiiInput provider.
            this.pWiiProvider = pWiiProvider;

            // Die if we have no provider.
            if (this.pWiiProvider == null)
            {
                throw new Exception("Cannot begin calibrate without an input provider!");
            }

            // Wipe the rectangles.
            this.pSourceRectangle      = new WiiProvider.CalibrationRectangle();
            this.pDestinationRectangle = new WiiProvider.CalibrationRectangle();

            // Disable the transformation step in the provider.
            pWiiProvider.TransformResults = false;

            // Give us an event for the input.
            pEventHandler            = new EventHandler <FrameEventArgs>(pWiiProvider_OnNewFrame);
            pWiiProvider.OnNewFrame += pEventHandler;

            // Set our calibration phase to 1.
            this.iCalibrationPhase = 1;

            // Show the calibration point.
            this.CalibrationPoint.Visibility = Visibility.Visible;

            // Ensure the form is at the top, the correct size and visible.
            Canvas.SetTop(this, 0.0);
            Canvas.SetLeft(this, 0.0);
            Canvas.SetZIndex(this, 999);
            this.Width  = (double)this.Parent.GetValue(Canvas.ActualWidthProperty);
            this.Height = (double)this.Parent.GetValue(Canvas.ActualHeightProperty);

            // Step into the calibration.
            this.movePoint(0.1, 0.1);
            this.stepCalibration();
        }
예제 #4
0
 void CalibrationCanvas_OnCalibrationFinished(WiiProvider.CalibrationRectangle arg1, WiiProvider.CalibrationRectangle arg2, Vector arg3)
 {
     this.Hide();
 }
예제 #5
0
        /// <summary>
        /// Method to begin calibration.
        /// </summary>
        /// <param name="pWiiProvider">A reference to the input provider we want to calibrate.</param>
        public void beginCalibration(WiiProvider pWiiProvider)
        {
            // Store a reference to the WiiInput provider.
            this.pWiiProvider = pWiiProvider;

            // Die if we have no provider.
            if (this.pWiiProvider == null)
                throw new Exception("Cannot begin calibrate without an input provider!");

            // Wipe the rectangles.
            this.pSourceRectangle = new WiiProvider.CalibrationRectangle();
            this.pDestinationRectangle = new WiiProvider.CalibrationRectangle();

            // Disable the transformation step in the provider.
            pWiiProvider.TransformResults = false;

            // Give us an event for the input.
            pEventHandler = new EventHandler<FrameEventArgs>(pWiiProvider_OnNewFrame);
            pWiiProvider.OnNewFrame += pEventHandler;

            // Set our calibration phase to 1.
            this.iCalibrationPhase = 1;

            // Show the calibration point.
            this.CalibrationPoint.Visibility = Visibility.Visible;

            // Ensure the form is at the top, the correct size and visible.
            Canvas.SetTop(this, 0.0);
            Canvas.SetLeft(this, 0.0);
            Canvas.SetZIndex(this, 999);
            this.Width = (double)this.Parent.GetValue(Canvas.ActualWidthProperty);
            this.Height = (double)this.Parent.GetValue(Canvas.ActualHeightProperty);

            // Step into the calibration.
            this.movePoint(0.1, 0.1);
            this.stepCalibration();
        }