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
        public static bool IsSetAsAutoStartup()
        {
            using (var adapter = new TaskSchedulerWrapper())
            {
                if (adapter.CheckExecPathIsCorrect())
                {
                    return(true);
                }
            }

            return(ShortcutHelper.IsSetAsAutoStartup());
        }
Example #3
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();
            }
        }
Example #4
0
        public AsientoProgramado(int idComunidad, TareaInfo infoTarea)
        {
            this._Id        = 0;
            this.Apuntes    = new ObservableApuntesList(this);
            this.FechaValor = DateTime.Today;
            this.Saldo      = 0;
            this.InfoTarea  = infoTarea;

            if (this.InfoTarea.EstaEsMachineQueEjecuta)
            {
                var tsw = new TaskSchedulerWrapper(GlobalSettings.Properties.Settings.Default.NOMBREAPPINTERNO);
                this.Tarea = tsw.GetTarea(this.InfoTarea.NombreTarea);
            }
            else
            {
                this.Tarea = null;
            }
        }
Example #5
0
        public AsientoProgramado(Asiento asiento, TareaInfo infoTarea)
        {
            this._Id = asiento.Id;
            this._IdOwnerComunidad = asiento.IdOwnerComunidad;
            this.Apuntes           = asiento.Apuntes;
            this.FechaValor        = asiento.FechaValor;
            this.Saldo             = asiento.Saldo;
            this.InfoTarea         = infoTarea;

            if (this.InfoTarea.EstaEsMachineQueEjecuta)
            {
                var tsw = new TaskSchedulerWrapper(GlobalSettings.Properties.Settings.Default.NOMBREAPPINTERNO);
                this.Tarea = tsw.GetTarea(this.InfoTarea.NombreTarea);
            }
            else
            {
                this.Tarea = null;
            }
        }
Example #6
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();
                }
            }
        }