This commit is contained in:
Paul Betts 2013-09-27 12:35:42 -07:00
Родитель 36541c1eea
Коммит dae033d06b
1 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -23,6 +23,50 @@ Splat currently supports:
additional extension methods to make using them easier.
* A way to detect whether you're in a Unit Test runner / Design Mode
### Cross-platform Image Loading
```cs
//
// Load an Image
// This code even works in a Portable Library
//
var wc = new WebClient();
var imageBytes = await wc.DownloadDataTaskAsync("http://octodex.github.com/images/Professortocat_v2.png");
ProfileImage = await BitmapLoader.Current.Load(imageBytes, null /* Use original width */, null /* Use original height */);
```
Then later, in your View:
```
ImageView.Source = ViewModel.ProfileImage.ToNative();
```
### Using Cross-Platform Colors and Geometry
```cs
// This System.Drawing class works, even on WinRT or WP8 where it's not supposed to exist
// Also, this works in a Portable Library, in your ViewModel
ProfileBackgroundAccentColor = new Color(255, 255, 255, 255);
```
Later, in the view, we can use it:
```
ImageView.Background = ViewModel.ProfileBackgroundAccentColor.ToNativeBrush();
```
### Detecting whether you're in a unit test runner
```cs
// If true, we are running unit tests
ModeDetector.InUnitTestRunner();
// If true, we are running inside Blend, so don't do anything
ModeDetector.InDesignMode();
```
### How do I install?
[Always Be NuGetting](https://nuget.org/packages/Splat/). Package contains binaries for: