WP7 -- finding isolatedStorage files on my computer - c#

I am trying to use the C# class IsolatedStorageFile to write some data to a file in my app. This is using the simulator. I would like to look on my computer to see if it worked (i.e., look at the file in notepad). Where can I find that file?

The Isolated Storage is stored in the emulator, which is a virtual machine, and not directly on your harddrive. You'll have to code your own file viewer (e.g. from within your app, load the file from Isolated Storage and display the text using StreamReader).
I vaguely remember that the Mango toolkit (out in May) features an IsolatedStorage viewer built into the emulator, but I'm not sure what features it has.
You might be interested in this blog post. It explains how to export your file to your desktop.

You can download IsolatedStorageExplorer And use it to download file from IsolatedStorage to Computer.
Check out this Post and Answer given by Matt Lacey

Related

Windows Phone 8.0 - Access phone's local storage

Is there any API that enables me to access the phone's local storage files and folders ? I want to implement a file picker that displays the folders and files hierarchy just like they are in folder explorer:
Microsoft has released a free app called "Files" that does exactly what I want and more. Is it a special case or its possible for any developer?
Note: Im programming a WP8.0 app and not WP8.1. File Picker sample won't work for me! :)
There is no API in WP8 to list all the files in storage. In WP8 you can only access Audio and image files.
For more details refer this.

Copying video file from Project package to Isolated Storage during run-time

I require to play a short video in my WP8 application. Unfortunately, there is no API available for playback from MediaLibrary.
The only API I know of is as per this link:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394041(v=vs.105).aspx
The above method works only if the VideoFile is stored in Isolated Storage.
While I understand that I can upload files to Isolated Storage using some tools, I would rather prefer to package the Video file inside the xap, and then copy the file to Isolated Storage during run-time.
Can someone please guide me on copying a VideoFile included in Application project to Isolated Storage during run-time.
You can add a video as an app asset the same way as you add an image. Add video to your project and mark it as Content. The video will be packaged with the app in xap.
You accomplish this with the MediaElement control. Here is a great sample on how to use it. The basics is to add it to your xaml and set the source to a file that is has the build action set to content.
<MediaElement x:Name="VidoPlayer" Source="/Assests/MyVideo.wma" AutoPlay="True" Volume="1"/>
So as long as you have a file MyVideo.wma located in the Assests folder and the Build Action is set to Content, you're golden!

Save PDF file to isolated storage then launch - Windows phone

I have come to the stage in my app where I need to download a pdf file from a certain URL, save it to disk (on the phone that is), and then as soon as it's saved try and open the document in whatever application is installed on the phone to handle PDFs (Adobe reader).
I have a rather limited understanding of how to save to disk and launch a certain file with another application.
Can someone point me in the right direction or give me some tips on how to accomplish this?
My understanding of windows phone is quite limited and I need to quickly add this feature on the app.
In Windows Phone 7, it is not possible to programmatically start the PDF viewer (it's possible in Windows Phone 8 though). So the best I can suggest is using the WebBrowserTask to open the web browser directly at the PDF's URL, then let the user open the file.
It's definitely not a great user experience, but I've been unable to find any other way (even using a WebBrowser control directly in the app doesn't seem to work).
var task = new WebBrowserTask();
task.Uri = new Uri("http://www.education.gov.yk.ca/pdf/pdf-test.pdf");
task.Show();
Where you saved the PDF in Isolated Storage?
You directly opened the Online PDF file in WebBrowser.
Follow these steps:
1) Download the from URI
2) Save to the Isolation Storage
3) Launch it using the launcher.
Note: 1) If you are downloading the pdf file than use .pdf extension while storing in Isolation Storage.
2)Make sure you have the related software installed in your phone like Adobe for PDF etc.

Writing files to an Android in C#

I am writing a Windows Forms application in C#, and I want to copy files from a directory on my C:\ drive into the "Computer\SPH-D710\Phone\Music" directory on my Android phone. That music path I just copied and pasted from Windows Explorer to this post, but C# does not recognize it as a valid directory, probably because there is no "C:\" or the like.
What is a C# command that can write a file to an Android?
It appears your phone is connected as a MTP device (media transfer protocol). It is not as simple as a file system access (USB mass storage). Read these series of blogs on how to do it, its not a simple file copy.
https://learn.microsoft.com/en-us/archive/blogs/dimeby8/sending-mtp-commands-through-wpd-part-1-without-a-data-phase
https://learn.microsoft.com/en-us/archive/blogs/dimeby8/sending-mtp-commands-through-wpd-part-2-data-to-the-device
https://learn.microsoft.com/en-us/archive/blogs/dimeby8/sending-mtp-commands-through-wpd-part-3-data-from-device
Beware you will be diving into some unmanaged code for this.
The .NET libraries used to store files won't really care where they are saving the file. Your Android device is seen as a USB storage device (as long as USB storage is turned on from the phone's point of view!). I recommend that you put some of your C# code up so that we can potentially spot an error in the routine that you are running to actually save the file to the phone.
As a quick example - your C# code will likely want to look something like this:
string filePath = #"G:\Music\MySong.mp3";
System.IO.File.WriteAllBytes(filePath, mp3FileContent);

Open docx in Windows Phone 7 programmatically

I would like to develop an app for printing service in Windows Phone 7. In the app, the users can select file to print out. Is there any way to open docx, xlsx, etc. in WP7 programmatically? I know in iPhone the WebView supports to view many file types. Is there anything similar in WP7?
If you are looking to open the document in Office, try using the WebBrowserTask to navigate to the document. There's a good chance it will open with Office.
If you want to render the document yourself, you are very much out of luck. You could try navigating to the document in a WebBrowser control, but I don't think it's supported.
Besides, there are no printing APIs so there would be no way to print it. If this is an enterprise application (ie. internal to your company), you might consider writing a web service on a local server that can accept DOCX files and print them. You could then call that service from your app to print the docs.
You will not be able to open these types of files from the isolated storage. There is no way for third-party applications to launch the external application required for viewing these file types. All of the files which you have listed in your question are XML-based open source file formats. Depending on how much time you want to spend on this, you could write your own parser or possibly utilize an open-source or commercial one.

Categories