c# - 如何使用 AsterNET、C# 发送操作?
问题描述
我正在使用 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”和最终“ExtensionStateCompleate”中
这将是异步的。
您应该设置事件侦听器并对其进行解析。
推荐阅读
- symfony - Symfony 返回响应,然后做繁重的工作
- android - 如何序列化 Intent 实例?
- c# - 为什么我的 RabbitMQ 消费者(看似)一次消费所有消息?
- python - 为什么项目不能部署在heroku上
- android - react-native-calendars 日历高度不变
- tfs - 升级/迁移后如何修复 TFS 分析数据库中的 TFS GUID 名称?
- javascript - 如何查看消息?节点.js
- reactjs - 成功 HTTP Post 请求后不显示模态
- aws-lambda - Lambda 打开 RDS 代理连接
- excel - 删除 Excel VBA 中收件人字段中的重复项