How to automatically export data from silverlight to local disk
I am running unit testing in silverlight. I have the test data and I need to export it to local disk without user interaction.
I have thinked to export a file but it seems that it requires user interaction. I thought I could try a local process that listens for silverlight data on a connection, which saves the data automatically, but didnt find if it is possible and how.
Can anyone help me on how to automatically export data f开发者_开发百科rom silverlight to local disk?
Checkout the answer on this SO question. It shows how to access the local file system, however it does require user interaction.
I would just add a page to the web app that is hosting the silverlight plugin that allows you to store the data locally. You can the post your data and have your backend (asp.net I suppose) store the data locally. If you already use WCF to comunicate with your backend, you can use that instead.
I have solved with a local server, it provide http web server, policy server and a socket listener.
The server run and: - listen as http server for silverlight page requests. - listen on a local port for silverlight test results encoded as xml - listen on another port as a policy server, because silverlight need it to connect on a socket
Next the server starts internet explorer pointing to his own web server, at unit test page,
When the tests are finished I get the test result data structure in silverlight, open the connection to the local server (validated by the policy server) and send to it the result encoded in a string.
The server have full access to local file system, so it can silently produce output.
精彩评论