Exemple #1
0
		private void PromptTimerStop(Business.Time time, ref bool cancel){
			DialogResult res;
			res = MessageBox.Show(this,
				"A timer is running for " + ((time.ForEffort) ? "effort: " + time.Effort.ConventionalId : "rollout: " + time.Rollout.ToString()) + "\r\n" + 
				"Click Yes to stop this timer and submit time to the database\r\n" + 
				"Click No to allow the timer to continue running in the background\r\n" + 
				"Click Cancel to return to abort search",
				"QED",
				MessageBoxButtons.YesNoCancel,
				MessageBoxIcon.Question,
				MessageBoxDefaultButton.Button1);
			if (res == DialogResult.Yes){
				time.StopTimer();
				SubmitTime(time, ref cancel);
				if (!cancel){
					_times.Remove(time);
					if (time.ForEffort){
						UpdateTimerButton(time, btnTestTimer);
					}
					if (time.ForRollout){
						UpdateTimerButton(time, btnRollTimer);
					}
				}else{
					time.StartTimer();
					return;
				}
			}
			if (res == DialogResult.No){
				cancel = false;
			}
			if (res == DialogResult.Cancel){
				cancel = true;
			}else{ // Yes or No
				time.OnMinuteChange -= new Business.Time.OnMinuteChangeHandler(Time_OnMinuteChange);
			}
		}