05-07-2012 05:03 PM
I have a LabVIEW app that decodes and then post-processes a file extracted from a camera. The file contains boot and history data that the user may want to save and/or print.
I need to convert this app to a thin-client since half of users run on Mac and the other half on PC's.
The issues that I am having are:
(1) The file to be post-processed resides on the client machine running the Web UI and I need to transfer this file to the server for processing - how can I transfer the file from client to server?
(2) The user can select a boot log within the file to edit, save and/or print - within the PC I can just launch Notepad but is there an equivalent capability with Silverlight since the Web UI does not know which OS is running? Is it possible to save the file locally? Is it possible to send the file to the default local printer?
I know that Silverlight 3.0 allows use of a Save Dialog box, how can I get access to that functionality? None of the saves are without user interaction since they must request to save or print a file from the Web UI.
05-08-2012 11:55 AM
RG,
Please see this forum as it has good details covering alot of the file aspects you are looking for.
You could read the file on the server and pass it to the web ui client.
Printing is another story. If they are networked printers (assuming multiple) then you ask the user which printer to print to and then pass that information back to the server and have the server, full LabVIEW, send to the printer.
05-08-2012 12:17 PM
Thanks.
I had looked at that thread and it appears to only work moving files one way (to the server).
How can I save any files created locally on the client machine? I am not sure the thread addresses this issue.
05-08-2012 01:01 PM
1. Web UI Builder doesn't expose Silverlight's file open dialog right now. If you need to let the user be able to browse to a local file and upload it to the server. In order to do this with Web UI Builder, you'd probably need to make a hybrid HTML page (part Web UI Builder deployed application, part HTML forms). On the HTML side you could use a standard file upload form to get the file to the server. To access the file from a LabVIEW web service, this may help: http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/ws_post_form_upload/
2. Similarly, the file save dialog isn't exposed right now. However, you can write a web service that lets you access files from your LabVIEW server, and then sets the Content-Disposition header to trigger a file download. (GregR's responses in the thread Kyle linked should help with that.) In order to trigger the file download in UI Builder, you'd point the an instance of the Hyperlink Control's URL to that web service.
05-08-2012 02:40 PM
RG,
Sorry I misunderstood the path of your question. You could use the same method if the files were hosted again on the client computers using a http server.
Could you use a list box to display data, edit, and then the user can press a button to push it back to the server? Are you set on using notepad or another program to modify the files?
05-08-2012 02:58 PM
I meant to edit my post look into HTTP post command to gather the file since you'll know the path of the file when you save it to the computer.
05-08-2012 03:17 PM
Hi Kyle,
They are not editing the file just using notepad or equivalent to view it since files can be rather long. Notepad allowed for searching the file or even printing it out.
I can use a listbox for displaying but no easy way to search but I will live with that right now as long as I can implement a way to to save file locally so that user can open file and manipulate/view or print it.
05-08-2012 03:18 PM
Thanks Malcolm.
Let me see if I can get this implemented and see how it works.
It would be nice if the file dialog in Silverlight were exposed for use in Web UI. It would makes things a lot simpler
05-10-2012 05:07 PM
I tried the link to the other posts but unable to get the either IE or Firefox to prompt to save the file. I have tried under latest version of IE and Firefox.
It copies the file but I never get the prompt to Save the file ... The Content-Disposition from HTTP forums say this should work.
I have code snippet in HTML file I wrote that verifies the browser prompts for file to save.
05-11-2012 09:15 AM
RG,
Is it that your options in IE/Firefox are to automatically download the file?
In firefox go to options and under the general tab check to make sure it says prompt for each file download.