Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

App.xaml.cs 1.4 KiB

il y a 7 ans
il y a 7 ans
il y a 7 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using Windows.ApplicationModel;
  3. using Windows.ApplicationModel.Activation;
  4. using Windows.UI.Xaml;
  5. using Windows.UI.Xaml.Controls;
  6. using Windows.UI.Xaml.Navigation;
  7. namespace MQTTnet.TestApp.UniversalWindows
  8. {
  9. sealed partial class App
  10. {
  11. public App()
  12. {
  13. InitializeComponent();
  14. Suspending += OnSuspending;
  15. }
  16. protected override void OnLaunched(LaunchActivatedEventArgs e)
  17. {
  18. if (!(Window.Current.Content is Frame rootFrame))
  19. {
  20. rootFrame = new Frame();
  21. rootFrame.NavigationFailed += OnNavigationFailed;
  22. Window.Current.Content = rootFrame;
  23. }
  24. if (e.PrelaunchActivated == false)
  25. {
  26. if (rootFrame.Content == null)
  27. {
  28. rootFrame.Navigate(typeof(MainPage), e.Arguments);
  29. }
  30. Window.Current.Activate();
  31. }
  32. }
  33. void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
  34. {
  35. throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
  36. }
  37. private void OnSuspending(object sender, SuspendingEventArgs e)
  38. {
  39. var deferral = e.SuspendingOperation.GetDeferral();
  40. deferral.Complete();
  41. }
  42. }
  43. }