Settings Page (in work)

Fixing Web hosting in Azure
This commit is contained in:
2011-03-30 02:25:27 +03:00
parent 84642c37ad
commit 833083ca0e
21 changed files with 414 additions and 105 deletions
@@ -0,0 +1,55 @@
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.IO;
using System.IO.IsolatedStorage;
using Microsoft.Phone;
using System.Windows.Media.Imaging;
namespace MyFriendsAround.WP7.Utils
{
public class IsolatedStorageHelper
{
public static void SaveToLocalStorage(string imageFileName, string imageFolder, byte[] content)
{
if (content == null)
{
return;
}
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
if (!isoFile.DirectoryExists(imageFolder))
{
isoFile.CreateDirectory(imageFolder);
}
string filePath = Path.Combine(imageFolder, imageFileName);
using (var stream = isoFile.CreateFile(filePath))
{
stream.Write(content, 0, content.Length);
}
}
public static WriteableBitmap LoadFromLocalStorage(string imageFileName, string imageFolder)
{
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
if (!isoFile.DirectoryExists(imageFolder))
{
isoFile.CreateDirectory(imageFolder);
}
string filePath = Path.Combine(imageFolder, imageFileName);
using (var imageStream = isoFile.OpenFile(filePath, FileMode.Open, FileAccess.Read))
{
var imageSource = PictureDecoder.DecodeJpeg(imageStream);
return imageSource;
}
}
}
}