Exemplo n.º 1
0
        public EventsPage()
        {
            InitializeComponent();
            BindingContext = new EventsViewModel(Navigation);

            if (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone)
            {
                ToolbarItems.Add(new ToolbarItem
                {
                    Text = "Refresh",
                    Icon ="toolbar_refresh.png",
                    Command = ViewModel.ForceRefreshCommand
                });
            }

            ListViewEvents.ItemTapped += (sender, e) => ListViewEvents.SelectedItem = null;
            ListViewEvents.ItemSelected += async (sender, e) =>
                {
                    var ev = ListViewEvents.SelectedItem as FeaturedEvent;
                    if(ev == null)
                        return;

                    var eventDetails = new EventDetailsPage();

                    eventDetails.Event = ev;
                    App.Logger.TrackPage(AppPage.Event.ToString(), ev.Title);
                    await NavigationService.PushAsync(Navigation, eventDetails);

                    ListViewEvents.SelectedItem = null;
                };
        }
        public EventsPage()
        {
            InitializeComponent();
            BindingContext = new EventsViewModel(Navigation);

            if (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone)
            {
                ToolbarItems.Add(new ToolbarItem
                {
                    Text    = "Refresh",
                    Icon    = "toolbar_refresh.png",
                    Command = ViewModel.ForceRefreshCommand
                });
            }

            ListViewEvents.ItemTapped   += (sender, e) => ListViewEvents.SelectedItem = null;
            ListViewEvents.ItemSelected += async(sender, e) =>
            {
                var ev = ListViewEvents.SelectedItem as FeaturedEvent;
                if (ev == null)
                {
                    return;
                }

                var eventDetails = new EventDetailsPage();

                eventDetails.Event = ev;
                App.Logger.TrackPage(AppPage.Event.ToString(), ev.Title);
                await NavigationService.PushAsync(Navigation, eventDetails);

                ListViewEvents.SelectedItem = null;
            };
        }