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


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

namespace Сидоренко_Сохарев
{
    public partial class Form1 : Form
    {
        private int totalSecondsRemaining = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            numericUpDown1.Maximum = 59;
            numericUpDown1.Minimum = 0;
            numericUpDown1.TabStop = false;
            numericUpDown2.Maximum = 59;
            numericUpDown2.Minimum = 0;
            numericUpDown2.TabStop = false;
            button1.Enabled = false;
            label1.Text = "00:00";
            label2.Text = "Минут";
            label3.Text = "Секунд";
            groupBox1.Text = "Интервал";
            button1.Text = "Пуск";

        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            if ((numericUpDown1.Value == 0) && (numericUpDown2.Value == 0))
                button1.Enabled = false;
            else
                button1.Enabled = true;

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            totalSecondsRemaining--;

            if (totalSecondsRemaining <= 0)
            {
                timer1.Enabled = false;
                label1.Text = "00:00";
                MessageBox.Show("Заданный интервал времени истек", "Таймер", MessageBoxButtons.OK, MessageBoxIcon.Information);
                button1.Text = "Пуск";
                groupBox1.Enabled = true;
                numericUpDown1.Value = 0;
                numericUpDown2.Value = 0;
            }
            else
            {
                int min = totalSecondsRemaining / 60;
                int sec = totalSecondsRemaining % 60;

                label1.Text = min.ToString("00") + ":" + sec.ToString("00");
            }
        }

        

        private void button1_Click(object sender, EventArgs e)
        {
            if (!timer1.Enabled)
            {
                int minutes = (int)numericUpDown1.Value;
                int seconds = (int)numericUpDown2.Value;
                totalSecondsRemaining = (minutes * 60) + seconds;

                if (totalSecondsRemaining > 0)
                {
                    groupBox1.Enabled = false;
                    button1.Text = "Стоп";
                    label1.Text = minutes.ToString("00") + ":" + seconds.ToString("00");
                    timer1.Interval = 1000;
                    timer1.Enabled = true;
                }
                else
                {
                    timer1.Enabled = false;
                    button1.Text = "Пуск";
                    groupBox1.Enabled = true;

                    if (totalSecondsRemaining > 0)
                    {
                        numericUpDown1.Value = totalSecondsRemaining / 60;
                        numericUpDown2.Value = totalSecondsRemaining % 60;
                    }
                    else
                    {
                        numericUpDown1.Value = 0;
                        numericUpDown2.Value = 0;
                        label1.Text = "00:00";
                    }
                }
            }

        }
    }
}