Wp7中,怎么实现数据长期存储?作者: 孟庆波 时间: 2012-3-7 15:26
http://topic.csdn.net/t/20020718/07/882679.html作者: 孟庆波 时间: 2012-3-7 15:31
刚才的发错呢。
我用的是将数据保存在文件中:
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO.IsolatedStorage;
using System.IO;
using System.Xml;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace NoteText
{
public class XmlMessage
{
//using System.Collections.Generic 对应list
//将对象写入xml文档中
public void WriteMessage(List<Item> itemslist)
{
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
string filePath = System.IO.Path.Combine("note", "note.xml");
if (!isoFile.DirectoryExists("note"))
{
isoFile.CreateDirectory("note");