public async Task LoadAsync()
        {
            var lookup = await _clientLookupService.GetClientLookupAsync();

            Clients.Clear();
            foreach (var item in lookup)
            {
                Clients.Add(new NavigationItemViewModel(item.Id, item.DisplayMember, _eventAggregator, nameof(ClientDetailViewModel)));
            }

            lookup = await _workoutLookupService.GetWorkoutLookupAsync();

            Workouts.Clear();
            foreach (var item in lookup)
            {
                Workouts.Add(new NavigationItemViewModel(item.Id, item.DisplayMember, _eventAggregator, nameof(WorkoutDetailViewModel)));
            }

            lookup = await _exerciseLookupDataService.GetExerciseLookupAsync();

            Exercises.Clear();
            foreach (var item in lookup)
            {
                Exercises.Add(new NavigationItemViewModel(item.Id, item.DisplayMember, _eventAggregator, nameof(ExerciseDetailViewModel)));
            }
        }
Example #2
0
        async Task ExecuteLoadExercisesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Exercises.Clear();
                var exercises = await App.Database.GetExercisesAsync();

                //var items = await App.Database.GetItemsAsync();

                foreach (var exercise in exercises)
                {
                    Debug.WriteLine("Adding: " + exercise.name + " to Exercises Collection... ID = " + exercise.eID + "ItemID= " + exercise.ItemID);
                    if (ParentItem.ID == exercise.ItemID)
                    {
                        Exercises.Add(exercise);
                        Debug.WriteLine("Exercises in this list size: " + Exercises.Count + ". PItemID:" + ParentItem.ID + " eID:" + exercise.ItemID);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        private async Task LoadExerciseLookupAsync()
        {
            Exercises.Clear();
            //Exercises.Add(new NullLookupItem { DisplayMember = " - " });
            var lookup = await _exerciseLookupDataService.GetExerciseLookupAsync();

            foreach (var lookupItem in lookup)
            {
                Exercises.Add(lookupItem);
            }
        }
Example #4
0
        public async void ListAllExercise()
        {
            Exercises.Clear();
            if (await DatabaseExercise.ListExercise())
            {
                var ex = await DatabaseExercise.GetExercises();

                foreach (var e in ex)
                {
                    Exercises.Add(e);
                }
            }
        }
Example #5
0
 public void Update()
 {
     Exercises.Clear();
     Training.Exercises.Load();
     foreach (var trainingExercise in Training.Exercises)
     {
         var exercise = RepoExercise.Instance.FindById(trainingExercise.IdExecise);
         if (exercise != null)
         {
             Exercises.Add(new TrainingExerciseVM(trainingExercise, exercise, () => NotifyPropertyChanged("Exercises")));
         }
     }
 }
Example #6
0
        public void ReadExercises()
        {
            // Summary
            //
            // Read exercises from Database with DBHelper class. Clear existing exercises first.

            var exercises = DatabaseHelper.GetExercises();

            Exercises.Clear();

            foreach (Exercise exercise in exercises)
            {
                Exercises.Add(exercise);
            }
        }
Example #7
0
        public void Update()
        {
            NotifyPropertyChanged("Title");
            Exercises.Clear();
            foreach (Exercise exercise in _workout.Exercises.OrderBy(x => x.Order))
            {
                Exercises.Add(new ExerciseVM(exercise, this));
            }

            NotifyPropertyChanged("IsExercisesEmpty");
            if (UpdateAppMenu != null)
            {
                UpdateAppMenu();
            }
        }
        public async void LoadExercises()
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(@"http://localhost:50562/api/");

                var json = await client.GetStringAsync("Exercises");

                Exercise[] exercises = JsonConvert.DeserializeObject <Exercise[]>(json);

                Exercises.Clear();
                foreach (var w in exercises)
                {
                    Exercises.Add(w);
                }
            }
        }
Example #9
0
        public void ReadExercises(ExerciseType filter)
        {
            // Summary
            //
            // Read exercises and filter the list by a ExerciseType

            var exercises = DatabaseHelper.GetExercises();

            Exercises.Clear();

            foreach (Exercise exercise in exercises)
            {
                if (exercise.ExerciseType == filter)
                {
                    Exercises.Add(exercise);
                }
            }
        }
Example #10
0
        public async void ListEx(string Uid, string Cid)
        {
            Exercises.Clear();
            if (await DatabaseDetailCard.ListExercise(Uid,
                                                      Cid,
                                                      Application.Current.Properties["selectedDay"].ToString(),
                                                      Application.Current.Properties["selectedWeek"].ToString()))
            {
                var ex = await DatabaseDetailCard.GetExercises();

                foreach (var e in ex)
                {
                    Exercises.Add(e);
                }
                if (!Exercises.Any() && !Application.Current.Properties["Admin"].Equals("true"))
                {
                    await PopupNavigation.PushAsync(new PopupError());
                }
            }
        }
Example #11
0
        private void CreateDefaultSession()
        {
            Sessions.Clear();
            Exercises.Clear();

            Session x = new Session();

            x.Name = "Default";
            x.Id   = ++Globals.Id_Gen;

            Exercise e1 = new Exercise();

            e1.Name        = "5s Speed";
            e1.Instruction = "Draw as much as you can in 5s.";
            e1.Duration    = new TimeSpan(0, 0, 5);
            e1.Difficulty  = "Medium";
            Exercises.Add(e1);

            Exercise e2 = new Exercise();

            e2.Name        = "5Min Speed";
            e2.Instruction = "Draw as much as you can.";
            e2.Duration    = new TimeSpan(0, 5, 0);
            e2.Difficulty  = "Medium";
            Exercises.Add(e2);

            Exercise e3 = new Exercise();

            e3.Name        = "5s Break";
            e3.Instruction = "5s Break";
            e3.Duration    = new TimeSpan(0, 0, 5);
            e3.Difficulty  = "";
            Exercises.Add(e3);

            x.Exercises.Add(e1.Id);
            x.Exercises.Add(e3.Id);
            //  x.Exercises.Add(e2.Id);

            Sessions.Add(x);
        }