Updated documentation of newly added classes

This commit is contained in:
m.bochmann
2020-10-13 15:52:55 +02:00
parent 739567d871
commit 724162f29d
6 changed files with 103 additions and 8 deletions
+27 -2
View File
@@ -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
}
}