Exemplo 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");
 }
Exemplo 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"));
        }
Exemplo 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);
     }
 }
Exemplo 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);
            }
        }