コード例 #1
0
		private void SaveHtml(string url, string html)
		{
            var invChars = System.IO.Path.GetInvalidFileNameChars();
            StringBuilder title = new StringBuilder();
			//we must filter pageTitle invalid fileName chars.
            for (int i = 0; i < pageTitle.Length; i++)
            {
                if(invChars.Contains(pageTitle[i])) continue;
                title.Append(pageTitle[i]);
            }

            var fileName = StorageKey.SavedPageFolder + title.ToString() + ".html";
			
            var file = StorageFileHelper.CreateFile(fileName);
            using (var writer = new System.IO.StreamWriter(file))
            {
                writer.Write(html);
            }

			var item = new SavedItem()
			{
				Title = pageTitle,
				Url = url,
                Path = fileName,
			};
			model.AddSaved(item);
		}
コード例 #2
0
		internal void AddSaved(SavedItem item)
		{
			DB.SavedItems.InsertOnSubmit(item);
			DB.SubmitChanges();
            _savedItems.Add(item);
		}
コード例 #3
0
 internal void DeleteSaved(SavedItem item)
 {
     DB.SavedItems.DeleteOnSubmit(item);
     DB.SubmitChanges();
     _savedItems.Remove(item);
 }