Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement notification for windows app using .NET

I have to implement client server based app where client is windows app. Now, my plan is to create a webservice as a server app and use it in our client app. But the problem is in notification. For this, I need to add a timer to the client app to check for the notification. It slows down the client app.

What is the best approach to do this?

I need to create setup for both app. So, the solution must be deploy-able.

Edit: I can't put timer in background or seperate thread because I have to update datagridview immediately.

like image 754
Brij Avatar asked Mar 29 '26 19:03

Brij


1 Answers

Use a BackgroundWorker or the Threadpool.QueueUserWorkItem for your calls to the webservice, then update your GUI. Your app slows down because you are calling the webservice from the main UI thread so your application cannot handle other events until the webservice call is done, that includes repaint, resize, clicks...

See this document : http://msdn.microsoft.com/en-us/library/ms951089.aspx

You want to update immediately by calling a remote resource? I'm afraid that isn't possible unless we dump one of the laws of thermodynamics and allow for time travel.

BUT you can cheat and prefetch your data and bind it behind the scenes every XXX seconds.

Remember to use BeginUpdate and EndUpdate when updating your grid so you don't get any flicker.

like image 155
Florian Doyon Avatar answered Apr 02 '26 04:04

Florian Doyon