Exemple #1
0
 private static void _AddToAutostart()
 {
     if (UacHelper.IsRunningAsAdmin())
     {
         ShortcutHelper.DeleteStartupShortcut();
     }
     else
     {
         ShortcutHelper.CreateStartupShortcut();
     }
 }
Exemple #2
0
        private static void _RemoveFromAutostart()
        {
            // remove shortcut if needed
            ShortcutHelper.DeleteStartupShortcut();

            // Try to remove the task from the task scheduler if needed.
            // This is only possible if admin rights are present. Otherwise an exception
            // will be thrown which is catched in the settingsview model.
            using (var adapter = new TaskSchedulerWrapper())
            {
                adapter.DeleteTaskIfNeeded();
            }
        }
Exemple #3
0
        private static void _AddToAutostart()
        {
            using (var adapter = new TaskSchedulerWrapper())
            {
                if (adapter.CheckExecPathIsCorrect())
                {
                    // There is nothing to do if a task is already created and the
                    // execution path is correct even if admin rights are not
                    // applied to the app at the moment.
                    return;
                }

                if (UacHelper.IsRunningAsAdmin())
                {
                    ShortcutHelper.DeleteStartupShortcut();
                    adapter.DeleteTaskIfNeeded();
                    adapter.CreateTask();
                }
                else
                {
                    ShortcutHelper.CreateStartupShortcut();
                }
            }
        }
Exemple #4
0
 private static void _RemoveFromAutostart()
 {
     // remove shortcut if needed
     ShortcutHelper.DeleteStartupShortcut();
 }