App.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using MyWeather.View;
  2. using MyWeather.ViewModels;
  3. using Xamarin.Forms;
  4. using static System.Diagnostics.Debug;
  5. namespace MyWeather
  6. {
  7. public class App : Application
  8. {
  9. public App()
  10. {
  11. var tabs = new TabbedPage
  12. {
  13. Title ="My Weather",
  14. BindingContext = new WeatherViewModel(),
  15. Children =
  16. {
  17. new WeatherView(),
  18. new ForecastView()
  19. }
  20. };
  21. MainPage = new NavigationPage(tabs)
  22. {
  23. BarBackgroundColor = Color.FromHex("3498db"),
  24. BarTextColor = Color.White
  25. };
  26. }
  27. protected override void OnStart()
  28. {
  29. base.OnStart();
  30. WriteLine("Application OnStart");
  31. }
  32. protected override void OnSleep()
  33. {
  34. base.OnSleep();
  35. WriteLine("Application OnSleep");
  36. }
  37. protected override void OnResume()
  38. {
  39. base.OnResume();
  40. WriteLine("Application OnResume");
  41. }
  42. }
  43. }