Add explorer context menu while WPF app is running

173 views Asked by At

I have a WPF application that uses the API from another Console application project to conduct various file manipulation operations. I also have a SharpShell extension to provide me with a context menu option to run a method from the Console application whenever it is clicked.

My problem is that the SharpShell extension cannot run certain important methods from my Console application. I believe this is because the extension is currently running independently of my forms application.

I would like the context menu for all files (in explorer) to only appear while the WPF app is running/minimized to tray. This way, I'm hoping the context menu extension will have access to the object instances and methods it needs to execute from the Console application.

To give you a better idea of what my directory structure looks like:

--

Console Project

  • Exposed API

Forms Project

  • Form UI Stuff
  • Form UI Actions
    • Use of 'Exposed API'

SharpShell Extension Class Library Project

  • Context Menu Extension
    • Use of 'Exposed API' [Fails here]

--

Is there any way to "attach" my context menu extension to the WPF app? Is there a way to do this just through the WPF app and without SharpShell?

If not, how can I access and call methods in the currently running WPF application from the SharpShell extension without re-running the WPF app executable?

1

There are 1 answers

0
Sid G. On

Figured it out. Turns out this is easily achieved by making another process to handle the application-specific methods and what not needed to be run by the SharpShell context menu, and starting that as a separate exe file with arguments from the context menu extension.