-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimer.cs
More file actions
57 lines (44 loc) · 1.43 KB
/
Timer.cs
File metadata and controls
57 lines (44 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 Timer
{
public partial class Timer : Form
{
// Amaç: Belirlenen zaman aralığında butona basıldığında eylemi başlatmak veya durdurmak.
// Olası senaryolar: Stok bilgisi güncellenmesi için veya merkezdeki ilaç bilgilerinin belli aralıklarla şubelere transfer olması için.
public Timer()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
// TEST: MessageBox.Show("Timer çalıştı!");
lblTime.Text = DateTime.Now.ToString();
}
private void btnStart_Click(object sender, EventArgs e)
{
//Butona basılınca başlat
timer1.Start();
}
private void btnStop_Click(object sender, EventArgs e)
{
//Butona basılınca durdur
timer1.Stop();
}
private void btnUpdate_Click(object sender, EventArgs e)
{
// Timer'ın Özelliği: Interval (Aralık)
// timer1.Interval = 2000; // XHardcodeX
timer1.Interval = Convert.ToInt32(textBox1.Text) * 1000;
}
// Mantıklı olan çözüm: Hardcode yapmak yerine veritabanındaki süre tablosundan, süre kolonunu değiştirmek;
// çünkü süre veya ayarların değiştirilmesinin istenilmesi durumunda 30 tane yerden değil tek yerden değiştirmek üstünlük sağlar.
}
}