예제 #1
0
        public GroupPage(RootPage rootPage)
        {
            _rootPage = rootPage;
            NavigationPage.SetHasNavigationBar (this, false);

            //TODO : Inject Groups
            _db = new GroupsterDatabase();

            _viewModel = new GroupLoadingViewModel (Navigation, _db.GetItems<Group>(), rootPage);
            BindingContext = _viewModel;

            var statusMessageLabel = new LargeLabel {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                TextColor = Color.White,
            };

            statusMessageLabel.SetBinding<GroupLoadingViewModel> (Label.TextProperty, vm => vm.StatusMessage);

            var stackLayout = new StackLayout {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                Spacing = 10
            };

            var loadingImage = new Image ();

            loadingImage.SetBinding<GroupLoadingViewModel> (Image.SourceProperty, vm => vm.LoadingImage);

            var refreshButton = new Button{ Text = "Refresh", HorizontalOptions = LayoutOptions.Center };

            refreshButton.SetBinding<GroupLoadingViewModel> (Button.CommandProperty, vm => vm.GetGroupCommand);
            refreshButton.SetBinding<GroupLoadingViewModel> (VisualElement.IsVisibleProperty, vm => vm.IsRefreshButtonVisible);

            var activityIndicator = new ActivityIndicator{ IsRunning = true };

            activityIndicator.SetBinding<GroupLoadingViewModel> (VisualElement.IsVisibleProperty, vm => vm.IsActivityIndicatorVisible);

            stackLayout.Children.Add (loadingImage);
            stackLayout.Children.Add (statusMessageLabel);
            stackLayout.Children.Add (activityIndicator);
            stackLayout.Children.Add (refreshButton);

            Content = stackLayout;
        }
예제 #2
0
        StackLayout CreateForecastStatusStackLayout()
        {
            var scheduledGroupsLabel = new ExtraLargeLabel { HorizontalOptions = LayoutOptions.Center };

            scheduledGroupsLabel.SetBinding<ForecastViewModel> (Label.TextProperty, vm => vm.ScheduledGroupCount);
            scheduledGroupsLabel.TextColor = GetScheduledGroupsTextColor (_forecast.ScheduledGroupsCount);

            var scheduledGroupsTextLabel = new LargeLabel { VerticalOptions = LayoutOptions.CenterAndExpand };
            scheduledGroupsTextLabel.SetBinding<ForecastViewModel> (Label.TextProperty, vm => vm.ScheduledGroupText);

            var horizontalStackLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Start,
                Padding = new Thickness (40, 0, 0, 0)
            };

            horizontalStackLayout.Children.Add (new LargeLabel {
                Text = "Events for ",
                VerticalOptions = LayoutOptions.CenterAndExpand
            });
            horizontalStackLayout.Children.Add (scheduledGroupsLabel);
            horizontalStackLayout.Children.Add (scheduledGroupsTextLabel);

            return horizontalStackLayout;
        }