diff --git a/Tranga-CLI/Tranga_Cli.cs b/Tranga-CLI/Tranga_Cli.cs index 53b593d..7d10790 100644 --- a/Tranga-CLI/Tranga_Cli.cs +++ b/Tranga-CLI/Tranga_Cli.cs @@ -61,6 +61,12 @@ public static class Tranga_Cli Console.ReadKey(); menu = 0; break; + case 4: + ExecuteTask(taskManager); + Console.WriteLine("Press any key."); + Console.ReadKey(); + menu = 0; + break; default: selection = Menu(folderPath); switch (selection) @@ -74,6 +80,9 @@ public static class Tranga_Cli case ConsoleKey.D: menu = 3; break; + case ConsoleKey.E: + menu = 4; + break; default: menu = 0; break; @@ -92,6 +101,7 @@ public static class Tranga_Cli Console.WriteLine("L: List tasks"); Console.WriteLine("C: Create Task"); Console.WriteLine("D: Delete Task"); + Console.WriteLine("E: Execute Task now"); Console.WriteLine("Q: Exit with saving"); ConsoleKey selection = Console.ReadKey().Key; Console.WriteLine(); diff --git a/Tranga/TaskManager.cs b/Tranga/TaskManager.cs index 4ea3e56..f3a71d1 100644 --- a/Tranga/TaskManager.cs +++ b/Tranga/TaskManager.cs @@ -34,6 +34,15 @@ public class TaskManager } } + public void ExecuteTaskNow(TrangaTask task) + { + Task t = new Task(() => + { + TaskExecutor.Execute(this.connectors, task, this._chapterCollection); + }); + t.Start(); + } + public void AddTask(TrangaTask.Task task, string connectorName, Publication? publication, TimeSpan reoccurrence, string language = "") {