Advertisement
Guest User

Untitled

a guest
May 24th, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Diagnostics;
  10. using System.Windows.Forms;
  11.  
  12. namespace Auto_Shutdown
  13. {
  14. public partial class Form1 : Form
  15. {
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void StartBTN_Click(object sender, EventArgs e)
  22. {
  23. timer1.Start();
  24. }
  25.  
  26. private void CancelBTN_Click(object sender, EventArgs e)
  27. {
  28. timer1.Stop();
  29. }
  30.  
  31. private void timer1_Tick(object sender, EventArgs e)
  32. {
  33.  
  34. timer1.Interval = 1000;
  35.  
  36. int hourz;
  37. int minutez;
  38. int secondsz;
  39. int sumup;
  40.  
  41. hourz = int.Parse(hoursTXT.Text) * 60 * 60;
  42. minutez = int.Parse(minutesTXT.Text) * 60;
  43. secondsz = int.Parse(secondsTXT.Text);
  44. sumup = hourz + minutez + secondsz;
  45. sumup--;
  46.  
  47. label5.Text = sumup.ToString();
  48. if (sumup == 0)
  49. {
  50. Process.Start("shutdown", "/s /t 0");
  51. }
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement