Exemple #1
0
 public void FindJobWithSubstring()
 {
     string id                = "Keeps your Google software up to date".Substring(0, 20);
     bool   substring         = true;
     TaskSchedulerManager tsm = new TaskSchedulerManager();
     var t = tsm.GetTask(id, substring);
 }
Exemple #2
0
        // GET: WindowsTasks/Details/5
        public async Task <IActionResult> Details(string id, bool substring)
        {
            if (id == null)
            {
                return(NotFound());
            }

            try
            {
                TaskSchedulerManager tsm = new TaskSchedulerManager();
                var          t           = tsm.GetTask(id, substring);
                WindowsTasks task        = new WindowsTasks();
                task.Id          = Guid.NewGuid(); //need to map this to something else from the task. look into docs
                task.Name        = t.Name;
                task.Description = t.Definition.RegistrationInfo.Description;
                var triggerCount = t.Definition.Triggers.Count;
                if (triggerCount > 0)
                {
                    task.TriggerType = t.Definition.Triggers.First().TriggerType.ToString();
                    //task.TriggerString = t.Definition.Triggers.First().Repetition.ToString(); //need to figure out what the trigger's schedule looks like and put it in here
                    task.TriggerString  = t.Definition.Triggers.First().ToString();
                    task.TriggerAction  = t.Definition.Actions.First().ActionType.ToString();
                    task.ActionFilePath = t.Definition.Actions.First().ToString();
                }
                task.LastRun       = t.LastRunTime;
                task.CreatedByUser = t.Definition.RegistrationInfo.Author;
                return(View(task));
            } catch (Exception ex)
            {
                throw new Exception($"Failed to retreive task: {id}. Error: {ex.Message}");
            }
        }