I have a WPF application that gets installed on the client machine through the Windows Installer. This app is a file extension (. Xyz) also registers, so when the user double clicks, it opens my WPF application and displays the file (like Microsoft Word). This program also has a ton of files that are not marked as resource or content files (user manual, part drawings, etc.).
The problem occurs when the user double-clicks the .xyz file and it opens the WPF application. The app is now a working directory of the directory where the .xyz file is located. Now the program does not need any files (user manual, part drawing, etc.).
What is the best way to handle this type of problem? I can set the work directory (Environment.CurrentDirectory), but when the user saves or opens the .xyz file, my open file dialog box changes the working directory. I could use a pack uri for the part picture, but I use the process. Start for user manual because they are PDF I tried to search but did not come with anyting.
You can use your reflection to search the directory of the executable directory or to find the directory of the essay. :
By finding the executable, you can add reference to Windows.Forms to make this work (not a valid not ideal):
using system.IO; Using System.Windows.Forms; String appath = path.gate directoryname (application.executionablePath);
Use of reflection:
using System.IO; Using the system. String path = path.gate directory name (assembly gateassambad (typef (mackle)). Codebase;
or
string path = system Refining Assembly. Get Acceding Assembled () place;
You can probably just cache the load on your app, because it will not change anything.
Comments
Post a Comment