private void pictureBoxDisplay_Click(object sender, EventArgs e) { MouseEventArgs me = (MouseEventArgs)e; if (me.Button == System.Windows.Forms.MouseButtons.Left && BoothState == BoothStates.Idle) { Setup.LogStat(StatTypes.TakingPictures); if (CycleFrames) { NextFrame(false); } BoothState = BoothStates.GetReady; //drawLatestImage(null, new PaintEventArgs(this.Get //this.Repa secondsRemaining = 2; roundsRemaining = Rounds; ImagesSaved = new List <string>(); NextTickDate = DateTime.Now.AddSeconds(1); //PictureTimer = new Timer(); //PictureTimer.Interval = 1000; //PictureTimer.Tick += new EventHandler(t_Tick); //PictureTimer.Start(); } else if (me.Button == System.Windows.Forms.MouseButtons.Right && BoothState != BoothStates.TakePicture) { NextFrame(true); } }
//private Timer PictureTimer = null; void onTick() { try { if (BoothState == BoothStates.GetReady) { secondsRemaining--; if (secondsRemaining == 0) { secondsRemaining = Settings.SecondsToWait; BoothState = BoothStates.Countdown; SND_Tick.Play(); } } else if (BoothState == BoothStates.Countdown) { secondsRemaining--; if (secondsRemaining == 0) { secondsRemaining = 2; BoothState = BoothStates.TakePicture; SND_Smile.Play(); } else { SND_Tick.Play(); } } else if (BoothState == BoothStates.TakePicture) { secondsRemaining--; if (secondsRemaining == 0) { secondsRemaining = Settings.SecondsToWait; SND_CameraClick.Play(); // Take picture and save Flash(); SavePicture(); roundsRemaining--; if (roundsRemaining == 0) { NextTickDate = null; //PictureTimer.Stop(); SavePictures(); ShowPreview(); } else { BoothState = BoothStates.GetReady; secondsRemaining = 2; if (CycleFrames) { NextFrame(false); } } } } } catch (Exception ex) { Setup.Log("onTick Exception", ex); } if (NextTickDate != null) { NextTickDate = DateTime.Now.AddSeconds(1); } }
void ShowPreview() { BoothState = BoothStates.Preview; PreviewEndDate = DateTime.Now.AddSeconds(Settings.SecondsToPreview); }