How to take a photo in Windows Runtime

The post is about capturing a photo on WinRT devices (of course those with camera). The presented method uses MediaCapture class. Althought it was tested on Windows Phone 8.1 Runtime, it should also work fine on other devices.