我正在使用AsterNET和C#,我需要获得所有扩展的状态,特别是Action:ExtensionStateList的结果,但库没有这个操作,我正在尝试创建它,但我无法获得它。我希望有人能指导我。附件是代码。
ResponseEvents re;
try
{
re = manager.SendEventGeneratingAction(new ExtensionStateListAction());
}
catch (EventTimeoutException e)
{
re = e.PartialResult;
}
foreach (ManagerEvent e in re.Events)
{
foreach (KeyValuePair<string, string> d in e.Attributes)
{
Console.WriteLine(e);
}
}
using System;
using AsterNET.Manager.Event;
namespace AsterNET.Manager.Action
{
public class ExtensionStateListAction : ManagerActionEvent
{
public override string Action
{
get { return "ExtensionStateList"; }
}
public override Type ActionCompleteEventClass()
{
return typeof (ExtensionStateListCompleteEvent);
}
}
}
namespace AsterNET.Manager.Event
{
public class ExtensionStateListCompleteEvent : ResponseEvent
{
private int listItems;
public int ListItems
{
get { return this.listItems; }
set { this.listItems = value; }
}
public ExtensionStateListCompleteEvent(ManagerConnection source)
: base(source)
{
}
}
}
此命令的结果将出现在一组事件"ExtensionState"和最终的"ExtensionStateComplete"中
它将是异步的。
您应该设置事件侦听器并解析它。