Andrej Radinger Windows Phone Development MVP Mobendo d.o.o. Što je novo za developere u Windows Phone 8.1
Inspirirani ljudima. Section Divider
Inspirirani ljudima. Ugasite mobitele. Hvala.
- Introduction - UI & Controls - Page Navigation - Application Lifecycle - Tiles & Notifications - WinRT for WP developers - What is new in Silverlight Store & publishing Agenda
INTRO
Creating Projects in Visual Studio 2013
Anatomy of a Windows Phone Store App
UI & CONTROLS
Converged controls 80% exact same XAML 20% custom CommonSignature Optimized DatePicker TimePicker CommandBar Butto n CheckBo x RadioButto n ProgressBa r Slider ToggleSwitc h Hub Pivot ListView GridView SysTray
Text Handling Controls TextBlock Displays text Supports line breaks and word wrapping RichTextBlock Paragraphs, spans, and runs allow for formatting sections of the rich text TextBox Fully templatable Header property Supports spell-checking, placeholder text, text-prediction and input scope for on-screen keyboards, multi-line support PasswordBox Obscures text entry Supports placeholder text and templateable Header
Input scope
ProgressRing and ProgressBar Important! You must deactivate progress rings and progress bars when not visible. There’s a performance penalty if you do not.
DatePicker / TimePicker Same API on Windows and Windows Phone Appropriate UI for platform Allows restricting to individual segments (show only month/year for example)
Flyouts
Windows Phone System UI
Differences from Windows Top AppBar not supported AppBar not shown by a gesture Can still set Visibility = "Collapsed" to hide, but when visible, AppBar is not transient on Phone Equivalent to IsOpen="true" at all times On Windows, Top and Bottom AppBar is transient and considered user UI Can display AppBar minimized on Windows Phone Use Not supported on big Windows Converged XAML but certain properties/events ignored on Phone IsSticky property, used on Windows to disable the light-dismiss behaviour and keep AppBar visible Opened and Closed events, which on Windows fires when the AppBar displays/disappears AppBarSeparator not rendered on Windows Phone Used on Windows to render a separator bar onto the AppBar
Programming Status Bar
Progress Indicator in Status Bar
PAGE NAVIGATION
Windows, Frames and Pages Window Frame Page Window
Navigation Bar Back Key Standard Windows Phone UX is to use Back key to navigate back or close transient UI By default, Back key causes a navigation back to the previous App – not Page! In Windows Phone Store apps, you must include code to override this to cause a backwards navigation within the app Differs from Windows Phone Silverlight – within an app, backwards page navigation is default for that framework With correct Back key handling, pressing the Back key on the launch page suspends the current app and navigates back to previous app Differs from Windows Phone Silverlight – Closes the current app in that framework
Overriding the Back Key on a Page public sealed partial class SecondPage : Page {... protected override void OnNavigatedTo(NavigationEventArgs e) { Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed; } protected override void OnNavigatedFrom(NavigationEventArgs e) { Windows.Phone.UI.Input.HardwareButtons.BackPressed -= HardwareButtons_BackPressed; } async void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e) { e.Handled = true; // We've handled this button press // If the secondary UI is visible, hide it if (SecondaryUI.Visibility == Visibility.Visible ) { FadeOutSecondaryStoryboard.Begin(); } else { // Standard page backward navigation if (Frame.CanGoBack) Frame.GoBack(); }
Saving and Restoring Page State on Navigation Common scenario: User navigates to a Page that allows data entry. On first visit, the page is new, no data entered. The user interacts with the page, fills in some data. They navigate forward to another page for some purpose, then navigate back. They expect the page to be in the same state as when they left it. With NavigationCacheMode.Disabled, a new instance is created when navigating back – original page state is lost. With NavigationCacheMode.Enabled or Required, cached page is re-used so original page state is retained. But it’s also still there on a forward navigation to the same page type in the future. Page 1Page 2Page 3 new ?
Navigation overrides OnNavigatedTo Called when the user navigates to this page Load data, populate fields, wire-up event handlers, etc. OnNavigatedFrom Called when this page is no longer active in the frame, typically when a user navigates away Do any tear-down in this method
TILES & NOTIFICATIONS
WNS
MechanismScenarioExpiresWinRT API Local Update a tile immediately, while the app is running or from a background task Never TileUpdateManager tileUpdater.Update() Scheduled Update a tile once, at a specific date and time. E.g., tomorrow at 4pm 3 days TileUpdateManager tileUpdater.AddToSchedule() Periodic Update a tile by polling a remote URI on an interval. E.g., every 30 minutes 3 days TileUpdateManager tileUpdater.StartPeriodicUpdate() Push Update a tile immediately, by sending a push notification from your server -or- Send a Raw notification to wake a background task that triggers a tile update 3 daysPushNotificationChannelManager How can I send tile updates?
New Message Thomas Fennel Looking forward to your \\build\ talk next week New Message Thomas Fennel Looking forward to your \\build\ talk next week All update mechanisms use the same payload
Notifications Simulator Periodic polling Tile notification queue Expiration support Raw notifications can wake a background task More templates Brand new stuff for Phone
Choosing a notification platform ScenarioRecommendation You are creating a new Windows Phone Silverlight 8.1 appWNS / WinRT You are upgrading your Windows Phone Silverlight 8.0 app and want to add notifications for the first time WNS / WinRT You are upgrading your Windows Phone Silverlight 8.0 app and already using MPN notifications WNS / WinRT -or- MPN /.NET
Choosing a notification platform
WINDOWS RUNTIME FOR WINDOWS PHONE DEVELOPERS
Windows Phone History WP 7.0 Silverlight WP 7.5 Silverlight WP 8.0 Silverlight WP 8.1 Silverlight WP 8.1 WinRT
Existing Code Investment Existing Install Base Not yet converged Camera Lenses VoIP Lock Screen Wallpaper. Clipboard API Simple Sound Effects (XNA) Run Under Lock Screen Why stay on Windows Phone Silverlight?
Why Retarget to Windows Phone Silverlight 8.1
Why choose the Windows Runtime?
Asynchronous Programming async void Button_Click(object sender, EventArgs e) { var service = new WebService(); this.Data = await services.FetchDataAsync(); this.Flag = FlagStates.Green; }
// create folder // Windows.ApplicationModel.Package.Current.InstalledLocation; var folder = Windows.Storage.ApplicationData.Current.LocalFolder; var subfolder = await folder.CreateFolderAsync("MyFolder", Windows.Storage.CreationCollisionOption.OpenIfExists); // create file var file = await subfolder.CreateFileAsync("MyFile.txt", Windows.Storage.CreationCollisionOption.ReplaceExisting); // write await Windows.Storage.FileIO.WriteTextAsync(file, "Hello Build!"); // read var content = await Windows.Storage.FileIO.ReadTextAsync(file); // var = new Message(); .Subject = "File is attached"; .To.Add(new .Attachments.Add(new Attachment(file.Name, file)); await Manager.ShowComposeNew Async( );
Roaming Cross-device 100K limit Project Install folder Local Isolated App-specific Temporary Transient Windows.Storage.ApplicationData
So, you’ve chosen WinRT. There’s something you should know.
What, no MessageBox? var ok = new UICommand("ok", x => { /* TODO */ }); var cancel = new UICommand("cancel"); var dialog = new MessageDialog("message", "title"); dialog.Commands.Add(ok); dialog.Commands.Add(cancel); await dialog.ShowAsync();
If you use Microsoft.Phone.Tasks MarketplaceReviewTaskLaunch URI: zune:reviewapp?appid=app[app ID] MarketplaceSearchTaskLaunch URI: zune:search?publisher=[publisher ID]* WebBrowserTaskWindows.System.Launcher.LaunchUriAsync(Uri) AddressChooserTaskWindows.ApplicationModel.Contacts.ContactPicker PhoneCallTaskWindows.ApplicationModel.Calls.PhoneCallManager SmsComposeTaskWindows.ApplicationModel.Chat.ChatMessageManager
If you use Live Tiles
If you use Localization
WHAT’S NEW WITH WINDOWS PHONE SILVERLIGHT APPS
New Features for Silverlight 8.1 Apps Storage SD CardData Enhancements (Data.XML) Device Discovery (Devices.Enumeration)Graphics Enhancements D2D/Dwrite (Win32) Streams (Input/Output/RandomAccess…)Sensors (Accelerometer, Light, compass, gyro, magnet, orientation,…) Media Editing (MediaStreamSource, MediaProperties) with Attachments Media TranscodingData: Backup/Restore Graphics Enhancements WICData: Roaming Share SourceNetworking (HTTP, Connectivity,...) Share Target (Provider)Audio Effects RFCommMedia Capture App 2 App Single Sign OnBluetooth 4.0 (Low Energy) Background TasksWeb Authentication Password CredentialsStorage Enhancements (FileIO, PathIO, AccessCache, Compression) WNS Push Notification TriggerSocial RT WNS Notifications (Badge/Tile/Toast/Notification Center)Storage (Picker Provider, Provider) InputPaneMSA (Windows.Security.Authentication.OnlineId ) GeoFencingAtomPub, Http, Syndication (Windows.Web) NFC Secure PaymentMedia Foundations (win32) Known Folders (Audio/Video/Photos/…)Advertising ID Appointments/Calendar API enhancementsAccessibility (UIA, Large Text, High Contrast) Appointments/Calendar brokered UIPrecise Caret Placement - No APIs Background Transfer
Over 90% API Convergence Small set not converged yet Convergence Phone Feature Only Available in Silverlight Lenses Support VOIP Support Camera Capture Task Clipboard APIs Lock Screen Wallpaper API Ringtone Provider / Alarm & Reminders Simple Sound effects (XNA) Run Under Lock Screen Photos Extensibility Search Extras
Huh? Silverlight 8.1 Apps Run in “Modern Context”
SL 8.0 apps will run on 8.1 phones 100% binary compatible Upgrading 8.0 app to 8.1 Not 100% source compatible App Compatibility
Documentation with full list CLR/Silverlight bug fixes Modern context behavior differences Fast App Resume (FAR) is enabled by default (resume vs replace) Hitting back ‘does’ terminate the app just like Silverlight 8.0 Upgrade Breaking Changes
SD Card Support Share Source Share Target WNS Push Notification Trigger WNS Notifications (Badge/Tile/Toast/Notification Center) Storage (Picker Provider, Provider) GeoFencing Bluetooth 4.0 (Low Energy) Background Tasks Known Folders (Audio/Video/Photos/…) Appointments / Calendar Enhancements with Attachments New features
Which XAML Framework should you use? App TypeFramework New AppXAML or Silverlight Existing Windows Store AppXAML Lock Screen Image (social, weather, sports,..)Silverlight 8.x Camera Based App (lenses integration) or VOIPSilverlight 8.x Music AppSilverlight 8.0 or XAML Existing Silverlight Phone AppsSilverlight 8.x or XAML
STORE AND PUBLISHING
One developer registration One set of policies, one cert team One developer platform Universal apps One Store - Blue
Universal apps for Windows Free
Certification time = 2-5 days App Certification
1. Apps on SD
2. App Auto-Updates
3. My Apps
Apps AE 3D Moto – The Lost City [Campaign Name] Detailed stats to help you get the most out of your ad dollars. This month’s budgetChange monthly budget Campaign ReportBanner Preview Delet e Save Ad Campaigns Accounts
Replying to reviews
Justin 5/23/2013 It’s fun, but can take a little time to get used to. My only complaint is that the songs in the game are low quality midis. Would be great to get better music to go with the game play! Send Lara 5/22/2013 The game was great when it worked, but kept crashing in the middle of my game. Lara 5/22/2013 Awesome game! Can’t wait for the next level to come out. It would also be really cool if I could see how my top score compares to my friends. Respond Lara 5/22/2013 The game was great when it worked, but kept crashing in the middle of my game. Respond Hi Justin, Thanks so much for your feedback on my app! I've worked on your comment and updated to higher quality music in the latest version. Please update the app and let me know your thoughts on my music choices! -John Respond
Inspirirani ljudima. Pitanja i odgovori.