Originally my event handler code for the snooze button pointed to the following method:
Expand|Select|Wrap|Line Numbers
- public void SnoozeForm(int minutes)
- {
- //VAR
- TimeSpan waitLength = DateTime.Now.AddMinutes(minutes) - DateTime.Now;
- //BEGIN
- //Hide the form
- this.Hide();
- //Tell threader this bubble is hidden again
- this.myThreader.BubblesVisible--;
- //Turn on Context Menu if no more visible bubbles
- if(this.myThreader.BubblesVisible == 0)
- {
- this.myThreader.frmEOD.FlipContextMenu(true);
- }//end if
- //Suspend Thread for endTime
- this.ThreadController.WaitOne(waitLength, false);
- //Check to see if we were awoken because of end of day
- if(!this.myThreader.EndOfDay)
- {
- //Turn off context menu
- this.myThreader.frmEOD.FlipContextMenu(false);
- //Tell threader we are visible
- this.myThreader.BubblesVisible++;
- //Once time has expired unhide the form
- if(!this.Visible)
- {
- this.Show();
- }//end if
- }
- else if(this.myThreader.AboutOn)
- {
- SnoozeForm(5);
- }
- else
- {
- //Resynch Thread
- ResynchThread(true);
- }
- }//SnoozeForm
So I decided I would try a timer on the form, which would make sure the bubble had no issues being closed during shutdown, except that it seems the form must be visible when using the timer, as when I modified the code to use the timer, the timer would be enabled and the form would be invisible, but once the end of the method hit, the form would pop up visible again.
So any idea which method is better for this situation, and if so what am I doing wrong to get these bubbles to snooze and hide properly, and allow windows to shut them down? Thanks a bunch.