你能用Silverlight以读/写模式打开用户指定的文件吗

发布于 2024-12-20 06:05:46 字数 467 浏览 1 评论 0原文

在保存和打开文件时,Silverlight 的某些行为出现了一些问题。

我们想要什么: 我们希望在 Silverlight 应用程序启动时提示用户打开文件。然后,我们从该文件中读取所有信息并使用它来设置应用程序的状态。我们还想响应用户单击“保存”并将所有状态更改写回原始文件。

我们尝试过的:

隔离存储:可以实现我们想要的功能,但我们遇到了太多问题,例如人们无法备份工作、擦除硬盘驱动器、使用不同的计算机(在同一 LAN 上)等。一般来说,我们的大多数用户都希望将其保存到指定位置,以便将他们的工作存储在网络驱动器或 USB 闪存盘上。

打开文件对话框:给我们一个只读流,当用户单击“保存”时,我们无法更新文件。

保存文件对话框:不允许我们读取文件的现有竞赛/覆盖所选文件。

提升信任模式:在浏览器中不起作用。本地安装不是一个选项,因为我们的用户不是其计算机的管理员。

有什么方法可以实现我们所忽视的目标吗?

I'm having some problems in Silverlight getting a certain behavior when it comes to saving and opening files.

What we'd like:
We'd like to prompt a user to open a file when the Silverlight application launches. We'd then read any information from this file and use it to set the state of our application. We'd also like to respond to a user clicking 'save' and write all of the changes in state back to that original file.

What we've tried:

Isolated storage: does what we'd like but we're having too many problems with people not being able to back up work, having hard drives wiped, using different computers (on the same LAN) etc. In general most of our users would like to save to a specified location so that they can store their work on a network drive or USB key.

Open File Dialogs: Give us a read only stream, we are not able to update the file when a user click save.

Save File Dialogs: Do not allow us to read the already existing contests of a file / over-write the files that are selected.

Elevated Trust Mode: Doesn't work inside a browser. Installing locally isn't an option because our users aren't administers of their machines.

Is there any way of accomplishing what we'd like that we're overlooking?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

讽刺将军 2024-12-27 06:05:46

简短的回答是:不。

然而,这里有一些涉及更改 UI 语义的想法,这可能会让用户更容易接受。

使用“导入/导出”代替应用程序状态的“打开/保存文件”。用户更有可能接受在 OpenFileDialog 中指定文件进行导入的需要,以及在 SaveFileDialog 中指定文件(尽管是同一文件)进行导出的需要。

正常的日常状态将存储在独立存储中,因此仅当用户想要将数据传输到另一台计算机时才调用导入/导出的需要。

另一种选择(可能除了上述之外)是在服务器上维护应用程序状态的副本。隔离存储中状态的更改也会转发到服务器。隔离存储变得更像是缓存。

当用户使用另一台机器时,将从服务器获取其应用程序的状态,并更新当前机器的独立存储中的副本。

The short answer is: no.

However here are some ideas which involve changing the UI semantics which may make things more acceptable to the users.

Instead of there being "Open/Save File" of the application state use "Import/Export". Users are more likely to accept the need to specify a file in a OpenFileDialog for import and to specify a file (albeit the same one) in SaveFileDialog for export.

The normal day to day state would be stored in Isolated Storage so the need to Import/Export is only invoked when the user wants to take their data to another machine.

Another option (probably in addition to the above) is to maintain a copy of the application state on the server. Changes to the state in isolated storage are also forwarded to the server. The isolated storage becomes more like a cache.

When the user uses another machine the state of their application is fetched from the server updating the copy in the isolated storage of the current machine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文