What are the alternative persistence mechanisms for persisting some lightweight data in a Windows Phone application being written in C#? (can a XML file be used?)
This application targets both WP7 and WP8. Links to samples for the provided alternatives would be appreciated.
There are a couple options:
Put an XML file in the local storage folder of your app
If it is Key-Value pairs, use ApplicationData.Current.LocalSettings to store it.
Related
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.
Does anyone know of a good database or NoSql engine for Windows Phone 8 that can be used by my app?
I need to be able to open a read-only database file from the SD card. It needs to be able to cope with storing blobs (png images) as I want to use it to provide map tiles for offline use. 100,000's of image tiles will need to be stored in the database.
I've experimented with SQLite for Windows Phone via C# wrappers, but I don't seem to be able to get it to work with a database file located on the SD card.
There are limitations with Windows Phone apps accessing files located on an SD card, but it is possible:
http://msdn.microsoft.com/library/windowsphone/develop/jj720573%28v=vs.105%29.aspx
Feedback from a Microsoft employee regarding my difficulties with SQLite:
Windows Phone apps can read specific file types from the SD card using
the Microsoft.Phone.Storage APIs.
I expect that the SQLite implementation for the phone tries to open
the database using standard C file API rather than using the Storage
objects and so requires that the database be in the Xap or isolated
storage and cannot access a database on the SD card (this is
definitely the case for SQLite for Windows Store apps).
Feedback from SQLite SDK community:
Apparently it should be fairly straight forward to add support to the SQLite SDK for someone with some C++ skills (mine are a bit rusty!):
Replies:
http://www.mail-archive.com/sqlite-users#sqlite.org/msg81059.html
http://www.mail-archive.com/sqlite-users#sqlite.org/msg81060.html
To my original question:
http://www.mail-archive.com/sqlite-users#sqlite.org/msg81055.html
From your comments, it sounds like a very different approach would work better.
Your requirements seem to be that the end user is the one responsible for putting the data on the card using their desktop/laptop. Then plugging the card into the phone.
If that's the case then it seems the best solution would be to provide a regular desktop app that grabs the images in a zip file then performs an unzip operation onto the destination card. Essentially, the app takes care of the operation.
If you need any meta data about those images, then a json or xml file should be included.
This should be far simpler than dealing with a database on a read only SD card.
The solution that worked for me was to take OpenMCDF and adapt it to work on Windows Phone 8. I've made the adapted OpenMCDF-wp8 solution available on GitHub: https://github.com/gavinharriss/OpenMCDF-wp8
I've also made my workaround to the Windows Phone 8 bug that prevents Seek() from working correctly with the Stream returned from the ExternalStorageFile class: https://github.com/gavinharriss/ExternalStorageFileWrapper-wp8
I'am programming a Windows 8 Store App (Metro Design) with C# and XAML using Visual Studio 2012. There is no need for a database server with multi user support etc.my application is like reminder and contact notes application which have to remember date and time, I want to store my data in a local database and don't know which database is suitable for my needs. Maybe xml? Or are there solutions!
if i go for using xml then ,
how can i create data fields in xml ?
how can i import xml data in c# xaml UI ?
can someone please explain me with example ??
You can use SQLite or XML for storing data, just Google it you will find a lot of tutorials
SQLite
Using SQLite in a Windows Store App
Sqlite For Windows 8 Metro/Winrt Apps
Using SQLite and sqlite-net in a Windows Store App
Tim Heuer Blog : Tagged - sqlite
qmatteoq.com : Tagged - SQLite
XML
Using the Documents Library as a database in Windows 8 Store apps
Example Metro app /WinRT: Serializing and deseralizing objects using XMLSerializer to StorageFile and LocalFolder using generics and async/await threading
I have two sound files that I need to merge. One is an audio file and the other is a recording file.
I am using c# to build a Metro Style App. Is there any libraries or any functionality in .net I can use to complete this?
Take a look to NAudio, I don't know if they have a version for Windows store apps.
An option could be to write .net web service that uses NAudio to do the job of merging the audio files and send it back to your app.
I am trying to read/write to a word (.docx) in a W8 metro app. For normal .NET Applications there are many libraries, but non of them are avaliable for Windows Store apps (e.g. Open XML SDK 2.5 is not supported in RT Apps).
The only way, it might work is via the xml document using Windows.Data.Xml.Dom which is going to be a lot of work. Has anyone accessed word documents with the Windows.Data.Xml.Dom (or any other library) and would like to share his code?
I don't have any first hand experience, but I'd take a look at the following two alternatives before falling back to raw XML processing:
Your best bet could be DocIO from Syncfusion. It's not free but the price is really reasonable considering how much work it could save you. And there's even a free beta available.
Chris Klug created a simple OpenXML library for Silverlight. You could check if it does what you need and then try porting it to WinRT since the source is available.