mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-20 14:18:22 +00:00
Updated documentation of newly added classes
This commit is contained in:
@@ -12,22 +12,46 @@ namespace MtApi.Monitors.Triggers
|
||||
private readonly MtApiClient _apiClient;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Returns true if the trigger is started, otherwise false
|
||||
/// </summary>
|
||||
public bool IsStarted => _isStarted;
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
/// <summary>
|
||||
/// Event will be called if the trigger raised.
|
||||
/// </summary>
|
||||
public event EventHandler Raised;
|
||||
#endregion
|
||||
|
||||
#region ctor
|
||||
public NewBarTrigger(MtApiClient apiClient)
|
||||
{
|
||||
_apiClient = apiClient;
|
||||
_apiClient.OnLastTimeBar += _apiClient_OnLastTimeBar;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public methods
|
||||
/// <summary>
|
||||
/// Starts the trigger
|
||||
/// </summary>
|
||||
public void Start() => SetIsStarted(true);
|
||||
/// <summary>
|
||||
/// Stops the trigger
|
||||
/// </summary>
|
||||
public void Stop() => SetIsStarted(false);
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
private void _apiClient_OnLastTimeBar(object sender, TimeBarArgs e)
|
||||
{
|
||||
if (_isStarted)
|
||||
Raised?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void Start() => SetIsStarted(true);
|
||||
public void Stop() => SetIsStarted(false);
|
||||
private void SetIsStarted(bool value)
|
||||
{
|
||||
if (value != _isStarted)
|
||||
@@ -39,5 +63,6 @@ namespace MtApi.Monitors.Triggers
|
||||
_apiClient.OnLastTimeBar -= _apiClient_OnLastTimeBar;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user