TODO stopper

This commit is contained in:
szabomarton
2024-03-13 12:08:11 +01:00
parent a2430c2cd9
commit b6df6a1a66
21 changed files with 91 additions and 6 deletions

View File

@@ -10,11 +10,16 @@ using System.Windows.Forms;
namespace WindowsFormsApp1
{
public static class Data
{
public static List<TimeSpan> idok = new List<TimeSpan>();
}
public partial class Form1 : Form
{
DateTime start = new DateTime();
DateTime stop = new DateTime();
TimeSpan duration = new TimeSpan();
TimeSpan currSpan = new TimeSpan();
public Form1()
{
InitializeComponent();
@@ -22,7 +27,7 @@ namespace WindowsFormsApp1
private void Form1_Load(object sender, EventArgs e)
{
InitTimer();
}
private void button1_Click(object sender, EventArgs e)
@@ -30,6 +35,8 @@ namespace WindowsFormsApp1
start = DateTime.Now;
timer1.Enabled = true;
button1.Enabled = false;
timer2.Start();
}
private void button2_Click(object sender, EventArgs e)
@@ -40,6 +47,18 @@ namespace WindowsFormsApp1
timer1.Enabled = false;
button1.Enabled = true;
timer2.Stop();
Data.idok.Append(currSpan);
label2.Text = "";
foreach (var item in Data.idok)
{
string asd = item.ToString();
label2.Text = label2.Text + asd;
}
}
private void label1_Click(object sender, EventArgs e)
@@ -51,5 +70,29 @@ namespace WindowsFormsApp1
{
textBox1.Text = DateTime.Now.ToString("HH:mm:ss:fff");
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void timer2_Tick(object sender, EventArgs e)
{
currSpan = DateTime.Now - start;
textBox2.Text = currSpan.ToString();
}
public void InitTimer()
{
timer1 = new Timer();
timer1.Tick += new EventHandler(timer2_Tick);
timer1.Interval = 10; // in miliseconds
}
private void label2_Click(object sender, EventArgs e)
{
}
}
}