Example #1
0
        public static void UpdateExecPath()
        {
            using (var adapter = new TaskSchedulerWrapper())
            {
                if (adapter.CheckExecPathIsCorrect())
                {
                    return;
                }

                if (adapter.CheckTaskExists())
                {
                    if (UacHelper.IsRunningAsAdmin() == false)
                    {
                        // we can do nothing if the app is not started in admin mode
                        return;
                    }

                    adapter.DeleteTaskIfNeeded();
                    adapter.CreateTask();
                }
                else
                {
                    ShortcutHelper.CreateStartupShortcut();
                }
            }
        }
Example #2
0
 private static void _AddToAutostart()
 {
     if (UacHelper.IsRunningAsAdmin())
     {
         ShortcutHelper.DeleteStartupShortcut();
     }
     else
     {
         ShortcutHelper.CreateStartupShortcut();
     }
 }
Example #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();
                }
            }
        }