private void btnOptions_Click(object sender, EventArgs e) { // pause the timer timer.Stop(); // warn user data will be cleared. string msg = "If you continue, the current ticket queue will be emptied and all data will be lost!\n" + "Click [OK] to continue, or [Cancel] to cancel and return to the ticket queue screen."; string caption = "Warning: Delete Queue?"; // warn the user and get permission to continue. DialogResult userAnswer = MessageBox.Show(msg, caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); // if the user said OK, proceed with getting new options and resetting everything. if (userAnswer == DialogResult.OK) { // get updated options frmOptions resetOptions = new frmOptions(); options = resetOptions.ResetOptions(options); // clear the form and both Lists lstTicketQueue.Items.Clear(); availableSlots.Clear(); ticketQueue.Clear(); // generate a new set of available time slots GenerateTimeSlots(); } // no matter what the user says, restart the timer and update queue info timer.Start(); UpdateQueueSummary(); }
private void frmTickets_Load(object sender, EventArgs e) { // eventually this will move elsewhere DateTime currentTime = DateTime.Now; this.Text = currentTime.ToShortTimeString() + "(Open)"; // let's load up timeslot data with defaults for now. options = new Options(5, 5, currentTime, currentTime.AddHours(4), 1); // have the user give us data. frmOptions initOptions = new frmOptions(); options = initOptions.ResetOptions(options); GenerateTimeSlots(); lblNowAdmitting.Text = "1 - " + options.GuestsPerWindow; // and now we kick off the timer timer.Interval = 1000; timer.Tick += timer_Elapsed; timer.Start(); }