views:

53

answers:

2

I have an UI application that serves several functions (<800KB). I wanted to allow minimizing it to the system tray, and continue to decode data coming from the serial port and sending network messages.

Can I simply hide the main form and create a NotifyIcon in the system tray, or are there other considerations for system tray applications? Does the application use less resources while hidden? Or is it best to make a light version of the application for the system tray (with duplication of code)?

My application does what 2 different applications do (related functions). I'm trying to foresee the implications before I finish coding it.

+2  A: 

I've written a couple apps that use NotifyIcon. Putting it in the notification area (system tray) isn't anything special. It's just not visible on the toolbar anymore.

Nate
+1  A: 

IMO best way in your case is to make windows service that will decode data from serial port and send messages. And other winforms app that will only set preferences and watch service state, that one can go to tray. Maybe you don't really need this tray app, just windows service, you can set preferences trough config file and watch state trough EventLog.

Of course if is possible to run from windows service, eg. your serial port and network code doesn't need logged user or desktop.

Antonio Bakula
I need to look at what is required to program a Windows service, how to communicate with it from a WinForm, consume messages from another process, etc. In my application the serial data comes fragmented, so the main form gets the data fragments from the serial port instance, and sends them to the decoder instance, which reassembles them and decodes the data, which is sent back to the main form for displaying on screen, and is also sent to a network notifier instance (sends a string message).
OIO