Esempio n. 1
0
		public MasterDetailPage()
		{
			_menu = new MenuPage {
				Title = "Menu"
			};
			_menu.ListView.ItemSelected += (sender, e) =>
			{
				if(e.SelectedItem == null)
					return;

				var kvp = (KeyValuePair<string, ICommand>)e.SelectedItem;
				_menu.ListView.SelectedItem = null;
				IsPresented = false;

				kvp.Value.Execute(null);
			};

			MessagingCenter.Subscribe<AuthenticationViewModel>(this, "UserAuthenticated", (viewModel) =>
			{
				AddMenuItems();
			});

			AddMenuItems();

			_leaguesPage = new NavigationPage(new AthleteLeaguesPage(Settings.Instance.AthleteId)) {
				Title = "Leagues"
			};

			_leaguesPage.BarBackgroundColor = Color.FromHex("#91CA47");
			_leaguesPage.BarTextColor = Color.White;

			Master = _menu;
			Detail = _leaguesPage;
		}