📄 agentdomainproxy.cs
字号:
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Threading;
namespace MobileAgents
{
/// <summary>
/// The AgentDomainProxy class is essentially the interface between
/// an agent application domain and the host application domain. It is
/// through this class that the host injects agents into this app domain.
/// </summary>
internal class AgentDomainProxy : MarshalByRefObject
{
/// <summary>
/// Hosts the agent given by queueing it with the thread pool
/// </summary>
/// <param name="a">The agent to host.</param>
public void HostAgent(Agent a)
{
//Use the CLR thread pool to launch this guy!
ThreadPool.QueueUserWorkItem(new WaitCallback(RunAgent), a);
}
/// <summary>
/// The WaitCallback delegate method for the ThreadPool.
/// This method actually runs the agent.
/// </summary>
/// <param name="context"></param>
private void RunAgent(object context)
{
Agent a = context as Agent;
a.Run();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -