Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ConsoleInReadKey.cs
1using System;
2using System.Threading.Tasks;
3
5{
10 {
11 private readonly TaskCompletionSource<ConsoleKeyInfo> result;
12 private readonly bool intercept;
13
19 public ConsoleInReadKey(bool Intercept, TaskCompletionSource<ConsoleKeyInfo> Result)
20 {
21 this.result = Result;
22 this.intercept = Intercept;
23 }
24
28 public override Task Execute()
29 {
30 try
31 {
32 ConsoleKeyInfo Result = System.Console.ReadKey(this.intercept);
33 this.result.TrySetResult(Result);
34 }
35 catch (Exception ex)
36 {
37 this.result.TrySetException(ex);
38 }
39
40 return Task.CompletedTask;
41 }
42 }
43}
override Task Execute()
Executes the console operation.
ConsoleInReadKey(bool Intercept, TaskCompletionSource< ConsoleKeyInfo > Result)
Reads a key from the console.
Manages a Console operation.
Definition: WorkItem.cs:9