Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Windows 8 Development - First Look - CSharp

Ryan Joy
February 27, 2013

Windows 8 Development - First Look - CSharp

Ryan Joy

February 27, 2013
Tweet

More Decks by Ryan Joy

Other Decks in Technology

Transcript

  1. Launch your Windows 8 App in 30 days  Generation

    App  Online training and tips from insiders  Tele-support with a Windows 8 architect  Exclusive one-on-one WinRT and Windows UX design consultation  Sign up at http://rj.cx/app_in_30_days
  2. C++ ImageEncodingProperties^ imageProperties = ref new ImageEncodingProperties(); imageProperties->Subtype = "JPEG";

    imageProperties->Width = 320; imageProperties->Height = 240; auto opCapturePhoto = m_mediaCaptureMgr->CapturePhotoToStorageFileAsync(imageProperties, this->m_photoStorageFile); C# ImageEncodingProperties imageProperties = new ImageEncodingProperties(); imageProperties.Subtype = "JPEG"; imageProperties.Width = 320; imageProperties.Height = 240; await mediaCaptureMgr.CapturePhotoToStorageFileAsync(imageProperties, photoStorageFile); JavaScript var photoProperties = new Windows.Media.MediaProperties.ImageEncodingProperties(); photoProperties.subtype = "JPEG"; photoProperties.width = 320; photoProperties.height = 240; mediaCaptureMgr.capturePhotoToStorageFileAsync(photoProperties, photoStorage).then(…
  3. App gets 5s to handle suspend App is not notified

    before termination Apps are notified when they have been resumed User Launches App Splash screen
  4. Paid downloads, trials, and in-app purchases. You keep 70% of

    the first $25k, 80% of the rest Microsoft Confidential 33 Robust analytics for free, including demographics, reviews, referrals, and usage & performance statistics Use your own commerce engine and keep 100% or use the Windows Store’s full commerce platform The Windows Store Advertise with Microsoft Advertising or your preferred ad vendor.
  5. Launch your Windows 8 App in 30 days  Generation

    App  Online training and tips from insiders  Tele-support with a Windows 8 architect  Exclusive one-on-one WinRT and Windows UX design consultation  Sign up at http://rj.cx/app_in_30_days
  6. DllImport "avicap32.dll" "capCreateCaptureWindow" static extern int string int int int

    int int int int DllImport "avicap32.dll" static extern bool int MarshalAs UnmanagedType ref string int MarshalAs UnmanagedType ref string int // more and more of the same
  7. using Windows.Storage; using System; using System.IO; using System.Threading.Tasks; class Sample

    { static async Task WriteAsync(StorageFolder wrtfolder, string filename, string text) { var wrtFile = await wrtFolder.CreateFileAsync(filename); var wrtStream = await wrtFile.OpenAsync(FileAccessMode.ReadWrite); using (Stream stream = wrtStream.OpenWrite()) { using (var writer = new StreamWriter(stream)) { writer.WriteLine(text); } } } } native type native method managed type returned from a seemingly native method managed argument passed to native API native namespace C# feature
  8. Windows Runtime Types Mapped Types Interop Helpers 99% of Windows*

    namespaces Int32, String, Boolean, IEnumerable<T>, IList<T>, Uri, etc. IBuffer / Byte[] IAsync* / Task* InputStream, OutputStream, Managed Types Tuple, List<T>, XDocument, DataContract, etc.
  9. FileOpenPicker picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*"); StorageFile file = await

    picker.PickSingleFileAsync(); Windows.Storage.Streams.IInputStream inputStream = await file.OpenReadAsync(); System.IO.Stream stream = inputStream.AsStreamForRead(); System.IO.StreamReader reader = new StreamReader(stream); string contents = reader.ReadToEnd();
  10. // Windows.Storage.winmd (Windows Runtime API) public sealed class StorageFolder {

    public StorageFileViewOperation GetFilesAsync(); … }
  11. // Windows.Storage.winmd (Windows Runtime API) public sealed class StorageFolder {

    public StorageFileViewOperation GetFilesAsync(); … } // Your code IReadOnlyList<IStorageFile> files = await folder.GetFilesAsync();
  12. // Windows.Storage.winmd (Windows Runtime API) public sealed class StorageFolder {

    public StorageFileViewOperation GetFilesAsync(); … } // Your code IReadOnlyList<IStorageFile> files = await folder.GetFilesAsync(); // Compiler Generates awaiter = WindowsRuntimeSystemExtensions.GetAwaiter<IReadOnlyList<IStorageFile>>(this.folder.GetFilesAsync());
  13. // Windows.Storage.winmd (Windows Runtime API) public sealed class StorageFolder {

    public StorageFileViewOperation GetFilesAsync(); … } // Your code IReadOnlyList<IStorageFile> files = await folder.GetFilesAsync(); // Compiler Generates awaiter = WindowsRuntimeSystemExtensions.GetAwaiter<IReadOnlyList<IStorageFile>>(this.folder.GetFilesAsync()); // System.Runtime.WindowsRuntime.dll (.NET API) public static class WindowsRuntimeSystemExtensions { public TaskAwaiter<TResult> GetAwaiter<TResult>(this IAsyncOperation<TResult> source); … }
  14. Launch your Windows 8 App in 30 days  Generation

    App  Online training and tips from insiders  Tele-support with a Windows 8 architect  Exclusive one-on-one WinRT and Windows UX design consultation  Sign up at http://rj.cx/app_in_30_days
  15. • Windows 8 Camp in a Box - Includes more

    presentations and labs http://rj.cx/windows8campinabox • SDK Samples!!! - A TON of samples for http://j.mp/Visual-Studio-Express-2012 • Design resources http://rj.cx/sara_win8design
  16.  With Over 630 Million Licenses in 200+ Countries, Windows

    Has Unrivaled Global Reach  Windows 8 Represents the Single Biggest Developer Opportunity for Any Platform  In order for your app to be available for the holiday rush, you need to get ready now!  Hundreds of Thousands of Developers Recognize the Opportunity, but…  Only Some Will Have the Advantage of These Programs
  17. Launch your Windows 8 App in 30 days  Generation

    App  Online training and tips from insiders  Tele-support with a Windows 8 architect  Exclusive one-on-one WinRT and Windows UX design consultation  Sign up at http://rj.cx/app_in_30_days
  18. Use Azure for your Windows Apps Sign up for your

    FREE 90 Day Azure trial http://aka.ms/TheCloud http://chriskoenig.net/azure