Exemplo n.º 1
0
        public AddCheeseAndRatingViewModel(ContentPage thePage)
        {
            _dataService = DependencyService.Get <ICheeseDataService> ();
            Title        = "Add That Cheese!";
            Page         = thePage;

            CheeseToAdd = new CheeseAndRating();
        }
        public RatingDetailViewModel(CheeseAndRating rating, ContentPage page)
        {
            _dataService = DependencyService.Get <ICheeseDataService> ();

            Page = page;

            RatingDetails = rating;
        }
Exemplo n.º 3
0
		public RatingDetailViewModel (CheeseAndRating rating, ContentPage page)
		{
			_dataService = DependencyService.Get<ICheeseDataService> ();

			Page = page;

			RatingDetails = rating;
		}
		public AddCheeseAndRatingViewModel (ContentPage thePage)
		{
			_dataService = DependencyService.Get<ICheeseDataService> ();
			Title = "Add That Cheese!";
			Page = thePage;

			CheeseToAdd = new CheeseAndRating ();
		}
Exemplo n.º 5
0
		public AddRatingViewModel (Cheese cheese, ContentPage page)
		{
			_dataService = DependencyService.Get<ICheeseDataService> ();

			RatingToAdd = new CheeseAndRating () {
				CheeseId = cheese.CheeseId,
				CheeseName = cheese.CheeseName,
				DairyName = cheese.DairyName
			};

			Page = page;
		}
Exemplo n.º 6
0
        public AddRatingViewModel(Cheese cheese, ContentPage page)
        {
            _dataService = DependencyService.Get <ICheeseDataService> ();

            RatingToAdd = new CheeseAndRating()
            {
                CheeseId   = cheese.CheeseId,
                CheeseName = cheese.CheeseName,
                DairyName  = cheese.DairyName
            };

            Page = page;
        }
Exemplo n.º 7
0
        public RatingDetailView(CheeseAndRating theRating)
        {
            _viewModel     = new RatingDetailViewModel(theRating, this);
            BindingContext = _viewModel;

            this.SetBinding(ContentPage.TitleProperty, "Title");

            AbsoluteLayout cheeseInfoLayout = new AbsoluteLayout {
                HeightRequest   = 250,
                BackgroundColor = CheeseColors.PURPLE
            };

            var cheeseName = new Label {
                FontSize   = 30,
                FontFamily = "AvenirNext-DemiBold",
                TextColor  = Color.White
            };

            cheeseName.SetBinding(Label.TextProperty, "CheeseName");

            var dairyName = new Label {
                TextColor  = Color.FromHex("#ddd"),
                FontFamily = "AvenirNextCondensed-Medium"
            };

            dairyName.SetBinding(Label.TextProperty, "DairyName");

            var image = new Image()
            {
                Source = ImageSource.FromFile("Dairy_cow.jpg"),
                Aspect = Aspect.AspectFill,
            };

            var overlay = new BoxView()
            {
                Color = Color.Black.MultiplyAlpha(.7f)
            };

            var notesLabel = new Label()
            {
                FontSize  = 14,
                TextColor = Color.FromHex("#ddd")
            };

            notesLabel.SetBinding(Label.TextProperty, "RatingDescription");

            var description = new Frame()
            {
                Padding         = new Thickness(10, 5),
                HasShadow       = false,
                BackgroundColor = Color.Transparent,
                Content         = notesLabel
            };

            AbsoluteLayout.SetLayoutFlags(overlay, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(overlay, new Rectangle(0, 1, 1, 0.3));

            AbsoluteLayout.SetLayoutFlags(image, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(image, new Rectangle(0f, 0f, 1f, 1f));

            AbsoluteLayout.SetLayoutFlags(cheeseName, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(cheeseName,
                                           new Rectangle(0.1, 0.85, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)
                                           );

            AbsoluteLayout.SetLayoutFlags(dairyName, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(dairyName,
                                           new Rectangle(0.1, 0.95, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)
                                           );

            cheeseInfoLayout.Children.Add(image);
            cheeseInfoLayout.Children.Add(overlay);
            cheeseInfoLayout.Children.Add(cheeseName);
            cheeseInfoLayout.Children.Add(dairyName);
//			cheeseInfoLayout.Children.Add (pin);

//			var page = new ContentPage { Content = new StackLayout () {
//					BackgroundColor = Color.FromHex ("#333"),
//					Children = {
//						cheeseInfoLayout,
//						description,
//					}
//				}
//			};
//
//			Content = page;

            Content = new StackLayout()
            {
                BackgroundColor = Color.FromHex("#333"),
                Children        =
                {
                    cheeseInfoLayout, description
                }
            };
        }
Exemplo n.º 8
0
        public RatingDetailView(CheeseAndRating theRating)
        {
            _viewModel = new RatingDetailViewModel (theRating, this);
            BindingContext = _viewModel;

            this.SetBinding (ContentPage.TitleProperty, "Title");

            AbsoluteLayout cheeseInfoLayout = new AbsoluteLayout {
                HeightRequest = 250,
                BackgroundColor = CheeseColors.PURPLE
            };

            var cheeseName = new Label {
                FontSize = 30,
                FontFamily = "AvenirNext-DemiBold",
                TextColor = Color.White
            };
            cheeseName.SetBinding (Label.TextProperty, "CheeseName");

            var dairyName = new Label {
                TextColor = Color.FromHex ("#ddd"),
                FontFamily = "AvenirNextCondensed-Medium"
            };
            dairyName.SetBinding (Label.TextProperty, "DairyName");

            var image = new Image () {
                Source = ImageSource.FromFile ("Dairy_cow.jpg"),
                Aspect = Aspect.AspectFill,
            };

            var overlay = new BoxView () {
                Color = Color.Black.MultiplyAlpha (.7f)
            };

            var notesLabel = new Label () {
                FontSize = 14,
                TextColor = Color.FromHex("#ddd")
            };

            notesLabel.SetBinding (Label.TextProperty, "RatingDescription");

            var description = new Frame () {
                Padding = new Thickness (10, 5),
                HasShadow = false,
                BackgroundColor = Color.Transparent,
                Content = notesLabel
            };

            AbsoluteLayout.SetLayoutFlags (overlay, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds (overlay, new Rectangle (0, 1, 1, 0.3));

            AbsoluteLayout.SetLayoutFlags (image, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds (image, new Rectangle (0f, 0f, 1f, 1f));

            AbsoluteLayout.SetLayoutFlags (cheeseName, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds (cheeseName,
                new Rectangle (0.1, 0.85, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)
            );

            AbsoluteLayout.SetLayoutFlags (dairyName, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds (dairyName,
                new Rectangle (0.1, 0.95, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)
            );

            cheeseInfoLayout.Children.Add (image);
            cheeseInfoLayout.Children.Add (overlay);
            cheeseInfoLayout.Children.Add (cheeseName);
            cheeseInfoLayout.Children.Add (dairyName);
            //			cheeseInfoLayout.Children.Add (pin);

            //			var page = new ContentPage { Content = new StackLayout () {
            //					BackgroundColor = Color.FromHex ("#333"),
            //					Children = {
            //						cheeseInfoLayout,
            //						description,
            //					}
            //				}
            //			};
            //
            //			Content = page;

            Content = new StackLayout () {
                BackgroundColor = Color.FromHex ("#333"),
                Children = {
                    cheeseInfoLayout, description
                }
            };
        }