Click here to Skip to main content
12,950,090 members (47,360 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have Developed a Windows Service
and a ServiceController
which shows in system Tray Icon.
which contains Sart/Stop options to Alter the state of
the Service.

Here I want to add a functionality in the menu like
setting .When user clicks the settings
a window opens to input some Time inputs
means 1 hour 2 hour or a Specific time Like 10Am or any.
when user clicks ok after enetring the value.

I want that in The App.config xml file the parameters should
pass there and changes the configuration File Accordingly.
How to achieve this.
Can this Be done
Please suggest some Idea.
Posted 4-Oct-12 3:41am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hi ,
Right click on your solution Choose Properties Then Settings now you can add your variable in app.config and to access this
using C#
string x = Properties.Settings.Default.Myvariable;

after you deploy your application go to set up file and modified it
Best Regards
Andy411 4-Oct-12 10:18am
IMO that is not what the OP wants.
I think, he wants that the controller app can change settings which are read by the service itself during start.
The controller app will write the user settings part of the app.config in the current user directory. But the service has no access to the app.config of the controller app. The service runs as a diferent user (normally SYSTEM).
Or am I wrong?

The service settings need to be in a place, where the service and the controller app both have access.
Karwa_Vivek 5-Oct-12 1:07am
Yes @Andy411 you are right.
I want to clear the Scenario more clear here
that when I am Installing the Windows Service.
The app.config File is placed in C drive under Program files
as Normally what haappens when we Install.

I have managed to read the app.config file using the External(Independent) service controller by hard Coding the Path of the app.config file. and fetched the service Interval value in a form . But Here Am struck as I am not getting any Idea to convert this value as 10am or any..My need is that to set the time such that service starts Daily or weekly at particular time or Day of the able to sart and stop the service from service control to but the Main problem is how to convert the service interval time to Day or particular time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,749
CHill60 3,380
Maciej Los 2,953
Jochen Arndt 1,935
ppolymorphe 1,820

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100