Device event does not fire in Windows service

I created a Windows service that will interact with a punch. The service will connect to the machine and will retrieve data (for example, registered users, attendance logs ... etc) from the machine. These methods will work fine. There is an event that will fire when the user hits the machine. Therefore, I need to register and create an event with an event handler in the service. But in my ministry he does not work. I created a sample Windows Form application and wrote all the same procedures. The event will be fired in the form application. My question is:

Is there a difference in registering and creating an event handler for the Windows Service compared to the Windows Form Application?

Please help me.

 AxLxInterface.SocketInitialize();
 AxLxInterface.WorkIndex = 0;
 AxLxInterface.CardEvent += AxLxInterface_CardEvent;  //event registration(but won't fire
 AxLxInterface.SocketConnect(serverIp, serverPort);  //will connect successfully
 AxLxInterface.DateTimeRead();        //will give the machine date time
 AxLxInterface.PollingStart(000, 000);

Event handler

    public void AxLxInterface_CardEvent(object sender, _DLxInterfaceEvents_CardEventEvent e)
    {
    }
+4
2

, ActiveX. ActiveX STA , . , - WinForms.

Windows Service. , STA . / :

StaTaskScheduler STA

+1

; , , -.

, , , , - , OnStart, Interrupt() Monitor.Pulse() . .

0

Source: https://habr.com/ru/post/1543209/


All Articles