public static ShootPointStatus getController() { if (controller == null) { controller = new ShootPointStatus(); } return(controller); }
private void loadAllClasses() { TargetBoxController.setTargetBox(mainTargetBox); allShots = ShootPointController.getController(); //graphForm = new GraphForm(mainTargetBox); targetTimer.setMainForm(this); KeyPreview = true; targetTimer.countingComplete += new TargetTimer.eventDelegate(targetTimer_countingComplete); //this.FormBorderStyle = FormBorderStyle.None; //this.WindowState = FormWindowState.Normal; }
public TargetBox() { InitializeComponent(); shotInfo = ShootPointController.getController(); //Initializeing the contorl width = this.Width; height = this.Height; numberOfCircle = DEFAULT_NUMBER; shotRadiusPoint = new ArrayList(); tempPoints = new ArrayList(); groupMid = new Mrg.Point(0, 0); //shotRad = new int[50]; calculateInfo(); }
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; } } }