public EventListView(EventViewModel viewModel)
        {
            BindingContext = viewModel;

            var stack = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding = new Thickness(0, 10)
            };

            var progress = new ActivityIndicator
            {
                IsEnabled = true,
                Color = Color.White
            };

            progress.SetBinding(IsVisibleProperty, "IsBusy");
            progress.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");

            stack.Children.Add(progress);

            var listView = new ListView {ItemsSource = viewModel.Events};

            var itemTemplate = new DataTemplate(typeof (TextCell));
            itemTemplate.SetBinding(TextCell.TextProperty, "Name");
            listView.ItemTemplate = itemTemplate;

            stack.Children.Add(listView);

            Content = stack;
        }
        public EventMapView(EventViewModel viewModel)
        {
            BindingContext = viewModel;

            var stack = new StackLayout();
            var map = new Map { IsShowingUser = true, VerticalOptions = LayoutOptions.FillAndExpand };

            MessagingCenter.Subscribe<EventViewModel>(this, "LocationSet", s =>
                {
                    var currentLocation = _vm.CurrentLocation;
                    map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(currentLocation.Latitude, currentLocation.Longitude),
                        Distance.FromMiles(0.3)));
                });

            MessagingCenter.Subscribe<EventViewModel>(this, "EventsLoaded", s =>
                {
                    map.Pins.Clear();
                    foreach (var v in _vm.Events)
                        if(v.Venue != null)
                            map.Pins.Add(new Pin
                                {
                                    Type = PinType.Place,
                                    Position = new Position(v.Venue.Latitude, v.Venue.Longitude),
                                    Address = v.Venue.Address1,
                                    Label = v.Name
                                });
                });
            stack.Children.Add(map);

            Content = stack;
        }
        public Homepage()
        {
            BindingContext = new EventViewModel();

            var refresh = new ToolbarItem
            {
                Name = "refresh",
                Icon = "refresh.png",
                Command = _vm.Refresh,
                Priority = 0
            };

            ToolbarItems.Add(refresh);

            Title = "Meetup Event Finder";

            var list = new EventListView(_vm) { Title = "Events", Icon = "list.png" };
            var map = new EventMapView(_vm) { Title = "Map", Icon = "map.png"};

            Children.Add(list);
            Children.Add(map);
        }