Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VB.NET
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
good
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
M.Mitwalli
  Permalink  
v2
Comments
Andy411 at 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 at 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 Week.am 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
0 BillWoodruff 314
1 Sergey Alexandrovich Kryukov 290
2 George Jonsson 274
3 CPallini 255
4 OriginalGriff 237
0 OriginalGriff 4,895
1 CPallini 4,010
2 Sergey Alexandrovich Kryukov 3,514
3 George Jonsson 2,826
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2014
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