0

I've created a service, that continuously resets the Lock-screen wallpaper, if it has been changed.

But as this is my first time creating a service, I've hard-coded everything, the path, the intervals in which the service looks if the wallpaper has changed (I'm using the Registry-Entry). Now I thought of something like a settings-app in WPF, where I can change the image that gets set by the service as lock-screen, or the interval (currently 5 seconds).

But then I thought how I could store the settings. If I change a setting, the service needs to take it, so I need to reboot it if I use a text file, I could also use a database, but that's a bit too much work, for just a service with 2-3 settings.

And please don't mark this as opinion-based, it's a legit question

DudeWhoWantsToLearn
  • 751
  • 2
  • 10
  • 29
  • Why do you have to reboot it with a text file? Also using an XML instead of DB or a json file or are those not viable due to them being files on disk? – Peter B Jan 21 '20 at 07:24
  • Multiple programs can access a database, while with a normal file i'd get an IOException, cause the file might be in use – DudeWhoWantsToLearn Jan 21 '20 at 07:26
  • 1
    It will be in use extremely shortly - only when you change the settings. Multiple simultaneous read accesses are not a problem. Just handle the case that the access is blocked and try again a few seconds later. – germi Jan 21 '20 at 07:32
  • Does this answer your question? [Notification when a file changes?](https://stackoverflow.com/questions/721714/notification-when-a-file-changes) – oleksa Jan 21 '20 at 08:54
  • I don't see why you will need to restart to get up to date configuration. But maybe you simply want to restart the service? Or it might be a Shelduler vs Service issue? – xdtTransform Jan 21 '20 at 15:55

0 Answers0