Game Development Reference
In-Depth Information
Here is the code for the specific tool logic:
using ObjectDefinitions;
using ObjectProcessing;
using AlertObjectToolInterface;
[Guid(“F6D5AB09-E2C1-4ff3-B023-01A94CC7C276”)]
[ClassInterface(ClassInterfaceType.AutoDual)]
[ProgId(“AlertObjectTool.AlertObjectToolLogic”)]
public class AlertObjectToolLogic : MarshalByRefObject, IAlertObjectToolLogic
{
public string GetFirstAlertObjectName()
{
SimpleObject simpleObject = new SimpleObject(“Test1”);
return Library.FormatOutput(simpleObject);
}
public string GetSecondAlertObjectName()
{
SimpleObject simpleObject = new SimpleObject(“Test2”);
return Library.FormatOutput(simpleObject);
}
public string GetThirdAlertObjectName()
{
SimpleObject simpleObject = new SimpleObject(“Test3”);
return Library.FormatOutput(simpleObject);
}
[ComVisible(false)]
public override object InitializeLifetimeService()
{
return null;
}
}
For remoting support, you will notice that the class inherits from MarshalByRefObject ,
which is important because doing so allows remoting to create a proxy object out
of this object to pass to clients. Also, you will notice the method InitializeLifetime
Service , which allows us to explicitly handle the lifetime of proxy objects. By returning
null, we are telling remoting services to keep the allocated object in memory indef-
initely until explicitly told to release it. Be aware of the ComVisible(false) attribute
that is set on the method, so as to not be exported with the COM interface.
Search Nedrilad ::




Custom Search