예제 #1
0
		public void Setup(){
			mockStaffMemberDataRepository = new Mock<IStaffMember> ();

			//Set up a template folder
			templateFolder = new TemplateFolder ();

			//Create a simple template
			TemplateViewModel simpleTemplate = new TemplateViewModel ();
			simpleTemplate.TemplateName = "Back Blaster";
			simpleTemplate.TemplateDescription = "Back Blaster Description";

			templateFolder.Template = simpleTemplate;

			//Create 2 simple exercise objects
			ExerciseViewModel exercise1 = new ExerciseViewModel ();
			exercise1.SetsIndex = 1;
			exercise1.RepsIndex = 2;
			exercise1.WeightIndex = 2;
			exercise1.SeatPosition1Label = 1;
			exercise1.SeatPosition1Value = 1;

			ExerciseViewModel exercise2 = new ExerciseViewModel ();
			exercise1.SetsIndex = 2;
			exercise1.RepsIndex = 1;
			exercise1.WeightIndex = 2;
			exercise1.SeatPosition1Label = 2;
			exercise1.SeatPosition1Value = 1;

			//Add exercises to observable collectin in the template folder
			templateFolder.Exercises.Add (exercise1);
			templateFolder.Exercises.Add (exercise2);

			StaffMember staffMember = new StaffMember ();
			staffMember.FirstName = "Clay";
			staffMember.LastName = "Martin";
			staffMember.GymID = 8;
			staffMember.PhoneNumber = "5024171595";
			staffMember.StaffID = 132;

			templateFolder.StaffMember = staffMember;

			primaryOptionsViewModel = new PrimaryOptionsViewModel (mockStaffMemberDataRepository.Object, templateFolder);
		}
예제 #2
0
		public PrimaryOptionsPage (Task taskResponder = null, ProgressClass progressClass = null)
		{
			InitializeComponent ();
			_viewModel = new PrimaryOptionsViewModel (Manager.Instance.StaffMember, App.WorkoutCreatorContext);

            //Subscribe to messages to check need to display feedback outbox
            MessagingCenter.Subscribe<ModalWorkoutCreationPage>(this, "Check for dirty feedback", (sender) =>
            {
                this.ProcessFeedbackOutbox();
            });

            MessagingCenter.Subscribe<FeedbackOutboxPage>(this, "Check for dirty feedback", (sender) =>
            {
                this.ProcessFeedbackOutbox();
            });
					
			if (taskResponder != null) {
                progressClass.ProgressEvent += ((sender, args) =>
                {
                    DependencyService.Get<ICustomLoader>().UpdateProgress((float)progressClass.CurrentPercentage);
                });

                Device.BeginInvokeOnMainThread(() =>
                {
                    DependencyService.Get<ICustomLoader>().Display("Loading branch inventory...");
                });
                

				createTemplateButton.IsVisible = false;
                assignTemplateButton.IsVisible = false;
                viewMemberTemplateButton.IsVisible = false;
               
				Action<Task> action =
					(str) =>
					Device.BeginInvokeOnMainThread ( () => {
                        createTemplateButton.IsVisible = true;
                        assignTemplateButton.IsVisible = true;
                        viewMemberTemplateButton.IsVisible = true;
                        DependencyService.Get<ICustomLoader>().Hide();
					});
				taskResponder.ContinueWith(action);
			}

			createTemplateButton.Clicked += async (sender2, args2) =>
			{
				//Uses session tracking
				Insights.Track("Record Workout Clicked", new Dictionary<string, string>()
					{
					});
				await Navigation.PushAsync (new ExerciseContainerPage ());
			};

			assignTemplateButton.Clicked += async (sender2, args2) => {
				//Uses session tracking
				Insights.Track("Assign Workout Clicked", new Dictionary<string, string>()
					{
					});
				await Navigation.PushAsync (new TemplateListPage ());
			};

			viewMemberTemplateButton.Clicked += async (sender2, args2) =>
			{
				//Uses session tracking
				Insights.Track("Review Workout Clicked", new Dictionary<string, string>()
					{
					});
				await Navigation.PushAsync (new MemberTemplatesListPage ());
			};

            ProcessFeedbackOutbox();
		}