I've created a managing application. On of the things my application does, is register on a plugin which can detect whenever or not a fingerprint reader gets plugged in or plugged out. The class subscribes on the event like such:
//Subscribe to the plug, unplug and imageAcquired events from the GrFingerXCtrlClass library.
FingerXCtrlClass.SensorPlug += ReaderPlug;
FingerXCtrlClass.SensorUnplug += ReaderUnplug;
FingerXCtrlClass.ImageAcquired += ImageAcquired;
First when I was actively working on the program, I've developed a WPF application. Through this application I could see some of the lists and switch some settings so I am sure my service works well. In this WPF application, I've created my service by instantiating it:
ProjectServiceLogic logic = new ProjectServiceLogic();
Now I've created an installer. Thus I had a ProjectService-class, initializing the application. This is being done like so:
protected override void OnStart(string[] args)
{
log.Debug("Starting service...");
_worker = new Thread(new ThreadStart(StartService));
_worker.IsBackground = true;
_worker.Name = "ServiceThread";
_worker.SetApartmentState(ApartmentState.STA);
_worker.Start();
log.Debug("Successfully started service");
}
void StartService()
{
serviceLogic = new ProjectServiceLogic();
while (!_shutdownEvent.WaitOne(0))
{
}
}
The program gets installed and the service starts. When debugging the service, I notice the subscribing code gets executed. However, the events are not triggered when I plug in a device while it does trigger when running it locally through the WPF application, instantiating the service logic. Why doesn't it work now?