using ryCommon;
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 TimeClock.DbOp
{
    public partial class FrmCountdownTip : Form
    {
        public FrmCountdownTip()
        {
            InitializeComponent();
            CbbMode.SelectedIndex = 0;
        }

        private void CbbMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch(CbbMode.SelectedIndex)
            {
                case 0://天
                    NumDay.Enabled = true;
                    NumHour.Enabled = true;
                    NumMinute.Enabled = true;
                    NumHour.Maximum = 23;
                    NumMinute.Maximum = 59;
                    break;
                case 1://小时
                    NumDay.Enabled = false;
                    NumHour.Enabled = true;
                    NumMinute.Enabled = true;
                    NumHour.Maximum = 100000;
                    NumMinute.Maximum = 59;
                    break;
                case 2://分钟
                    NumDay.Enabled = false;
                    NumHour.Enabled = false;
                    NumMinute.Enabled = true;
                    NumMinute.Maximum = 1000000;
                    break;
            }
        }
        public Int64 Minute = 0;
        private void BtnOK_Click(object sender, EventArgs e)
        {
            Int64 minute = 0;
            switch (CbbMode.SelectedIndex)
            {
                case 0://天
                    minute = (NumDay.Value * 24 * 60 + NumHour.Value * 60 + NumMinute.Value).ToInt64();
                    break;
                case 1://小时
                    minute = (NumHour.Value * 60 + NumMinute.Value).ToInt64();
                    break;
                case 2://分钟
                    minute = (NumMinute.Value).ToInt64();
                    break;
            }
            Minute = minute;
            DialogResult = DialogResult.OK;
        }
    }
}
