private void ImageTimer_Tick(object sender, EventArgs e) { // this timer keeps the mount in position while an image is being taken if (sdx < exposureTime) { sdx++; lbTargetLocked.Text = "Capturing image"; lbTime.Text = DateTime.Now.Add(new TimeSpan(offsetHours, offsetMins, 0)).ToString(); } else { ImageTimer.Stop(); trackSatellites(); } }
// sets CurrentAction, PreviousAction, ImagePath // should be called often public void Advance(float x, float y) { // detect movement var action = DetectMovement(x, y); // detect if we are idle if (IdleTimer.ElapsedMilliseconds > IdleLimit) { action = ChangeAction(MotionAction.Idle); IdleTimer.Stop(); } // get the relevant image ImageSet set = default(ImageSet); if (!ImageSets.TryGetValue(CurrentAction, out set)) { throw new Exception("Failed to get images for action : " + CurrentAction); } var index = ImageIndex % set.Images.Length; Image = set.Images[index].Image; // advance if (ImageTimer.ElapsedMilliseconds > set.PerImageLimit) { if (index == 0) { ImageIndex = 1; } else { ImageIndex++; } ImageTimer.Stop(); ImageTimer.Reset(); ImageTimer.Start(); } }