asternet/Asterisk.2013/Asterisk.NET/Manager/ResponseEvents.cs

54 lines
1.4 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
2015-01-03 15:37:29 +00:00
using AsterNET.Manager.Event;
using AsterNET.Manager.Response;
2014-01-08 14:16:39 +00:00
namespace AsterNET.Manager
{
2015-01-03 15:37:29 +00:00
/// <summary>
/// Collection of ResponseEvent. Use in events generation actions.
/// </summary>
public class ResponseEvents
{
private readonly List<ResponseEvent> events;
2018-09-02 18:35:20 +00:00
/// <summary>
/// Creates a new <see cref="ResponseEvents"/>.
/// </summary>
2015-01-03 15:37:29 +00:00
public ResponseEvents()
{
events = new List<ResponseEvent>();
Complete = false;
}
2018-09-02 18:35:20 +00:00
/// <summary>
/// Gets or sets the response.
/// </summary>
2015-01-03 15:37:29 +00:00
public ManagerResponse Response { get; set; }
2018-09-02 18:35:20 +00:00
/// <summary>
/// Gets the list of events.
/// </summary>
2015-01-03 15:37:29 +00:00
public List<ResponseEvent> Events
{
get { return events; }
}
2015-01-03 15:37:29 +00:00
/// <summary>
2018-09-02 18:35:20 +00:00
/// Indicates if all events have been received.
2015-01-03 15:37:29 +00:00
/// </summary>
public bool Complete { get; set; }
2015-01-03 15:37:29 +00:00
/// <summary>
/// Adds a ResponseEvent that has been received.
/// </summary>
2018-09-02 18:35:20 +00:00
/// <param name="e"><see cref="ResponseEvent"/></param>
2015-01-03 15:37:29 +00:00
public void AddEvent(ResponseEvent e)
{
lock (((IList) events).SyncRoot)
{
events.Add(e);
}
}
}
}