Ejemplo n.º 1
0
        public RssFeedView2()
        {
            this.viewModel = new RssFeedViewModel();
            this.BindingContext = viewModel;
            this.Title = "Rss Feed";

            var refresh = new ToolbarItem(){ Command = viewModel.ReloadCommand, Name = "Reload", Priority = 0 };
            ToolbarItems.Add(refresh);

            var stack = new StackLayout(){ Orientation = StackOrientation.Vertical };
            var activity = new ActivityIndicator(){ Color = Color.Blue, IsEnabled = true };
            activity.SetBinding(ActivityIndicator.IsVisibleProperty, "ShowActivityIndicator");
            activity.SetBinding(ActivityIndicator.IsRunningProperty, "ShowActivityIndicator");

            stack.Children.Add(activity);

            var listview = new ListView();
            listview.ItemsSource = viewModel.Records;
            var cell = new DataTemplate(typeof(ImageCell));
            cell.SetBinding(ImageCell.TextProperty, "Title");
            cell.SetBinding(ImageCell.ImageSourceProperty, "Image");
            listview.ItemTemplate = cell;
            listview.ItemSelected += async (sender, e) => {
                await Navigation.PushAsync(new RssWebView((RssRecordViewModel)e.SelectedItem));
                listview.SelectedItem = null;
            };

            stack.Children.Add(listview);

            Content = stack;
        }
Ejemplo n.º 2
0
        public PublicRoomsPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            var listView = new BindableListView
                {
                    ItemTemplate = new DataTemplate(() =>
                        {
                        var textCell = new TextCell();
                            textCell.SetBinding(TextCell.TextProperty, new Binding("Name"));
                            textCell.TextColor = Styling.BlackText;
                            //textCell.SetBinding(TextCell.DetailProperty, new Binding("Description"));
                            return textCell;
                        }),
                    SeparatorVisibility = SeparatorVisibility.None
                };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("PublicRooms"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectRoomCommand"));

            var loadingIndicator = new ActivityIndicator ();
            loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));
            loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            Content = new StackLayout
            {
                Children =
                        {
                            loadingIndicator,
                            listView
                        }
            };
        }
        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 HomePage ()
		{
			// setup your ViewModel
			ViewModel = new HomePageViewModel
			{
				ButtonText = "Click Me!"
			};
			// Set the binding context to the newly created ViewModel
			BindingContext = ViewModel;

			// the button is what we're going to use to trigger a long running Async task
			// we're also going to bind the button text so that we can see the binding in action
			var actionButton = new Button();
			actionButton.SetBinding(Button.TextProperty, "ButtonText");
			actionButton.Clicked += async (sender, args) => await SomeLongRunningTaskAsync();

			// here's your activity indicator, it's bound to the IsBusy property of the BaseViewModel
			// those bindings are on both the visibility property as well as the IsRunning property
			var activityIndicator = new ActivityIndicator
			{
				Color = Color.Black,
			};
			activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
			activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");

			// return the layout that includes all the above elements
			Content = new StackLayout
			{
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				BackgroundColor = Color.White,
				Children = {actionButton, activityIndicator}
			};
		}
Ejemplo n.º 5
0
        public EmployeeListViewPage()
        {

            BindingContext = new EmployeeViewModel();
            var activity = new ActivityIndicator
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Color = Color.White,
                //IsEnabled = true
            };
            activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
            activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");

            //Command
            ViewModel.LoadAllEmployees.Execute(null);

            _iiEmpList = new iiListView()
            {
                ItemTemplate = new DataTemplate(typeof(EmployeeNameCell)),
                ClassId="1",    
                RowHeight=70
            };
            Content = new StackLayout
            {
                Children = {
                    activity,
					_iiEmpList
				}
            };
            _iiEmpList.ItemTapped += _iiEmpList_ItemTapped;
        }
Ejemplo n.º 6
0
        public BalanceLeaveViewPage()
        {
            BindingContext = new EmployeeViewModel();
            var activity = new ActivityIndicator
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Color = Color.White.ToFormsColor(),
                //IsEnabled = true
            };
            activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
            activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            ViewModel.LoadAllEmployees.Execute(null);
            listView = new iiListView()
            {
                ItemTemplate = new DataTemplate(typeof(NameCell))
            };

            BackgroundImage = "back";
            Content = new StackLayout
            {
                // HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding = new Thickness(20, 70, 20, 20),
                Spacing=20,
                Children = 
                {
                    activity,  
                    listView,
                    GenCalGrid(),
                }
            };
            listView.ItemTapped += listView_ItemTapped;
        }
        public GroupMatchView()
        {
            BindingContext = new GroupMatchesViewModel();

            var activity = new ActivityIndicator
            {
                Color = Helpers.Color.Greenish.ToFormsColor(),
                IsEnabled = true
            };
            activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
            activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");

            this.Groups = new ObservableCollection<GroupHelper>();
            var refresh = new ToolbarItem
            {
                Command = ViewModel.LoadItemsCommand,
                Icon = "refresh.png",
                Name = "refresh",
                Priority = 0
            };
            ToolbarItems.Add(refresh);

            ViewModel.ItemsLoaded += new EventHandler((sender, e) =>
            {
                this.Groups.Clear();
                ViewModel.Result.Select(r => r.MatchDate).Distinct().ToList()
                    .ForEach(r => Groups.Add(new GroupHelper(r)));
                foreach (var g in Groups)
                {
                    foreach (var match in ViewModel.Result.Where(m=> m.MatchDate == g.Date))
                    {
                        g.Add(match);
                    }
                }
            });

            Title = "Group Match Schedule";
            var stack = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding = new Thickness(0, 0, 0, 8)
            };

            var listView = new ListView
            {
                IsGroupingEnabled = true,
                GroupDisplayBinding = new Binding("Date"),
            };

            var viewTemplate = new DataTemplate(typeof(ScoreCell));

            listView.ItemTemplate = viewTemplate;

            listView.ItemsSource = Groups;
            stack.Children.Add(activity);

            stack.Children.Add(listView);

            Content = stack;
        }
        public MonkeyListPage()
        {
            var spinner = new ActivityIndicator();
            spinner.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            spinner.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
            spinner.Color = Color.Blue;

            var list = new ListView();
            list.SetBinding(ListView.ItemsSourceProperty, "MonkeyList");

            var cell = new DataTemplate(typeof(ImageCell));
            cell.SetBinding(ImageCell.TextProperty, "Name");
            cell.SetBinding(ImageCell.DetailProperty, "Location");
            cell.SetBinding(ImageCell.ImageSourceProperty, "Image");

            list.ItemTemplate = cell;

            //listView
            // --> ItemTemplate
            // ----> DataTemplate
            // -------> Cell

            var getMonkeys = new Button
            {
                Text = "Get Monkeys"
            };

            getMonkeys.Clicked += async (sender, e) =>
            {
                try
                {
                    await _viewModel.GetMonkeysAsync();
                }
                catch
                {
                    DisplayAlert("Error", "No Monkeys Found :(", "OK");
                }
            };

            list.ItemTapped += async (sender, e) =>
            {
                var detail = new MonkeyPage();
                detail.BindingContext = e.Item;
                await Navigation.PushAsync(detail);

                list.SelectedItem = null;
            };

            Content = new StackLayout
            {
                Children =
                {
                    spinner, list, getMonkeys
                }
            };

            BindingContext = _viewModel;
        }
Ejemplo n.º 9
0
        public SettingsUserView()
        {
            BindingContext = profileViewModel = new ProfileViewModel();

            profileViewModel.GetCPFeedCommand.Execute(null);
            var activityIndicator = new ActivityIndicator
            {
                Color = Color.Black,
            };

            activityIndicator.SetBinding(IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            var circleImage = new CircleImage
            {
                BorderColor = Color.White,
                BorderThickness = 2,
                HeightRequest = 80,
                WidthRequest = 80,
                Aspect = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                Source =
                    new UriImageSource { Uri = new Uri("http://bit.ly/1s07h2W"), CacheValidity = TimeSpan.FromDays(30) },
            };

            var label = new Label()
            {
                Text = "User",
                TextColor = Color.White,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
            };

            Content = new StackLayout()
            {
                Padding = new Thickness(0, 10, 0, 0),
                Spacing = 15,
                Orientation = StackOrientation.Vertical,
                Children = {circleImage,
				label,
				activityIndicator,
				}
            };

            circleImage.SetBinding(CircleImage.SourceProperty, "Avatar");

            label.SetBinding(Label.TextProperty, "DisplayName");

            //var tapGestureRecognizer = new TapGestureRecognizer();
            //tapGestureRecognizer.Tapped +=
            //    (sender, e) =>
            //        Navigation.PushModalAsync(new NavigationPage(new Profile(profileViewModel.myProfile)) { BarBackgroundColor = App.BrandColor });
            //circleImage.GestureRecognizers.Add(tapGestureRecognizer);
            
        }
Ejemplo n.º 10
0
        public ActiveChatsPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            var listView = new BindableListView
            {
                ItemTemplate = new DataTemplate(() =>
                    {
                        var imageCell = new ImageCell();
                        imageCell.SetBinding(ImageCell.TextProperty, new Binding("Name"));
                        imageCell.SetBinding(ImageCell.DetailProperty, new Binding("DescriptionText"));
                        imageCell.SetBinding(ImageCell.ImageSourceProperty, new Binding("Image"));
                        imageCell.TextColor = Styling.CellTitleColor;
                        imageCell.DetailColor = Styling.CellDetailColor;
                        return imageCell;
                    }),
                SeparatorVisibility = SeparatorVisibility.None
            };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("ActiveChats"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectActiveChatCommand"));
            listView.SetBinding(ListView.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay));

            var noItemsLabel = new Label {
                Text = "Start a conversation or open a room!",
                HorizontalOptions = LayoutOptions.Center,
                FontSize = 16,
                TextColor = Color.Gray
            };
            var noItemsLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    new BoxView{HeightRequest = 20},
                    noItemsLabel
                }
            };
            noItemsLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay, converter: new InverterConverter()));

            var loadingIndicator = new ActivityIndicator ();
            loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));
            loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            Content = new StackLayout
            {
                Children =
                {
                    loadingIndicator,
                    listView,
                    noItemsLayout
                }
            };
        }
Ejemplo n.º 11
0
		View CreateActivityIndicator ()
		{
			var activityIndicator = new ActivityIndicator
			{
				Color = Color.Black,
			};
			activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
			activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");

			return activityIndicator;
		}
Ejemplo n.º 12
0
        public ArticleView(FeedItem feedItem)
        {
            BindingContext = new ArticleViewModel();

            ViewModel.ArticleSource = feedItem.Link;
            Title = feedItem.Title;

            var activity = new ActivityIndicator
            {
                Color = Color.Gray,
                IsEnabled = true
            };
            activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
            activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");

         
            webView = new WebView();

            IWindowService windowService = DependencyService.Get<IWindowService>();
            Size size = windowService.Bounds;  

            AbsoluteLayout layout = new AbsoluteLayout();
            layout.Children.Add(activity, new Rectangle(0, 0, size.Width, 40));

            if (Device.OS == TargetPlatform.iOS)
            {
                Button comments = new Button()
                {
                    Text = "Комментарии",
                    BackgroundColor = Color.FromRgba(0.5, 0.5, 0.5, 0.8)
                };

                comments.Clicked += (sender, e) =>
                {
                    Navigation.PushAsync(new CommentsView(ViewModel.Article));
                };

				layout.Children.Add(comments, new Rectangle(5, size.Height - 110, size.Width - 10, 40));
				layout.Children.Add(webView, new Rectangle(0, 0, size.Width, size.Height - 110));
            }
            else
            {
				var comments = new ToolbarItem("comments", "comments.png",
                                              () => Navigation.PushModalAsync(new CommentsView(ViewModel.Article)));

				ToolbarItems.Add(comments);

				layout.Children.Add(webView, new Rectangle(0, 0, size.Width, size.Height));
            }

            Content = layout;
        }
 protected ActivityIndicator CreateLoadingIndicator()
 {
     var loadingIndicator = new ActivityIndicator
     {
         HorizontalOptions = LayoutOptions.CenterAndExpand,
         VerticalOptions = LayoutOptions.Start,
         Scale = 2,
         Color = Color.Silver
     };
     loadingIndicator.SetBinding(IsVisibleProperty, "IsLoading");
     loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading");
     return loadingIndicator;
 }
Ejemplo n.º 14
0
        public OnlineUsersPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            var usersCountLabel = new SquawkLabel () {
            };
            usersCountLabel.SetBinding(Label.TextProperty, new Binding("Users.Count", stringFormat: "     {0} users online"));

            var filterEntry = new SquawkEntry () {
                Placeholder = "Filter...",
            };
            filterEntry.SetBinding (Entry.TextProperty, new Binding ("FilterText"));

            var listView = new BindableListView
                {
                    ItemTemplate = new DataTemplate(() =>
                        {
                            var imageCell = new ImageCell
                                {
                                    ImageSource = Styling.ContactIcon
                                };
                            imageCell.SetBinding(TextCell.TextProperty, new Binding("Name"));
                            imageCell.SetBinding(TextCell.DetailProperty, new Binding("Description"));
                            imageCell.TextColor = Styling.CellTitleColor;
                            imageCell.DetailColor = Styling.CellDetailColor;
                            return imageCell;
                        })
                };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("UsersDisplay"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectUserCommand"));

            var loadingIndicator = new ActivityIndicator ();
            loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));
            loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            Content = new StackLayout {
                Children = {
                    new StackLayout {Children =
                        {
                            usersCountLabel,
                            filterEntry,
                            loadingIndicator
                        },
                        BackgroundColor = Styling.SubheaderYellow,
                        Padding = new Thickness(3)
                    },
                    listView
                }
            };
        }
        public PodcastView()
        {
            BindingContext = new PodcastViewModel();

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

            ToolbarItems.Add (refresh);

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

            var activity = new ActivityIndicator {
                Color = Helpers.Color.Greenish.ToFormsColor(),
                IsEnabled = true
            };
            activity.SetBinding (ActivityIndicator.IsVisibleProperty, "IsBusy");
            activity.SetBinding (ActivityIndicator.IsRunningProperty, "IsBusy");

            stack.Children.Add (activity);

            var listView = new ListView();

            listView.ItemsSource = ViewModel.Podcasts;

            var cell = new DataTemplate(typeof(ListTextCell));

            cell.SetBinding (TextCell.TextProperty, "Title");
            cell.SetBinding (TextCell.DetailProperty, "Details");

            listView.ItemTapped +=  (sender, args) => {
                if(listView.SelectedItem == null)
                    return;

                this.Navigation.PushAsync(new PodcastDetalView(listView.SelectedItem as Podcast));
                listView.SelectedItem = null;
            };

            listView.ItemTemplate = cell;

            stack.Children.Add (listView);

            Content = stack;
        }
Ejemplo n.º 16
0
		public TwitterView ()
		{
			BindingContext = new TwitterViewModel ();

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

			ToolbarItems.Add (refresh);

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

			var activity = new ActivityIndicator {
				Color = Helpers.Color.DarkBlue.ToFormsColor(),
				IsEnabled = true
			};
			activity.SetBinding (ActivityIndicator.IsVisibleProperty, "IsBusy");
			activity.SetBinding (ActivityIndicator.IsRunningProperty, "IsBusy");

			stack.Children.Add (activity);

			var listView = new ListView ();

			listView.ItemsSource = ViewModel.Tweets;

			var cell = new DataTemplate(typeof(ListTextCell));
			cell.SetBinding (TextCell.TextProperty, "Text");
			cell.SetBinding (TextCell.DetailProperty, "Date");
			listView.ItemTemplate = cell;

			listView.ItemTapped +=  (sender, args) => {
				if(listView.SelectedItem == null)
					return;
				var tweet = listView.SelectedItem as Tweet;
				this.Navigation.PushAsync(new WebsiteView("http://m.twitter.com/shanselman/status/"+ tweet.StatusID, tweet.Date));
				listView.SelectedItem = null;
			};

			stack.Children.Add (listView);

			Content = stack;
		}
			public BaseAsyncActivityTemplate() {
				// Adds the Content Presenter
				var contentPresenter = new ContentPresenter();
				Children.Add(contentPresenter, 0, 0);

				// The overlay that is presented when an Activity is Running
				var overlayGrid = new Grid { BackgroundColor = Color.FromHex("#CCCCCCCC") };
				overlayGrid.SetBinding(IsVisibleProperty, new TemplateBinding("IsActivityRunning"));

				var descriptionLabel = new Label { TextColor = Color.White };
				descriptionLabel.SetBinding(Label.TextProperty, new TemplateBinding("ActivityDescription"));

				var activityIndicator = new ActivityIndicator { Color = Color.White };
				activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new TemplateBinding("IsActivityRunning"));

				// A layout to hold the Activity Indicator and Description
				var activityIndicatorLayout = new StackLayout {
					HorizontalOptions = LayoutOptions.Center,
					VerticalOptions = LayoutOptions.Center,
				};
				activityIndicatorLayout.Children.Add(activityIndicator);
				activityIndicatorLayout.Children.Add(descriptionLabel);

				// Finally add the indicator to the overlay and the overlay to the grid
				overlayGrid.Children.Add(activityIndicatorLayout, 0, 0);
				Children.Add(overlayGrid);
			}
		public LoadingPlaceholder ()
		{
			Padding = new Thickness (20);
			Title = "Image Loading Gallery";

			var source = new UriImageSource {
				Uri = new Uri ("http://www.nasa.gov/sites/default/files/styles/1600x1200_autoletterbox/public/images/298773main_EC02-0282-3_full.jpg"),
				CachingEnabled = false
			};

			var image = new Image {
				Source = source,
				WidthRequest = 200,
				HeightRequest = 200,
			};

			var indicator = new ActivityIndicator {Color = new Color (.5),};
			indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading");
			indicator.BindingContext = image;

			var grid = new Grid();
			grid.RowDefinitions.Add (new RowDefinition());


			grid.Children.Add (image);
			grid.Children.Add (indicator);


			Content = grid;
		}
Ejemplo n.º 19
0
		public FeedView ()
		{
			BindingContext = new FeedViewModel ();
            
			var refresh = new ToolbarItem ("refresh", "refresh.png", async () => await ViewModel.LoadItems ());
			ToolbarItems.Add (refresh);

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

			var activity = new ActivityIndicator {
				Color = Color.Gray,
				IsEnabled = true
			};
			activity.SetBinding (ActivityIndicator.IsVisibleProperty, "IsBusy");
			activity.SetBinding (ActivityIndicator.IsRunningProperty, "IsBusy");

			stack.Children.Add (activity);

			var listView = new ListView { ItemsSource = ViewModel.FeedItems };
			var cell = new DataTemplate (() => new FeedCell ());
			listView.RowHeight = 50;

			listView.ItemTapped += (sender, args) => {

				if (listView.SelectedItem == null)
					return;

				if (Device.OS == TargetPlatform.WinPhone) {
					Navigation.PushModalAsync (new ArticleView (listView.SelectedItem as FeedItem));
				} else {
					Navigation.PushAsync (new ArticleView (listView.SelectedItem as FeedItem));
				}


				listView.SelectedItem = null;
			};

			listView.ItemTemplate = cell;

			stack.Children.Add (listView);

			Content = stack;
		}
Ejemplo n.º 20
0
        public TeamsView()
        {
            BindingContext = new TeamsViewModel();

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

            var activity = new ActivityIndicator {
                Color = Helpers.Color.Greenish.ToFormsColor(),
                IsEnabled = true
            };
            activity.SetBinding (ActivityIndicator.IsVisibleProperty, "IsBusy");
            activity.SetBinding (ActivityIndicator.IsRunningProperty, "IsBusy");

            stack.Children.Add (activity);
            var searchBar = new SearchBar();
            searchBar.TextChanged +=  (sender, e) => {
                ViewModel.FilterTeams(searchBar.Text);
            };
            var listView = new ListView();

            listView.ItemsSource = ViewModel.Teams;
            var cell = new DataTemplate(typeof(HorizontalListTextCell));

            cell.SetBinding (ImageCell.TextProperty, "Name");
            cell.SetBinding(ImageCell.DetailProperty, "Abbreviation");
            //            cell.SetBinding(ImageCell.ImageSourceProperty, "");

            listView.ItemTapped +=  (sender, args) => {
                if(listView.SelectedItem == null)
                    return;
                this.Navigation.PushAsync(new TeamDetailView(listView.SelectedItem as Team));
                listView.SelectedItem = null;
            };

            listView.ItemTemplate = cell;
            stack.Children.Add(searchBar);
            stack.Children.Add (listView);

            Content = stack;
        }
		public BeerListView ()
		{
			// you need a view model to bind to

			// setup your ViewModel

			ViewModel = new BeerListViewViewModel
			{
				
			};
			// Set the binding context to the newly created ViewModel
			BindingContext = ViewModel;

			listView = new ListView {
//				HasUnevenRows = true

			};

			//need to add a Details Push Event on the ITemSelected here when working done
			listView.ItemSelected += (sender, e) => {
				Navigation.PushAsync(new BeerDetail(e.SelectedItem as Beer));
			};

			var activityIndicator = new ActivityIndicator
			{
				Color = Color.Black,
			};
			activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
			activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");


			this.Title = "All our Beers on Tap";
			this.Content = new StackLayout {
				Padding = new Thickness (0, Device.OnPlatform (0, 0, 0), 0, 0),
				Spacing = 3,
				Orientation = StackOrientation.Vertical,
				Children = {
					activityIndicator,listView
				}
			};

		}
Ejemplo n.º 22
0
        public MainPage()
        {
            var listView = new ListView();
            //Create buttons

            var btnMenuPage = new Button
            {
                Text = "Go To MenuPage",
                BackgroundColor = Color.Red,
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            var btnSettingsMenu = new Button
            {
                Text = "Go To Settings",
                BackgroundColor = Color.Gray,
                VerticalOptions = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            //Events
            var ai = new ActivityIndicator { IsRunning = true, IsEnabled = true, BindingContext = this };
            ai.SetBinding(IsVisibleProperty, "IsBusy");

            btnMenuPage.Clicked += async (sender, e) =>
            {
                try
                {
                    IsBusy = true;
                    var serviceBusInit = await ServiceBusApi.Fetch();

                    await Navigation.PushModalAsync(new NavigationPage(new MenuPage(serviceBusInit.MenuItems)));
                }
                catch (Exception)
                {
                    DisplayAlert("Fout", "Geen reactie van de server ontvangen. Controleer instellingen", "OK");
                }
                finally
                {
                    IsBusy = false;
                }

            };

            btnSettingsMenu.Clicked += (sender, e) => Navigation.PushModalAsync(new SettingsPage());

            Content = new StackLayout
            {
                Padding = 20,
                Children = { listView, ai, btnMenuPage, btnSettingsMenu }
            };
        }
Ejemplo n.º 23
0
        public AuthorArticlePage (string title,AuthorDataType authorDataType)
        {
            Title = title;
            NavigationPage.SetHasNavigationBar(this, true);
            NavigationPage.SetHasBackButton(this,true);
            NavigationPage.SetBackButtonTitle(this,"Profile");
            authorDataViewModel = new AuthorDataViewModel(authorDataType);
            authorDataViewModel.GetAuthorDataCommand.Execute(null);
            var activityIndicator = new ActivityIndicator
            {
                Color = Color.Gray,
            };
            activityIndicator.SetBinding(IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            var vetlist = new ListView
            {
                HasUnevenRows = false,
                ItemTemplate = new DataTemplate(typeof(CPListCell)),
                ItemsSource = authorDataViewModel.AutorItems,
                BackgroundColor = Color.White,
                RowHeight = 120,
            };

            //vetlist.SetBinding<ArticlePageViewModel>();
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { vetlist }
            };

            vetlist.ItemSelected += (sender, e) =>
            {
                var selectedObject = e.SelectedItem as CPMobile.Models.Item;

                var WebViewPage = new WebViewPage(title, selectedObject.websiteLink.HttpUrlFix());
                Navigation.PushAsync(WebViewPage);
            };
        }
Ejemplo n.º 24
0
        public ForumDetailListPage(string name,int forumId)
        {
            Title = name;
            NavigationPage.SetHasNavigationBar(this, true);
            BindingContext=forumViewModel = new ForumDetailsViewModel(forumId);
            forumViewModel.GetForumListCommand.Execute(null);

            var activityIndicator = new ActivityIndicator
            {
                Color = Color.Gray,
            };
            activityIndicator.SetBinding(IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            var vetlist = new ListView
            {
                HasUnevenRows = false,
                ItemTemplate = new DataTemplate(typeof(CPListCell)),
                ItemsSource = forumViewModel.ForumList,
                BackgroundColor = Color.White,
                RowHeight = 120,
            };

            //vetlist.SetBinding<ArticlePageViewModel>();
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { vetlist }
            };

            vetlist.ItemSelected += (sender, e) =>
            {
                var selectedObject = e.SelectedItem as CPMobile.Models.Item;

                var WebViewPage = new WebViewPage(name,  selectedObject.websiteLink);
                Navigation.PushAsync(WebViewPage);
            };
        }
Ejemplo n.º 25
0
        public ArticleListPage()
        {
           articleViewModel = new ArticleViewModel();
           articleViewModel.GetCPFeedCommand.Execute(null);
            var activityIndicator = new ActivityIndicator
            {
                Color = Color.White,
            };
            activityIndicator.SetBinding(IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            var vetlist = new ListView
            {
                HasUnevenRows = false,
                ItemTemplate = new DataTemplate(typeof(CPListCell)),
                ItemsSource = articleViewModel.Articles,
                BackgroundColor = Color.White,
                RowHeight=120,
            };
           
            //vetlist.SetBinding<ArticlePageViewModel>();
             Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { vetlist  }
            };

             vetlist.ItemSelected += (sender, e) =>
             {
                 var selectedObject = e.SelectedItem as CPMobile.Models.Item;

                 var WebViewPage = new WebViewPage("General Articles",string.Format("http:{0}",selectedObject.websiteLink));
                 Navigation.PushAsync(WebViewPage);
                // Navigation.PushAsync( );
             };
           
        }
		public WhatsOnTapPage ()
		{
			ViewModel = new BeerListViewViewModel
			{

			};
			// Set the binding context to the newly created ViewModel
			BindingContext = ViewModel;

			Title = "Whats On Tap Today";

			lv = new ListView ();

			lv.ItemTemplate = new DataTemplate (typeof(ListOfBeerCell2)); 

			lv.ItemSelected += (sender, e) => {
				Navigation.PushAsync(new BeerDetail(e.SelectedItem as Beer));
			};
					
			var activityIndicator = new ActivityIndicator
			{
				Color = Color.Black,
			};
			activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
			activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");



			Content = new StackLayout { 
				Padding = new Thickness (0, Device.OnPlatform (0, 0, 0), 0, 0),
				Spacing = 3,
				Orientation = StackOrientation.Vertical,
				Children = {
					activityIndicator,lv
				}
			};

		}
Ejemplo n.º 27
0
        public InviteToAppPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            Title = "Contacts";

            var contactsCountLabel = new SquawkLabel();
            contactsCountLabel.SetBinding(Label.TextProperty, new Binding("Contacts.Count", stringFormat: "{0} contacts."));

            var tipLabel = new SquawkLabel();
            tipLabel.Text = "Select a contact to send an invitation";

            var listView = new BindableListView
                {
                    ItemTemplate = new DataTemplate(() =>
                        {
                            var imageCell = new ImageCell
                                {
                                    ImageSource = Device.OnPlatform(
                                        ImageSource.FromFile("empty_contact.jpg"),
                                        ImageSource.FromFile("empty_contact.jpg"),
                                        ImageSource.FromFile("Assets/empty_contact.jpg")),
                                };
                            imageCell.SetBinding(TextCell.TextProperty, new Binding("Name"));
                            imageCell.SetBinding(TextCell.DetailProperty, new Binding("Number"));
                            return imageCell;
                        }),
                    IsGroupingEnabled = true,
                    GroupDisplayBinding = new Binding("Name"),
                };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("GroupedContacts"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("ContactSelectedCommand"));

            var loadingIndicator = new ActivityIndicator();
            loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));

            Content = new StackLayout
                {
                    Children =
                        {
                            loadingIndicator,
                            contactsCountLabel,
                            tipLabel,
                            listView
                        }
                };
        }
Ejemplo n.º 28
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;
        }
Ejemplo n.º 29
0
        public LoadingPage(RootPage rootPage)
        {
            _rootPage = rootPage;
            NavigationPage.SetHasNavigationBar (this, false);

            //TODO : Inject ForecastService

            _viewModel = new LoadingViewModel (Navigation, new ForecastService (new OpenWeatherMapService (new HttpClient ())), rootPage);
            BindingContext = _viewModel;

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

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

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

            var loadingImage = new Image ();

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

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

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

            var activityIndicator = new ActivityIndicator{ IsRunning = true };

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

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

            Content = stackLayout;
        }
        public OnlineUsersPage(ViewModelBase viewModel) : base(viewModel)
        {
            Title = "Participants";
            Icon = "group.png";

            var usersCountLabel = new Label();
            usersCountLabel.SetBinding(Label.TextProperty, new Binding("Users.Count", stringFormat: "  {0} users online."));
            
            var listView = new BindableListView
                {
                    ItemTemplate = new DataTemplate(() =>
                        {
                            var imageCell = new ImageCell
                                {
                                    ImageSource = Device.OnPlatform(
                                        ImageSource.FromFile("empty_contact.jpg"),
                                        ImageSource.FromFile("empty_contact.jpg"),
                                        ImageSource.FromFile("Assets/empty_contact.jpg")),
                                };
                            imageCell.SetBinding(TextCell.TextProperty, new Binding("Name"));
                            imageCell.SetBinding(TextCell.DetailProperty, new Binding("Description"));
                            return imageCell;
                        })
                };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("Users"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("ContactSelectedCommand"));

            var contactsLoadingIndicator = new ActivityIndicator();
            contactsLoadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));

            Content = new StackLayout
                {
                    Children =
                            {
                                contactsLoadingIndicator,
                                usersCountLabel,
                                listView
                            }
                };
        }