作为小白,本人在互联网中获取到了两种利用C#实现windows的自动关机方法
public partial class Form1 : Form
{
/// <summary>
/// 关机定时
/// </summary>
private DispatcherTimer shutdown;
public Form1()
{
InitializeComponent();
WindowStartupLocation s= WindowStartupLocation.CenterScreen;
shutdown = new DispatcherTimer();
shutdown.Tick += new EventHandler(ShowCurTimer);
shutdown.Interval = new TimeSpan(0, 0, 0, 1, 0);
shutdown.Start();
try
&