0

I am writing a GUI to configure my service written in C#.NET 3.5, it edits an embedded SQLite database from which the service pulls its settings. The GUI is being developed in a seperate project and I am at the point where I would like to integrate them. It is my first time implementing someting like this and I am unsure how I go about it.

Do I simply place the GUI .exe file in the same directory (bin?) as the service and give it the location of the database?

marked
  • 589
  • 9
  • 24

1 Answers1

1

Yes, usually. You will however have to ask for elevation or you won't be able to write to the dbase. UAC prevents write access to the directories in c:\program files. Which is okayish, the user is after all tinkering with the configuration of a privileged service. And you probably need to stop and start the service to make the configuration change effective, something you can only do from a privileged program. Embed a manifest in gui.exe as explained in this post.

Pre-empting the next question: there is no standard Windows way to have to dbase in a location that's accessible to both the service and your gui without elevation. You'd have to write an installer that creates a directory that gives the gui app sufficient rights and allows the service to find the directory without relying on the user name.

Community
  • 1
  • 1
Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Thanks hans. Could you explain a bit more about the rest of the files? In my GUI directory I have bin, gtk-gui, the classes, a pibd (?) file etc... should I put my entire GUI project folder in the bin folder of the service? Or perhaps the other way around? Also, if possible can you tell me if there is a cross-platform solution, the code is written for .net/mono and is intended to be portable. – marked Aug 07 '11 at 23:37
  • You forgot to tag your question with [mono]. I wouldn't have posted if you did. – Hans Passant Aug 07 '11 at 23:46
  • oh, apologies, I will investigate further regarding mono. Putting mono aside though, is it not enough to house the GUI within the program directory and provide it a relative path i.e. /project/bin/dbase.s3db Is the GUI not insulated within? – marked Aug 08 '11 at 00:08