Example #1
0
        private void btnExit_Click(object sender, EventArgs e)
        {
            BLL_BilliardWindowsApplication.playclicksound();

            if (BallTrackAPI.m_bStartTracking)
            {
                BallTrackAPI.StopTracking();
            }

            if (m_bShotFinished && m_bUploadMode)
            {
                FrmMessageBox frmMessage = new FrmMessageBox();
                frmMessage.MessageMode = MessageStyle.SaveShot;
                if (frmMessage.ShowDialog(this) == DialogResult.OK)
                {
                    SaveShot();
                }
            }
            BallTrackAPI.BTAPI_ShowTeacherPoint(false);
            if (BallTrackAPI.BTAPI_IsCameraConnected())
            {
                BallTrackAPI.BTAPI_DisconnectCamera();
            }
            this.Close();
        }
Example #2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            BLL_BilliardWindowsApplication.playclicksound();

            if (m_bUploadMode)
            {
                SaveTeacherSetting();
                ForceStopped = false;
                if (BallTrackAPI.ShotNameExisting(txtShotName.Text))
                {
                    ShowLabel(LabelState.EqualName);
                    txtShotName.SelectAll();
                    txtShotName.Focus();
                    return;
                }
                if (!IsSetupCompleted())
                {
                    FrmMessageBox frmMessage = new FrmMessageBox();
                    frmMessage.MessageMode = MessageStyle.SetupIncomplete;
                    frmMessage.ShowDialog(this);
                    return;
                }
                ShowTeacherControls(false);
                UpdateButtonState(TeachingState.Start);

                if (!BallTrackAPI.m_bStartTracking)
                {
                    m_bShotFinished = false;
                    m_bShotSaved    = false;
                    EnableTeachingControls(false);
                    BallTrackAPI.StartTracking();
                }
            }
            else
            {
                int nShot = SearchShotByName(txtShotName.Text);
                if (nShot >= 0)
                {
                    txtShotName.Text        = BallTrackAPI.shotHistory.Shot[nShot].Name;
                    txtShotDescription.Text = BallTrackAPI.shotHistory.Shot[nShot].Description;

                    UpdateButtonState(TeachingState.SearchOK);
                    cmbShotHistory.SelectedIndex = nShot;
                }
                else
                {
                    UpdateButtonState(TeachingState.SearchFail);
                }
            }
        }
Example #3
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            BLL_BilliardWindowsApplication.playclicksound();

            //Stop tracking
            //------//
            if (m_bUploadMode)
            {
                if (BallTrackAPI.m_bStartTracking)
                {
                    BallTrackAPI.StopTracking();
                    BallTrackAPI.ResetCurrentTrajectory();
                    picBilliardTable.Invalidate();
                    ForceStopped = true;
                }
                //
                ShowTeacherControls(true);
                EnableTeachingControls(true);
                if (m_bShotFinished && BallTrackAPI.m_nCurrentPlayer >= 0)
                {
                    BallTrackAPI.BTAPI_DeleteShotRecord(BallTrackAPI.m_nCurrentPlayer, -1);
                    UpdateButtonState(TeachingState.Cancel);
                    m_bShotFinished = false;
                    m_bShotSaved    = false;
                }
                else
                {
                    UpdateButtonState(TeachingState.Stop);
                }
            }
            else
            {
                FrmMessageBox frmMessage = new FrmMessageBox();
                frmMessage.MessageMode = MessageStyle.CancelShot;
                if (frmMessage.ShowDialog(this) == DialogResult.OK)
                {
                    BallTrackAPI.DeleteShotHistory(cmbShotHistory.SelectedIndex);
                    BallTrackAPI.SaveShotHistory(lblTeacherName.Text);
                    UpdateButtonState(TeachingState.Ready);
                    cmbShotHistory.Text = "";
                    UpdateShotList();
                    m_bShotFinished = false;
                }
            }
        }