Exemple #1
0
        public async void OnPenDataHandlerAsync(object sender, PenDataEvent e)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                      () =>
            {
                switch (e.pen_rec.PenStatus)
                {
                case eBeamSDKLib.PEN_DOWN:

                    break;

                case eBeamSDKLib.PEN_MOVE:

                    break;

                case eBeamSDKLib.PEN_UP:
                    m_calStatus++;
                    switch (m_calStatus)
                    {
                    case 0:               ///
                        break;

                    case 1:               ///
                        calNumber1Do.Visibility    = Visibility.Collapsed;
                        calNumber1Check.Visibility = Visibility.Visible;
                        calNumber1Text.Visibility  = Visibility.Collapsed;


                        calNumber2ColorPre.Visibility = Visibility.Collapsed;
                        calNumber2ColorDo.Visibility  = Visibility.Visible;
                        calNumber2Do.Visibility       = Visibility.Visible;
                        calNumber2Check.Visibility    = Visibility.Collapsed;
                        calNumber2Text.Visibility     = Visibility.Visible;

                        m_CalPoint[0].X = e.pen_rec.X - CALIBRATION_MARGIN;
                        m_CalPoint[0].Y = e.pen_rec.Y - CALIBRATION_MARGIN;

                        break;

                    case 2:
                        calNumber2ColorPre.Visibility = Visibility.Collapsed;
                        calNumber2ColorDo.Visibility  = Visibility.Visible;
                        calNumber2Do.Visibility       = Visibility.Collapsed;
                        calNumber2Check.Visibility    = Visibility.Visible;
                        calNumber2Text.Visibility     = Visibility.Collapsed;

                        calNumber3ColorPre.Visibility = Visibility.Collapsed;
                        calNumber3ColorDo.Visibility  = Visibility.Visible;
                        calNumber3Do.Visibility       = Visibility.Visible;
                        calNumber3Check.Visibility    = Visibility.Collapsed;
                        calNumber3Text.Visibility     = Visibility.Visible;

                        m_CalPoint[1].X = e.pen_rec.X - CALIBRATION_MARGIN;
                        m_CalPoint[1].Y = e.pen_rec.Y + CALIBRATION_MARGIN;
                        break;

                    case 3:
                        calNumber3ColorPre.Visibility = Visibility.Collapsed;
                        calNumber3ColorDo.Visibility  = Visibility.Visible;
                        calNumber3Do.Visibility       = Visibility.Collapsed;
                        calNumber3Check.Visibility    = Visibility.Visible;
                        //calNumber3Text.Visibility = Visibility.Collapsed;
                        calNumber3Text.Text = "Calibration is Finished.";
                        m_CalPoint[2].X     = e.pen_rec.X + CALIBRATION_MARGIN;
                        m_CalPoint[2].Y     = e.pen_rec.Y + CALIBRATION_MARGIN;

                        m_CalPoint[3].X = m_CalPoint[2].X;
                        m_CalPoint[3].Y = m_CalPoint[0].Y;
                        sdkLib.SaveCalibrationToDevice(m_CalPoint[0].X, m_CalPoint[0].Y,
                                                       m_CalPoint[1].X, m_CalPoint[1].Y,
                                                       m_CalPoint[2].X, m_CalPoint[2].Y,
                                                       m_CalPoint[3].X, m_CalPoint[3].Y);

                        break;
                    }

                    break;

                case eBeamSDKLib.PEN_HOVER:
                    break;
                }
            });
        }
        public async void OnPenDataHandlerAsync(object sender, PenDataEvent e)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                      () =>
            {
                switch (e.pen_rec.PenStatus)
                {
                case eBeamSDKLib.PEN_DOWN:

                    break;

                case eBeamSDKLib.PEN_MOVE:

                    break;

                case eBeamSDKLib.PEN_UP:
                    m_calStatus++;
                    switch (m_calStatus)
                    {
                    case 0:               ///
                        break;

                    case 1:               ///
                        calNumber1Do.Visibility    = Visibility.Collapsed;
                        calNumber1Check.Visibility = Visibility.Visible;
                        calNumber1Text.Visibility  = Visibility.Collapsed;


                        calNumber2ColorPre.Visibility = Visibility.Collapsed;
                        calNumber2ColorDo.Visibility  = Visibility.Visible;
                        calNumber2Do.Visibility       = Visibility.Visible;
                        calNumber2Check.Visibility    = Visibility.Collapsed;
                        calNumber2Text.Visibility     = Visibility.Visible;
                        if (LeftSide.IsChecked == true)
                        {
                            m_CalPoint[0].X = e.pen_rec.X - CALIBRATION_MARGIN;
                            m_CalPoint[0].Y = e.pen_rec.Y - CALIBRATION_MARGIN;
                        }
                        else
                        {
                            m_CalPoint[3].X = e.pen_rec.X + CALIBRATION_MARGIN;
                            m_CalPoint[3].Y = e.pen_rec.Y - CALIBRATION_MARGIN;
                        }

                        break;

                    case 2:
                        calNumber2ColorPre.Visibility = Visibility.Collapsed;
                        calNumber2ColorDo.Visibility  = Visibility.Visible;
                        calNumber2Do.Visibility       = Visibility.Collapsed;
                        calNumber2Check.Visibility    = Visibility.Visible;
                        calNumber2Text.Visibility     = Visibility.Collapsed;

                        calNumber2Text.Text = "Calibration is Finished.";
                        if (LeftSide.IsChecked == true)
                        {
                            m_CalPoint[2].X = e.pen_rec.X + CALIBRATION_MARGIN;
                            m_CalPoint[2].Y = e.pen_rec.Y + CALIBRATION_MARGIN;
                            m_CalPoint[1].X = m_CalPoint[0].X;
                            m_CalPoint[1].Y = m_CalPoint[2].Y;
                            m_CalPoint[3].X = m_CalPoint[2].X;
                            m_CalPoint[3].Y = m_CalPoint[0].Y;
                        }
                        else
                        {
                            m_CalPoint[1].X = e.pen_rec.X - CALIBRATION_MARGIN;
                            m_CalPoint[1].Y = e.pen_rec.Y + CALIBRATION_MARGIN;
                            m_CalPoint[0].X = m_CalPoint[1].X;
                            m_CalPoint[0].Y = m_CalPoint[3].Y;
                            m_CalPoint[2].X = m_CalPoint[3].X;
                            m_CalPoint[2].Y = m_CalPoint[1].Y;
                        }

                        int pos = (LeftSide.IsChecked == true) ?
                                  eBeamSDKLib.DIRECTION_LEFT : eBeamSDKLib.DIRECTION_RIGHT;
                        sdkLib.setSMPosition(pos);
                        sdkLib.SaveCalibrationToDevice(m_CalPoint[0].X, m_CalPoint[0].Y,
                                                       m_CalPoint[1].X, m_CalPoint[1].Y,
                                                       m_CalPoint[2].X, m_CalPoint[2].Y,
                                                       m_CalPoint[3].X, m_CalPoint[3].Y);

                        break;
                    }

                    break;

                case eBeamSDKLib.PEN_HOVER:
                    break;
                }
            });
        }