windows universal apps
DESCRIPTION
Gives an introduction to the new Universal App template in Visual Studio to build both Windows 8 and Windows Phone apps with minimal code.TRANSCRIPT
WINDOWS UNIVERSAL APPS
JAMES QUICK
MICROSOFT TECHNICAL EVANGELIST
@JQUICKWIT
MEETUP: MIAMI FT-LAUDERDALE WINDOWS APP DEVELOPERS
HTTP://BLOGS.MSDN.COM/QUICK_THOUGHTS/
WHAT’S NEW FROM BUILD
• Windows Phone and Windows 8 Stores get even closer
• Unified windows apps
• Windows 8.1 update 1
• Windows Phone 8.1
• Currently in developer preview
• WINDOWS UNIVERSAL APPS
• Visual Studio Update
WINDOWS UNIVERSAL APPS
• Build app for both Windows and Windows Phone at the same time
• 3 projects- Windows, Windows Phone, Shared
• Talk more soon!
UNIFIED WINDOWS APPS
• Develop W8 and WP8 app with Universal Apps
• Choose to let user download an app once, and get it on both platforms
• Free or paid
• New Unified Windows Apps symbol
WINDOWS PHONE 8.1
• Save apps to memory card
• Automatic updates
• Cortana
• Notification center
• Swype text
• Updated store UI
WINDOWS PHONE 8.1 FROM DEV PERSPECTIVE
• Faster approval times
• Days to hours
• Automatic updates
• Discoverability of apps
• Save apps to memory card
• New APIs (including Cortana)
WINDOWS 8.1 UPDATE 1
• Pin modern apps to the task bar
• Minimize and close buttons for modern apps
• Store app is prepinned to task bar
• Easier to find apps now
• Remodeled Store UI
• Discoverability of apps
FOR DEVS
• Faster approval times after submitting apps
• Universal App template to build for both platforms
• Merged both of the store agreements
• Optimized pubcenter dashboard for ads
• Allow developers to respond to user reviews (in beta)
• Charge per app or per device
UNIVERSAL APPS- GETTING STARTED
• Download vs 2013 update 2 RC
• http://bit.ly/VS2013Update2
• Includes phone 8.1 emulators
• Install Windows Phone 8.1 OS Preview
• Good for testing on physical device
UNIVERSAL APP TEMPALTES
• Blank
• Pretty straight forward
• Hub
• Similar to grid template in Windows 8
• Displayed as pivot control in Windows Phone
UNIVERSAL APPS SETUP
• Windows Store Project contains XAML pages and code that target Windows
• Windows Phone Project contains XAML pages and code that target Windows Phone
• Shared Project is a container for code that runs on both platforms
• Automatically included in both Windows and Windows Phone Projects
• No build output
LETS TAKE A LOOK…
DEBUG TARGET
• Dropdown menu to choose debug target
• Switch between targeting Windows 8 and Windows Phone
• Run both in emulators or on a device
ADD FILES TO SHARED FOLDER
• Add
• Movie class
• Styles
• Move
• Mainpage.xaml
• App.xaml is already in shared folder
• By default with universal app template
• Can be moved to shared folder when adding support for universal
CONTEXT SWITCHER
• If you use an API in shared code that’s not supported on both platforms, an error message will identify this API when you build the project. You don't have to build the project, however, to confirm that you’re using cross-platform APIs.
SAME FILE, BUT PLATFORM SPECIFIC APIS??
#IFDEF DIRECTIVE
• constants WINDOWS_APP and WINDOWS_PHONE_APP are conveniently predefined for you
• Have platform specific code for each
• If windows app, do this
• If windows phone app, do this
#IFDEF DIRECTIVE
• #if WINDOWS_APP if (!rootFrame.Navigate(typeof(HubPage)))#endif#if WINDOWS_PHONE_APP if (!rootFrame.Navigate(typeof(WindowsPhoneStartPage)))#endif { throw new Exception("Failed to create initial page"); }
NUGET PACKAGES
• Must be added to both Windows and Windows Phone projects if referenced in shared folder
• “if your Windows Store app contained an assembly reference for a third-party library, and you move the associated code into the Shared folder, then you also have to reference the third-party library in the Windows Phone project”
EXAMPLE WITH ROTTEN TOMATOES API
ADD SUPPORT FOR MISSING PLATFORM
• Example- add Windows Phone 8.1 to existing Windows 8.1 project
• Let’s take a look at our simple movie example
• Start with just windows 8.1