Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit IsolatedStorageFile relative path.
2 replies. Latest Post by BoloRamji on July 18, 2008.
(0)
thomasgoes
Member
31 points
40 Posts
07-18-2008 2:31 PM |
Is there a way I can get the IsolatedStorageFile relative path in a string? I mean the m_AppFilePath?
I don't know again what I am trying is possible or not. Here is what I want to achieve.
Say I create a Directory in IsolatedStorageFile as MyDir and create a xml file myXMLFile.xml, is it possible to do:
System.Windows.Browser;HtmlPage.Window.Navigate(new Uri( m_AppFilePath + " \\MyDir\\myXMLFile.xml", UriKind.Relative), "_blank");
So user can then browse to that file in a restricted Window browser that only gives oprtion to copy or save the xml file to his own filesystem when clicked on a <TextBlock Text="Save"> on MouseLeftButtonDown event?
IsolatedStorageFile Path is complicated path and will change based on the user. So I really want to see if I get that path and then use it to Navigate using Windows Browser that will hide the tool bar and navigation bar..so user can only see the content of the file and copy it
Thanks
Thomas
BoloRamji
338 points
49 Posts
07-18-2008 4:41 PM |
When you are using HtmlPage.Window.Navigate(xxx), are you not browsing the URI on the server right? But your IsoStorage is on the client. Then your command will be of no use. Now, what you could do is to use IsoStorage in Silverlight app itself instead of in your ASP script file.
String szYourXMLString = sw.ReadToEnd();
sw.Close();
getUserResult.Text = szYourXMLString ;
Now you can cut and paste the XML text to a notepad or something. here getUserResult is my TextBox with text wrapping=true.
Silverlight does not have a save file dialog box. Alternatively, you can save a file on the server and use the HyperlinkButton control to download it.
You need to store the data in the ISF and I am wondering how you could browse the folder to select the file. If say,
or something like that but you may already know that.
07-18-2008 7:05 PM |
There is a better way to do the browsing you want. Here is a nice sample example on msdn link:
http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile(VS.95).aspx
using (var store = IsolatedStorageFile.GetUserStoreForApplication()) {
//you can fill the list box with filesInSubDirs
You can show them in the list in silverlight for user to choose in the lay out you prefer and then follow the procedure provided in my response to open a selected file. Then you don't need a FileOpenDialog. FileOpenDialog does not show you the ISOStoragelocation as default and it is difficult to locate also.
let me know if you are successful in your task.