Пример #1
0
        public override int Run(String[] RemainingArguments)
        {
            TaskStateControl taskStateControl = new TaskStateControl();
            SparkLogic       sparkLogic       = new SparkLogic();
            var activeTask = sparkLogic.ReturnActiveTask();

            if (activeTask == null)
            {
                Console.WriteLine("There are no active tasks");
                return(0);
            }
            taskStateControl.PauseTask();
            Console.WriteLine("The task has been paused.");

            return(0);
        }
Пример #2
0
        public override int Run(String[] RemainingArguments)
        {
            IRavenEntity taskToFetch  = new SparkTask();
            var          actualTaskId = "SparkTasks/" + TaskId;

            taskToFetch.Id = actualTaskId;
            if (TaskId == null)
            {
                Console.WriteLine("Please specify an Id for the task to activate");
                return(0);
            }
            SparkTask         taskToSet        = SparkLogic.fetch(taskToFetch) as SparkTask;
            TaskStateControl  taskStateControl = new TaskStateControl();
            ActiveTaskProcess taskProcessor    = new ActiveTaskProcess();

            if (taskToSet == null)
            {
                Console.WriteLine("The task specified doesn't exist");
                return(0);
            }

            var result = taskStateControl.SetActiveTask(taskToSet);

            if (result == true)
            {
                Console.WriteLine("The task was activated");
            }
            if (taskToSet != null && result == false)
            {
                taskStateControl.PauseTask();
                taskStateControl.SetActiveTask(taskToSet);
                Console.WriteLine("The Task was activated. The previous task was put on pause");
            }

            ReminderControl.StartTime = DateTime.Now;
            taskProcessor.SetStartTime();
            return(0);
        }