コード例 #1
0
        public ReviewExercisePage(ExerciseViewModel exercise)
        {
			Title = "Review Exercise Details";

            Label exerciseNameLabel = new Label
            {
                Text = exercise.Exercise.ExerciseName,
				FontSize = 45
            };
            Label exerciseCategoryLabel = new Label
            {
                Text = exercise.Exercise.Bodypart,
				FontSize = 40
            };
            StackLayout exerciseStack = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children =
                {
                    exerciseNameLabel,
                    exerciseCategoryLabel
                }
            };
            Image exerciseImage = new Image
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                WidthRequest = 180,
                HeightRequest = 180,
            };

            var exerciseFrame = new Frame
            {
                Content = exerciseImage,
                OutlineColor = Color.Silver,
                Padding = new Thickness(20),
                HorizontalOptions = LayoutOptions.EndAndExpand,
            };

            try
            {

                if (exercise.Exercise.ImageFile.Trim() != "")
                {
                    String imageBasePath = "http://www.mymobilefit.com/StrengthImages/";
                    String finalImagePath = imageBasePath + exercise.Exercise.ImageFile.Trim();

                    exerciseImage.Source = new UriImageSource
                    {
                        Uri = new Uri(finalImagePath),
                        CachingEnabled = true,
                        CacheValidity = new TimeSpan(5, 0, 0, 0)
                    };
                }
            }
            catch (Exception e2)
            {
                String exceptionMessage = e2.Message;
            }


			Label seatPosition1Label = new Label()
            {
				Text = exercise.GetSeatPosition1Summary()
            };
          
			Label seatPosition2Label = new Label
            {
				Text = exercise.GetSeatPosition2Summary()
            };

			Label seatPosition3Label = new Label
			{
				Text = exercise.GetSeatPosition3Summary()
			};

			Label seatPosition4Label = new Label
			{
				Text = exercise.GetSeatPosition4Summary()
			};

            StackLayout exercisePrescriptionHeaderStackLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation = StackOrientation.Horizontal,
                Children =
                {
                    exerciseStack,
                    exerciseFrame
                }
            };

			Label setLabel = new Label
            {
				Text = exercise.GetSetsValue().ToString()
            };
            
			Label repLabel = new Label
			{
				Text = exercise.GetRepsValue().ToString()
            };


			Label weightLabel = new Label
            {
				Text = exercise.GetWeightValue().ToString()
            };

            //Set selected index bindings
            this.BindingContext = exercise;

			StackLayout labelsStackLayout = new StackLayout {
				Padding = new Thickness (20),
				Children = {
					exercisePrescriptionHeaderStackLayout,
					new StackLayout {
						Children = {
							new Label {
								Text = "Target Sets: "
							},
							setLabel

						},
						Orientation = StackOrientation.Horizontal,
						Padding = new Thickness (10),
						Spacing = 40
					},
					// entry,
					new StackLayout {
						Children = {
							new Label {
								Text = "Target Reps: "

							},
							repLabel
						},
						Orientation = StackOrientation.Horizontal,
						Padding = new Thickness (10),
						Spacing = 40
					},
					//editor,
					new StackLayout {
						Children = {
							new Label {
								Text = "Target Weight (lbs):  "
							},
							weightLabel
						},
						Orientation = StackOrientation.Horizontal,
						Padding = new Thickness (10),
						Spacing = 40
					},
					new StackLayout {
						Children = {
							new Label {
								Text = "Seat Pos 1:  "
							},
							seatPosition1Label
						},
						Orientation = StackOrientation.Horizontal,
						Padding = new Thickness (10),
						Spacing = 35
                            
					},
					new StackLayout {
						Children = {
							new Label {
								Text = "Seat Pos 2:  "
							},
							seatPosition2Label
						},
						Orientation = StackOrientation.Horizontal,
						Padding = new Thickness (10),
						Spacing = 35
					},
					new StackLayout {
						Children = {
							new Label {
								Text = "Seat Pos 3:  "
							},
							seatPosition3Label
						},
						Orientation = StackOrientation.Horizontal,
						Padding = new Thickness (10),
						Spacing = 35
                  
					},
					new StackLayout {
						Children = {
							new Label {
								Text = "Seat Pos 4:  "
							},
							seatPosition4Label
						},
						Orientation = StackOrientation.Horizontal,
						Padding = new Thickness (10),
						Spacing = 35
					}
				}
			};
            
            this.BackgroundColor = Color.FromRgb(0, 191, 255);
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 0);
            this.Content = labelsStackLayout;
        }