public static void RemoveTile(SpeedDialTile tile) { try { var tiles = settings.Values["SpeedDialTiles"]; var listTiles = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SpeedDialTile> >(tiles.ToString()); listTiles.Remove(listTiles.Where(p => p.DestinationUri == tile.DestinationUri).First()); settings.Values["SpeedDialTiles"] = Newtonsoft.Json.JsonConvert.SerializeObject(listTiles); } catch { } }
public static void AddTile(SpeedDialTile tile) { try { var tiles = settings.Values["SpeedDialTiles"]; var listTiles = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SpeedDialTile> >(tiles.ToString()); listTiles.Add(tile); settings.Values["SpeedDialTiles"] = Newtonsoft.Json.JsonConvert.SerializeObject(listTiles); } catch { } }
public async static void AddTile(InMemoryRandomAccessStream stream, Uri url, string Title) { Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder; string filename = string.Format("Thumb{0}.png", DateTime.Now.ToString("dMyyyyHmsffffff")); StorageFile file = await localFolder.CreateFileAsync(filename); var fileStream = await file.OpenAsync(FileAccessMode.ReadWrite); await RandomAccessStream.CopyAndCloseAsync(stream.GetInputStreamAt(0), fileStream.GetOutputStreamAt(0)); System.Diagnostics.Debug.WriteLine("foi/n/n"); SpeedDialTile tile = new SpeedDialTile(); tile.DestinationUri = url; tile.ImageSource = new Uri("ms-appdata:///local/" + filename); tile.Name = Title; AddTile(tile); }