Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.Diagnostics;
- using System.Windows.Forms;
- namespace Auto_Shutdown
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void StartBTN_Click(object sender, EventArgs e)
- {
- timer1.Start();
- }
- private void CancelBTN_Click(object sender, EventArgs e)
- {
- timer1.Stop();
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- timer1.Interval = 1000;
- int hourz;
- int minutez;
- int secondsz;
- int sumup;
- hourz = int.Parse(hoursTXT.Text) * 60 * 60;
- minutez = int.Parse(minutesTXT.Text) * 60;
- secondsz = int.Parse(secondsTXT.Text);
- sumup = hourz + minutez + secondsz;
- sumup--;
- label5.Text = sumup.ToString();
- if (sumup == 0)
- {
- Process.Start("shutdown", "/s /t 0");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement