Esempio n. 1
0
 static string GetShortcutPath(ReflectedShell shell = null)
 {
     if (shell == null) {
         shell = new ReflectedShell();
     }
     var startup = shell.GetSpecialFolder("Startup");
     return Path.Combine(startup, "Caffeinated.lnk");
 }
Esempio n. 2
0
        static string GetShortcutPath(ReflectedShell shell = null)
        {
            if (shell == null)
            {
                shell = new ReflectedShell();
            }
            var startup = shell.GetSpecialFolder("Startup");

            return(Path.Combine(startup, "Caffeinated.lnk"));
        }
Esempio n. 3
0
 private void StartupChkBox_CheckedChanged(object sender, EventArgs e)
 {
     var shell = new ReflectedShell();
     var shortcut = GetShortcutPath(shell);
     var executable = Assembly.GetExecutingAssembly()
                              .GetName().CodeBase;
     if (StartupChkBox.Checked) {
         // create shortcut in startup items folder in start menu
         shell.CreateShortcut(shortcut, executable);
     }
     else {
         // remove shortcut if it exists
         File.Delete(shortcut);
     }
 }
Esempio n. 4
0
        private void StartupChkBox_CheckedChanged(object sender, EventArgs e)
        {
            var shell      = new ReflectedShell();
            var shortcut   = GetShortcutPath(shell);
            var executable = Assembly.GetExecutingAssembly()
                             .GetName().CodeBase;

            if (StartupChkBox.Checked)
            {
                // create shortcut in startup items folder in start menu
                shell.CreateShortcut(shortcut, executable);
            }
            else
            {
                // remove shortcut if it exists
                File.Delete(shortcut);
            }
        }