Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Windows Runtime Apps

1,506 views

Published on

Windows Runtime Apps at National Institute of Business Management (NIBM) - Sri Lanka

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Windows Runtime Apps

  1. 1. Windows Runtime Apps Jaliya Udagedara MVP (Visual C#)
  2. 2. Windows Store App Windows Phone Store App
  3. 3. Windows Runtime Apps
  4. 4. Windows Runtime contains more than 90% of Windows Phone Runtime
  5. 5. protected override async void OnLaunched(LaunchActivatedEventArgs e) { ApplicationExecutionState state = e.PreviousExecutionState; ActivationKind kind = e.Kind; ///... }
  6. 6. • App is suspended • All code stopped • No timers tick • No events fire • Process still alive and in memory • Code has a chance to respond (next slide)
  7. 7. private async void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); await SuspensionManager.SaveAsync(); deferral.Complete(); }
  8. 8. • Same app is resumed • Same process, same memory so values of variables are intact • All code runs • Code has a chance to respond. Launch Switcher
  9. 9. public App() { this.InitializeComponent(); this.Suspending += this.OnSuspending; this.Resuming += App_Resuming; } void App_Resuming(object sender, object e) { // TODO: whatever you need to do to resume your app }
  10. 10. http://bit.ly/w8Resuming
  11. 11. Window Frame Page Window
  12. 12. protected override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has // content, just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate // to the first page rootFrame = new Frame(); ... // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // Navigate to the first page rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
  13. 13. private void itemListView_ItemClick(object sender, ItemClickEventArgs e) { // Navigate to the appropriate destination page, configuring the new page // by passing required information as a navigation parameter var itemId = ((MyListViewItem)e.ClickedItem).UniqueId; Frame.Navigate(typeof(MyDetailPage), itemId); }
  14. 14. private void btnGoBack_Click( object sender, RoutedEventArgs e) { if (this.Frame.CanGoBack) this.Frame.GoBack(); }
  15. 15. 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 (SecondaryUI.Visibility == Visibility.Visible ) // If the secondary UI is visible, hide it { FadeOutSecondaryStoryboard.Begin(); } else { if (Frame.CanGoBack) Frame.GoBack(); } }
  16. 16. Add Windows Phone 8.1 or Windows 8.1
  17. 17. Context Switcher in the Editor
  18. 18. Context Switcher in the XAML Editor
  19. 19. Better IntelliSense
  20. 20. Devices Window
  21. 21. Switching Startup Projects
  22. 22. • Universal App
  23. 23. Thank You! http://www.jaliyaudagedara.blogspot.com/

×