using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RyLine
{
    public partial class FrmConfirm : Form
    {
        public FrmConfirm()
        {
            InitializeComponent();
        }

        private void BtnOK_Click(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            if(MessageBox.Show("请确认是否要立即执行？","询问",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.No)
            {
                timer1.Enabled = true;return;
            }
            DialogResult = DialogResult.OK;
        }

        private void BtnCancel_Click(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            DialogResult = DialogResult.Cancel;
        }
        int Countdown = 60;
        private void timer1_Tick(object sender, EventArgs e)
        {
            Countdown--;
            if(Countdown<=0)
            {
                timer1.Stop();
                timer1.Enabled = false;
                DialogResult = DialogResult.OK;
            }
            else
            {
                LblTime.Text = Countdown.ToString() + "秒后";
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }
    }
}
