示例#1
0
文件: Form1.cs 项目: uje/Task
 protected void SetAutoStart(bool autoStart)
 {
     AutoStart = autoStart;
     if (autoStart)
     {
         try {
             ApplicationHelper.AddOnStart();
             CMSAutoStart.Text = "*已启用自动启动(&D)";
         }
         catch (Exception ex) {
             Console.WriteLine("添加到启动项失败!错误信息为:{0}", ex.Message);
         }
     }
     else
     {
         try {
             ApplicationHelper.DelStartApp();
             CMSAutoStart.Text = "启用自动启动(&E)";
         }
         catch (Exception ex) {
             Console.WriteLine("删除启动项失败!错误信息为:{0}", ex.Message);
         }
     }
 }