Instead of Control Panel Applet

G

Grok

My C# application is a Windows Service. I have two problems that I
would like to solve in the correct way using C#.NET.

1) There are a number of user settings which I'd like to store in an
XML file. I read these settings each time the service does some work,
then close the file. Should I use the Configuration class to read
this file from my service code?

2) I'd like to give the users a control panel application to change
the settings in a GUI. Well, not an old unmanaged .cpl, but whatever
we're "supposed to" be using now in .NET applications. Is there some
new psuedo-cpl hosting container in .NET that takes the place of what
Control Panel did? If not, how are people providing GUIs for their
users to change service settings?

TIA, Grok
 
N

Nicholas Paldino [.NET/C# MVP]

Grok,

1) Yes, you should. You should create a custom configuration section
handler if you have some complex data structures that you need to store,
otherwise, you can just add the values you need to the config file for the
executable.

2) There isn't a way to do this from .NET. You can not export functions
from a DLL in .NET, which is what a control panel applet needs. You could
create an unmanaged DLL in an unmanaged language, and then call into a .NET
assembly though.
 
G

Grok

Grok,

2) There isn't a way to do this from .NET. You can not export functions
from a DLL in .NET, which is what a control panel applet needs. You could
create an unmanaged DLL in an unmanaged language, and then call into a .NET
assembly though.

(I accept that control panel is 'out', and only brought it up as an
example)

Given that, what are people doing in .NET to create user GUI to change
settings for a service? Surely, writing a service and then providing
GUI access to its configurable values is not uncommon.

I'm hesitant to write a simple windows app that will show up on their
start menu as more clutter. Is there another container? Just want to
do the right thing and conform to how the community is doing it.
 
N

Nicholas Paldino [.NET/C# MVP]

Grok,

Well, you could create a Microsoft Management Console snap in and then
modify the settings from there. Changing the settings for the config file
doesn't warrant an MMC plug in, IMO, as those plug-ins are meant to really
show more real-time information. If you want to do that, then you will have
to create a remoting endpoing of some kind in your service (using remoting,
WCF, or some other technology/protocol) and then communicate with it from
your plug-in/stand alone program.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top