Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ConnectionTask.cs
1using System;
2using System.Threading.Tasks;
3
5{
9 internal class ConnectionTask : MqTask
10 {
11 private readonly TaskCompletionSource<bool> result;
12 private readonly string userName;
13 private readonly string password;
14
21 public ConnectionTask(MqClient Client, string UserName, string Password)
22 : base(Client)
23 {
24 this.userName = UserName;
25 this.password = Password;
26 this.result = new TaskCompletionSource<bool>();
27 }
28
32 public Task Completed => this.result.Task;
33
38 public override bool DoWork()
39 {
40 try
41 {
42 this.Client.Connect(this.userName, this.password);
43 this.result.TrySetResult(true);
44 }
45 catch (Exception ex)
46 {
47 this.result.TrySetException(ex);
48 }
49
50 return false;
51 }
52 }
53}
void Connect(string UserName, string Password)
Connects to the Queue Manager
Definition: MqClient.cs:123