-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnectionLink.cs
More file actions
48 lines (41 loc) · 1.14 KB
/
Copy pathConnectionLink.cs
File metadata and controls
48 lines (41 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
////////////////////////////////////////////////
// © https://github.com/badhitman - @FakeGov
////////////////////////////////////////////////
using StockSharp.Algo;
namespace StockSharpDriver;
/// <summary>
/// ConnectionLink
/// </summary>
public class ConnectionLink
{
/// <summary>
/// Delegate [event] for <c>Connect</c> event
/// </summary>
public delegate void ConnectHandler();
/// <summary>
/// Delegate [event] for <c>Disconnect</c> event
/// </summary>
public delegate void DisconnectHandler();
/// <inheritdoc/>
public event ConnectHandler? ConnectNotify;
/// <inheritdoc/>
public event DisconnectHandler? DisconnectNotify;
/// <inheritdoc/>
public Connector Connector { get; set; } = new();
/// <summary>
/// Notify outer service`s to open connection
/// </summary>
public void Subscribe()
{
if (ConnectNotify is not null)
ConnectNotify();
}
/// <summary>
/// Notify outer service`s to close connection
/// </summary>
public void Unsubscribe()
{
if (DisconnectNotify is not null)
DisconnectNotify();
}
}