private void Application_Startup(object sender, StartupEventArgs e) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.Current.DispatcherUnhandledException += Application_DispatcherUnhandledException; //禁止休眠 SystemSleepManagement.PreventSleep(true); }
public login() { InitializeComponent(); SystemSleepManagement.PreventSleep(true); textBox3.Text = softReg.GetMNum(); if (ConfigHelper.GetAppConfig("sfjz") == "是") { checkBox1.Checked = true; textBox1.Text = ConfigHelper.GetAppConfig("user"); textBox2.Text = ConfigHelper.GetAppConfig("pass"); } }
private void Current_Activated(object sender, EventArgs e) { SystemSleepManagement.PreventSleep(); Debug.WriteLine("阻止系统休眠"); }
private void Current_Deactivated(object sender, EventArgs e) { SystemSleepManagement.RestoreSleep(); Debug.WriteLine("恢复系统休眠策略"); }