Beispiel #1
0
 private void checkBoxStartup_CheckedChanged(object sender, EventArgs e)
 {
     if (StartupService != null)
     {
         if (checkBoxStartup.Checked)
         {
             StartupService.Set(Environment.CurrentDirectory + @"\RemSys 3.0.exe");
         }
         else
         {
             StartupService.Delete();
         }
         Settings.Default.runstartup = checkBoxStartup.Checked;
         Settings.Default.Save();
     }
 }
 public static bool Set(bool enabled)
 {
     try
     {
         var path    = $@"""{Utils.GetExecutablePath()}""";
         var service = new StartupService(Key);
         if (enabled)
         {
             service.Set(path);
         }
         else
         {
             service.Delete();
         }
         return(true);
     }
     catch (Exception e)
     {
         Logging.LogUsefulException(e);
         return(false);
     }
 }