Search code examples
c#.netsilverlightelevated-privileges

Call managed code from Silverlight application


I have MyDotNet4.dll that user installs as application on machine. In my case this is components that will take care of interfacing with TWAIN scanner.

I also have my Silverlight application with elevated permissions (SL4 OOB or SL5 in/out of browser)

I want to somehow invoke methods of MyDotNet4.dll using Silverlight code. Is that possible? How? Any pointers or sample code?

My idea is to have Silverlight app and if user needs scanning - I will let him download and install real windows app and than I would like to somehow talk to this app from Silverlight.


Solution

  • Silverlight does have local messaging but that works only between two silverlight apps. See the following for LocalMessaging

    From this similar SO post: Communicating with a Silverlight 4 LocalMessageReceiver from a Desktop Application and this other thread here on the silverlight forums seems you're out of luck and you will have to implement your own communication scheme.

    I'm assuming your SL app needs to invoke the scanning app and get the image. You could run your scanning app like this and then have the app drop the picture in a know directory which your SL app can then pick.