Skip to content
This repository has been archived by the owner on Jul 9, 2018. It is now read-only.

Commit

Permalink
Merge pull request #44 from Odonno/storageService
Browse files Browse the repository at this point in the history
docs(storage): add storage service documentation
  • Loading branch information
jasonshortphd authored Sep 29, 2016
2 parents 0cb6341 + 3310157 commit 79f89e7
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
2 changes: 1 addition & 1 deletion en-us/TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ lang: en-us
- [Streams]({{site.baseurl}}/{{page.lang}}/helpers/streams.htm)
- [VisualTreeExtensions]({{site.baseurl}}/{{page.lang}}/helpers/visualtreeextensions.htm)
- [WeakEventListener]({{site.baseurl}}/{{page.lang}}/helpers/weakeventlistener.htm)

- [Storage]({{site.baseurl}}/{{page.lang}}/helpers/storage.htm)

# Notifications

Expand Down
2 changes: 1 addition & 1 deletion en-us/codehelpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Click the links below to go directly to that namespace in the online API.
| [Streams]({{site.baseurl}}/{{page.lang}}/helpers/streams.htm) | Helpers for processing stream data from APPX or Internet |
| [VisualTreeExtensions]({{site.baseurl}}/{{page.lang}}/helpers/visualtreeextensions.htm) | Provides a collection of extensions methods for UI |
| [WeakEventListener]({{site.baseurl}}/{{page.lang}}/helpers/weakeventlistener.htm) | Allows the owner to be garbage collected if its only remaining link is an event handler |

| [Storage]({{site.baseurl}}/{{page.lang}}/helpers/storage.htm) | Helpers to save and retrieve generic objects easily, supports both local and roaming storage |

## Getting Started

Expand Down
54 changes: 54 additions & 0 deletions en-us/helpers/storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
permalink: /en-US/helpers/storage.htm
title: StorageService
description: Service that will help you handle storage of generic objects within UWP applications, both locally and across all devices (roaming)
keywords: windows, app, toolkit, UWP, helpers, storage, save, read, generic objects
layout: api
search.product: eADQiWindows 10XVcnh
lang: en-us
---

## StorageService

The StorageService is a service that will help you handle storage of generic objects within UWP applications, both locally and across all devices (roaming).

## Example

{% highlight csharp %}

var localStorageService = new LocalStorageService();
var roamingStorageService = new RoamingStorageService();

// Read and Save with simple objects
string keySimpleObject = "simple";
string result = localStorageService.Read<string>(keySimpleObject);
localStorageService.Save(keySimpleObject, 47);

// Read and Save with complex/large objects
string keyLargeObject = "large";
var result = localStorageService.ReadFileAsync<MyLargeObject>(keyLargeObject);

var o = new MyLargeObject
{
...
};
localStorageService.SaveFileAsync(keySimpleObject, o);

// Complex object
public class MyLargeObject
{
public string MyContent { get; set; }
public List<string> MyContents { get; set; }
public List<MyLargeObject> MyObjects { get; set; }
}

{% endhighlight %}

## Requirements (Windows 10 Device Family)

| [Device family](http://go.microsoft.com/fwlink/p/?LinkID=526370) | Universal, 10.0.10586.0 or higher |
| Namespace | Microsoft.Toolkit.Uwp |

## API
* [StorageService source code](https://github.com/Microsoft/UWPCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp/Helpers/Storage/StorageService.cs)
* [StorageService API documentation]({{site.baseurl}}/{{page.lang}}/api/Microsoft_Toolkit_Uwp_StorageService.htm)

0 comments on commit 79f89e7

Please sign in to comment.