Загрузка данных


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        TimerState state;
        TimeSpan remain;

        public Form1()
        {
            InitializeComponent();
            state = TimerState.Disabled;
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            nummin.Minimum = 0;
            nummin.Maximum = 59;
            numsec.Minimum = 0;
            numsec.Maximum = 59;
            state = TimerState.Disabled;
            lblout.Text = "00:00";
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            if (remain.TotalSeconds > 0)
            {
                remain = remain.Subtract(TimeSpan.FromSeconds(1));
                lblout.Text = remain.ToString(@"mm\:ss");
            }

            if (remain.TotalSeconds == 0 && state == TimerState.Enabled)
            {
                timer1.Stop();
                state = TimerState.Disabled;
                buttonstart.Text = "Пуск";
                nummin.Enabled = true;
                numsec.Enabled = true;
                lblout.Text = "00:00";
                MessageBox.Show("Время вышло!");
            }
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void numericUpDown2_ValueChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (state == TimerState.Disabled)
            {
                buttonstart.Text = "Стоп";
                nummin.Enabled = false;
                numsec.Enabled = false;
                state = TimerState.Enabled;
                remain = new TimeSpan(0, (int)nummin.Value, (int)numsec.Value);
                lblout.Text = remain.ToString(@"mm\:ss");
                timer1.Start();
            }
            else if (state == TimerState.Enabled)
            {
                buttonstart.Text = "Пуск";
                nummin.Enabled = true;
                numsec.Enabled = true;
                state = TimerState.Disabled;
                timer1.Stop();
                nummin.Value = remain.Minutes;
                numsec.Value = remain.Seconds;
            }
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }
    }
    public enum TimerState
    {
        Disabled,
        Enabled
    }
}