I plan on using something similar to this to detect when a device is plugged in. In short, it looks like I need to override WndProc
.
Upon detecting the correct device, I want to add the files on the device to my application. The application has a "workspace" structure similar to VS. When the device is detected, I will add an ITreeView
to my Workspace, and populate all of that child's children with the file names on the device.
The problem is, I'm not sure where to put this in my WPF MVVM application since OnSourceInitialized
has to make a call to the base
Window. Should I detect on a different thread with a hidden window? Should I just leave it in my MainWindow code-behind? Any suggestions are appreciated.