Exemplo n.º 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();
        }
        private void picCancel_Click(object sender, EventArgs e)
        {
            BLL_BilliardWindowsApplication.playclicksound();

            DialogResult = DialogResult.Cancel;
            this.Close();
        }
Exemplo n.º 3
0
 private void picBallFeature_Click(object sender, EventArgs e)
 {
     m_bBallFeatureChecked = !m_bBallFeatureChecked;
     picBallFeature.Image  = m_bBallFeatureChecked ? BilliardWindowsApplication.Properties.Resources.white_green_circle : BilliardWindowsApplication.Properties.Resources.circle;
     BLL_BilliardWindowsApplication.playclicksound();
     if (m_bUploadMode)
     {
         BallTrackAPI.ShowBallSpeed(m_bBallFeatureChecked);
     }
 }
Exemplo n.º 4
0
 private void picDownload_Click(object sender, EventArgs e)
 {
     if (!m_bUploadMode || !m_bLoginOK || BallTrackAPI.m_bReplay || BallTrackAPI.m_bStartTracking)
     {
         return;
     }
     BLL_BilliardWindowsApplication.playclicksound();
     m_bUploadMode = false;
     UpdateModeButtonImages();
     SwitchUpDownMode(false);
 }
Exemplo n.º 5
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);
                }
            }
        }
Exemplo n.º 6
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;
                }
            }
        }
Exemplo n.º 7
0
        private void picInOut_Click(object sender, EventArgs e)
        {
            int nMarkNum = (int)((PictureBox)sender).Tag;

            if (nMarkNum >= 0)
            {
                if (nMarkNum % 2 == 1)
                {
                    BallTrackAPI.m_nOutSide = nMarkNum / 2;
                }
                else
                {
                    BallTrackAPI.m_nInSide = nMarkNum / 2;
                }

                UpdateInOutMarkImage();

                BLL_BilliardWindowsApplication.playclicksound();
            }
        }
Exemplo n.º 8
0
        private void btnReplay_Click(object sender, EventArgs e)
        {
            BLL_BilliardWindowsApplication.playclicksound();
            if (m_bUploadMode && m_bShotFinished)
            {
                UpdateButtonState(TeachingState.Replay);
                int nShotCount = BallTrackAPI.m_nCurrentPlayer == 0 ? BallTrackAPI.BTAPI_GetWhiteHistoryCount() : BallTrackAPI.BTAPI_GetYellowHistoryCount();
                BallTrackAPI.m_bReplay = true;
                nReplayPlayer          = BallTrackAPI.m_nCurrentPlayer;
                ShowTeacherControls(false);
                BallTrackAPI.BTAPI_DrawReplay(IntPtr.Zero, BallTrackAPI.m_nCurrentPlayer, nShotCount - 1);
            }
            else
            {
                int nShotNum = cmbShotHistory.SelectedIndex;
                if (nShotNum >= 0)
                {
                    UpdateButtonState(TeachingState.Replay);
                    ShowTeacherControls(false);
                    ShotMetaInfo shot = BallTrackAPI.shotHistory.Shot[nShotNum];
                    nReplayPlayer          = shot.nPlayer;
                    BallTrackAPI.m_bReplay = true;

                    if (shot.lstRailMarkValue.Count == 28)
                    {
                        for (int i = 0; i < 28; i++)
                        {
                            BallTrackAPI.m_nMarkValue[i] = shot.lstRailMarkValue[i];
                        }
                    }
                    BallTrackAPI.m_nInSide  = shot.InSide;
                    BallTrackAPI.m_nOutSide = shot.OutSide;

                    LoadTeacherSetting();

                    BallTrackAPI.BTAPI_DrawReplay(IntPtr.Zero, shot.nPlayer, shot.nShot);
                }
            }
            timerDraw.Enabled = true;
        }
Exemplo n.º 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            BLL_BilliardWindowsApplication.playclicksound();

            SaveShot();
            m_bShotFinished = false;
            UpdateButtonState(TeachingState.Save);
            ShowTeacherControls(true);
            m_bShotSaved = true;
            UpdateShotList();

            ResetAllInfo();

            txtShotName.Text        = strPromptNewShotName;
            txtShotDescription.Text = strPromptShotDescription;
            txtRailCount.Text       = "";
            BallTrackAPI.m_nInSide  = -1;
            BallTrackAPI.m_nOutSide = -1;

            UpdateInOutMarkImage();
            picBallFeature.Invalidate();
        }
Exemplo n.º 10
0
 private void btnReset_Click(object sender, EventArgs e)
 {
     BLL_BilliardWindowsApplication.playclicksound();
     ResetAllInfo();
     ShowTeacherControls(true);
 }
Exemplo n.º 11
0
 private void pbLabel_Click(object sender, EventArgs e)
 {
     BLL_BilliardWindowsApplication.playclicksound();
     pbLabel.Visible = false;
 }