private void SetToRunOnStartup()
 {
     if (StartUpManager.IsUserAdministrator())
     {
         StartUpManager.AddApplicationToAllUserStartup();
     }
     else
     {
         StartUpManager.AddApplicationToCurrentUserStartup();
     }
 }
Beispiel #2
0
 private void ApplySavedSettings()
 {
     Properties.Settings.Default.Duration  = ((int)tbDuration.Value) * ONE_SECOND;
     Properties.Settings.Default.Frequency = (int)tbFrequency.Value;
     if (toggleState && !displayState)
     {
         Properties.Settings.Default.DisplayOn = true;
         window.StartJob();
     }
     else if (!toggleState && displayState)
     {
         Properties.Settings.Default.DisplayOn = false;
         window.StopJob();
     }
     if (StartupToggle.IsChecked == true)
     {
         if (StartUpManager.IsUserAdministrator())
         {
             StartUpManager.AddApplicationToAllUserStartup();
         }
         else
         {
             StartUpManager.AddApplicationToCurrentUserStartup();
         }
     }
     else
     {
         if (StartUpManager.IsUserAdministrator())
         {
             StartUpManager.RemoveApplicationFromAllUserStartup();
         }
         else
         {
             StartUpManager.RemoveApplicationFromCurrentUserStartup();
         }
     }
     Properties.Settings.Default.Save();
     this.Close();
 }