Пример #1
0
 public static void saveStatus(bool shotAffected)
 {
     if (controller != null)
     {
         controller.incrementShot(shotAffected, true);
     }
 }
Пример #2
0
        private void MainForm_KeyDown(object sender, KeyEventArgs e)
        {
            //float distance = 0;
            if (e.KeyCode == Keys.S && ShootPointController.getController().isProjectLaser == false)
            {
                Mrg.Point p = new Mrg.Point();
                //MessageBox.Show("");
                player.Play();
                allShots = ShootPointController.getController();
                Color c;
                vp.getCurrentImageShotInfo(out p, out c);

                if (p.getX() != -1 && p.getY() != -1)
                {
                    allShots.shots.Add(new Mrg.Point(p.getX(), p.getY()));
                    allShots.incrementShot(true, true);
                }
                else
                {
                    allShots.incrementShot(false, true);
                }

                mainTargetBox.Invalidate();
                //mainTargetInfo.setShotLabelInfo(allShots.shotAffected, allShots.shotTaken);

                if (ShootPointController.getController().shotTaken == shootTime)
                {
                    if (MessageBox.Show("Do you want to save current shooting records?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        GraphForm graphForm = new GraphForm(mainTargetBox);
                        graphForm.saveData = true;
                        graphForm.showTimerForm();
                        graphForm.showDistanceForm();
                        graphForm.showCircleForm();
                        graphForm.calculateAverage();
                        if (graphForm.doneSave)
                        {
                            MessageBox.Show("Data has been saved successfully.");
                        }
                    }
                    else
                    {
                        if (File.Exists(@"G:\Target\kjhkh\QBD-2011\QBD-2011\" + Login.ShooterName + "Log" + ".txt"))
                        {
                            File.Delete(@"G:\Target\kjhkh\QBD-2011\QBD-2011\" + Login.ShooterName + "Log" + ".txt");
                        }
                        if (File.Exists(@"G:\Target\kjhkh\QBD-2011\QBD-2011\" + Login.ShooterName + ".txt"))
                        {
                            File.Delete(@"G:\Target\kjhkh\QBD-2011\QBD-2011\" + Login.ShooterName + ".txt");
                        }
                    }

                    setControlToolButton(true, true, true);

                    mainTargetBox.isCircleDrawn   = true;
                    mainTargetBox.isDistanceDrawn = true;
                    targetTimer.hangTimer();
                }


                //time adding
                ShootPointController.getController().shotTime.Add(targetTimer.singleShotTime);
                //MessageBox.Show(targetTimer.singleShotTime.ToString());
                //MessageBox.Show(targetTimer.singleShotTime.ToString());
                targetTimer.singleShotTime = 0;
            }

            if (e.KeyCode == Keys.Escape)
            {
                if (totalFullScreen == true)
                {
                    Fullscreen(false);
                    totalFullScreen = false;
                }
            }
        }