Hello everybody
The following code is a DLL in which I am trying to subscribe to the OpsTmedEvent event automatically, but I have not succeeded unless I call the MyExtensionTest method from a button. I appreciate if someone can help me by indicating how I can make the subscription be done without any button being used, that is, that the OpsTmedEvent method listens since Simphony loads. Thank you.
The following code is a DLL in which I am trying to subscribe to the OpsTmedEvent event automatically, but I have not succeeded unless I call the MyExtensionTest method from a button. I appreciate if someone can help me by indicating how I can make the subscription be done without any button being used, that is, that the OpsTmedEvent method listens since Simphony loads. Thank you.
Code:
using System;
using System.Text;
using Micros.Ops;
using Micros.Ops.Extensibility;
using Micros.PosCore.Extensibility;
using Micros.PosCore.Extensibility.Ops;
namespace Test_Simphony
{
public class TestSimphony : OpsExtensibilityApplication
{
public TestSimphony(IExecutionContext context) : base(context)
{
this.OpsTmedEvent += OnTmedEvent;
}
[ExtensibilityMethod]
public void MyExtensionTest()
{
OpsContext.ShowMessage(string.Format("Hello World from {0}", this.ApplicationName));
}
private EventProcessingInstruction OnTmedEvent(object sender, OpsTmedEventArgs args)
{
try
{
OpsContext.ShowMessage("OnTmedEvent");
return (EventProcessingInstruction)0;
}
catch
{
return (EventProcessingInstruction)1;
}
}
}
public class ApplicationFactory : IExtensibilityAssemblyFactory
{
public ExtensibilityAssemblyBase Create(IExecutionContext context)
{
return new TestSimphony(context);
}
public void Destroy(ExtensibilityAssemblyBase app)
{
app.Destroy();
}
}
}