Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using System.Windows.Forms;
- namespace WindowsFormsApp2
- {
- public partial class Form1 : Form
- {
- public Thread Working;
- public Form1()
- {
- InitializeComponent();
- Working = new Thread(new ThreadStart(ThreadActions));
- Working.Start();
- }
- private void ThreadActions()
- {
- while (true)
- {
- if (DateTime.Now.Hour == 8 && DateTime.Now.Minute <= 30 && !button1.Visible)
- button1.Visible = true;
- else if (button1.Visible)
- button1.Visible = false;
- if ((DateTime.Now.Hour == 12 && DateTime.Now.Minute >= 30 || DateTime.Now.Hour == 13) && !button2.Visible)
- button2.Visible = true;
- else if (button2.Visible) button2.Visible = false;
- Thread.Sleep(2000);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment