How should I code an event handler for my C # application for Windows Form?

I am currently developing a C # application for Windows Form, which I intend to allow it to interact with the server. The server will receive the wiring from the mobile application that I developed, and whenever the wiring is received, my Windows Form application should be notified and give me a notification.

eg. My mobile application sends a message to my server. As soon as my server receives the message, my windowmaker should display a new notification showing the contents of the received message.

The above scenario is just an example of what I intend to do with all of this. Any idea how I encode my C # application to get the information as above?

+4
source share
2 answers

You can implement the WCF service on your server. A Windows Form application can be your WCF service client.

What you might want is Duplex Service

They will work like this:

  • WCF service runs on your server
  • Windows Form connects to your server using Duplex Contract
  • Messages about the mobile application on the server
  • The WCF service is aware of this, and the use of the reverse channel notifies the WCF client
  • Your form application as well as WCF Client updates the user interface with a new message
+5
source

As an alternative to answer @parapura rajkumar, you can also explore the Message Queuing architecture , where messages sent back from a mobile application are displayed both on the server and on the Windows client.

Perhaps a little heavier, but certainly worthy of attention, especially if you suspect that the application may need to become complicated in the future ...

0
source

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


All Articles