mirror of
https://github.com/farcasclaudiu/myfriendsaround.git
synced 2026-06-29 13:02:05 +03:00
Settings Page (in work)
Fixing Web hosting in Azure
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user