public FeedPage() { InitializeComponent(); loggedIn = Settings.Current.Email; BindingContext = new FeedViewModel(); if (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone) { ToolbarItems.Add(new ToolbarItem { Text = "Refresh", Icon = "toolbar_refresh.png", Command = ViewModel.RefreshCommand }); } favoritesTime = Settings.Current.LastFavoriteTime; ViewModel.Tweets.CollectionChanged += (sender, e) => { var adjust = Device.OS != TargetPlatform.Android ? 1 : -ViewModel.Tweets.Count + 2; ListViewSocial.HeightRequest = (ViewModel.Tweets.Count * ListViewSocial.RowHeight) - adjust; }; ViewModel.Sessions.CollectionChanged += (sender, e) => { var adjust = Device.OS != TargetPlatform.Android ? 1 : -ViewModel.Sessions.Count + 1; ListViewSessions.HeightRequest = (ViewModel.Sessions.Count * ListViewSessions.RowHeight) - adjust; }; ListViewSessions.ItemTapped += (sender, e) => ListViewSessions.SelectedItem = null; ListViewSessions.ItemSelected += async(sender, e) => { var session = ListViewSessions.SelectedItem as Session; if (session == null) { return; } var sessionDetails = new SessionDetailsPage(session); App.Logger.TrackPage(AppPage.Session.ToString(), session.Title); await NavigationService.PushAsync(Navigation, sessionDetails); ListViewSessions.SelectedItem = null; }; NotificationStack.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(async() => { App.Logger.TrackPage(AppPage.Notification.ToString()); await NavigationService.PushAsync(Navigation, new NotificationsPage()); }) }); }
public SessionsPage() { InitializeComponent(); loggedIn = Settings.Current.Email; showFavs = Settings.Current.FavoritesOnly; showPast = Settings.Current.ShowPastSessions; showAllCategories = Settings.Current.ShowAllCategories; filteredCategories = Settings.Current.FilteredCategories; BindingContext = vm = new SessionsViewModel(Navigation); filterItem = new ToolbarItem { Text = "Filter" }; if (Device.RuntimePlatform != "iOS") { filterItem.Icon = "toolbar_filter.png"; } filterItem.Command = new Command(async() => { if (vm.IsBusy) { return; } App.Logger.TrackPage(AppPage.Filter.ToString()); await NavigationService.PushModalAsync(Navigation, new EvolveNavigationPage(new FilterSessionsPage())); }); ToolbarItems.Add(filterItem); ListViewSessions.ItemSelected += async(sender, e) => { var session = ListViewSessions.SelectedItem as Session; if (session == null) { return; } var sessionDetails = new SessionDetailsPage(session); App.Logger.TrackPage(AppPage.Session.ToString(), session.Title); await NavigationService.PushAsync(Navigation, sessionDetails); ListViewSessions.SelectedItem = null; }; }