//Method to execute a saved task public void ExecuteTask() { if (File.Exists("Task.json")) { _view.ListTasks(_jsonTask.ListAllTasks()); int NumTask = _jsonTask.ListAllTasks().GetLength(0); int tasknumber = _view.TaskChoice(); if (tasknumber > NumTask) { _view.UncorrectChoice(); ExecuteTask(); } else { if (_jsonTask.FindTask(tasknumber).GetValue(1).ToString() == "Mirror") { _executeSave = new ExecuteSave(new MirrorSave()); _executeSave.DoSaveStrategy(_jsonTask.FindTask(tasknumber)); } else if (_jsonTask.FindTask(tasknumber).GetValue(1).ToString() == "Differential") { _executeSave = new ExecuteSave(new DifferentialSave()); _executeSave.DoSaveStrategy(_jsonTask.FindTask(tasknumber)); } Continue(); } } else { _view.NoTasks(); Continue(); } }
public void ExecuteTask(string work) { if (File.Exists("Task.json") && _jsonTask.ListAllTasks().Length != 0) { if (_jsonTask.FindTask(work).Type == "Mirror") { _executeSave = new ExecuteSave(mirrorSave); Work parameters = new Work() { informations = _jsonTask.FindTask(work), extentions = _jsonTask.ListConfEXT(), softwares = _jsonTask.ListConfMetier(), priorities = _jsonTask.ListConfPrio() }; _executeSave.DoSaveStrategy(parameters, ProcessVerif); } else if (_jsonTask.FindTask(work).Type == "Differential") { _executeSave = new ExecuteSave(differentialSave); Work parameters = new Work() { informations = _jsonTask.FindTask(work), extentions = _jsonTask.ListConfEXT(), softwares = _jsonTask.ListConfMetier(), priorities = _jsonTask.ListConfPrio() }; _executeSave.DoSaveStrategy(parameters, ProcessVerif); } } else { Console.WriteLine("You have no task created"); } }