C# Windows auto shutdown program source
I made a Windows - Auto shutdown program.
Program sources are very easy to understand.
AutoShutdown.zip are including all my C# source file and codes, even icon downloaded in free icon sites
Development environment: Visual studio 2012 express
I just used some objects, It's very simple programming.
Timer algorithm:
private void Changes(object sender, EventArgs e)
{
int H = int.Parse(textBox2.Text);
int M = int.Parse(textBox1.Text);
int S = int.Parse(textBox3.Text);
if (S != 0)
{
S--;
}
else if (M != 0)
{
M--;
S = 59;
}
else if (H != 0)
{
H--;
M = 59;
S = 59;
}
SetChange(H, M, S);
if (H == 0 && M == 0 && S == 0)
{
EndofComputer();
}
}
private void SetChange(int H, int M, int S)
{
textBox2.Text = H.ToString();
textBox1.Text = M.ToString();
textBox3.Text = S.ToString();
}
That's all.
The way to shutdown the winodws:
private void EndofComputer()
{
Process.Start("shutdown", "/s /t 0");
}
It's very easy.
"/s /t 0" is an argument of process("shutdown");
It's the same thing to writhe "shutdown /s /t 0" in command line.
You can use my source codes for free.
But if you want to share this source, then please write my blogs adress. (quotation, citation)
thank you.