Esempio n. 1
0
        void ViewExercises(object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {
            WorkoutList item = (WorkoutList)((ListView)sender).SelectedItem;

            ((ListView)sender).SelectedItem = null;
            Navigation.PushAsync(new ViewExercisesPage(item));
        }
        public async Task <IActionResult> Edit(int id, [Bind("WorkoutId,UserId,Exercise_One,Exercise_Two,Exercise_Three,Exercise_Four,Exercise_Five,Exercise_Six,Exercise_Seven,Exercise_Eight,Exercise_Nine,Exercise_Ten,Exercise_Name")] WorkoutList workoutList)
        {
            if (id != workoutList.WorkoutId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(workoutList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkoutListExists(workoutList.WorkoutId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(workoutList));
        }
Esempio n. 3
0
        private void BindData()
        {
            WorkoutBLL workout = new WorkoutBLL(connectionString);

            WorkoutList.DataSource = workout.GetAllWorkouts();
            WorkoutList.DataBind();
        }
Esempio n. 4
0
    public void save()
    {
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        FileStream      file            = File.Open(Application.persistentDataPath + "/workoutTable.dat", FileMode.Open);
        WorkoutList     workoutHistory  = (WorkoutList)binaryFormatter.Deserialize(file);

        file.Close();


        Debug.Log("The current length of the workoutTable is: " + workoutHistory.workoutTable.Count);

        List <String> workoutDetailsList = new List <String> ();

        workoutDetailsList.Add(this.workoutNameField.text);
        workoutDetailsList.Add(this.numberOfSetsField.text);
        workoutDetailsList.Add(this.startTimerField.text);
        workoutDetailsList.Add(this.restTimerField.text);
        workoutDetailsList.Add(this.goalRepsField.text);

        workoutHistory.workoutTable.Add(this.workoutNameField.text, workoutDetailsList);

        Debug.Log("This is the table size before insertion: " + workoutHistory.workoutTable.Count);

        file = File.Create(Application.persistentDataPath + "/workoutTable.dat");
        binaryFormatter.Serialize(file, workoutHistory);
        file.Close();

        debugText.text = "Inserted into the workout table file.";
    }
Esempio n. 5
0
        public async Task AddExerciseToInternalDb(string pickerListString)
        {
            var exerciseId = await ExerciseName.GetAllExerciseNameRecordsByExerciseNameString(_connection, pickerListString);

            if (exerciseId.Count > 1)
            {
                return;
            }

            int      exerciseIdForInsert = exerciseId[0].Id;
            DateTime now      = DateTime.Now;
            var      exercise = new Models.Persistence.Exercise
            {
                DateOfExercise = now,
                WorkoutId      = WorkoutId,
                ExerciseNameId = exerciseIdForInsert
            };

            await _connection.InsertAsync(exercise);

            var exerciseCheck = await Exercise.GetAllExerciseRecordsByDate(_connection, now);

            WorkoutList workout = new WorkoutList()
            {
                Id = WorkoutId
            };

            await Navigation.PushAsync(new Views.Workout.ViewExercisesPage(workout));

            Navigation.RemovePage(this);
        }
Esempio n. 6
0
        public async Task UpdateExercise(string pickerListString, DateTime date)
        {
            var exerciseId = await ExerciseName.GetAllExerciseNameRecordsByExerciseNameString(_connection, pickerListString);

            if (exerciseId.Count > 1)
            {
                return;
            }

            int exerciseIdForInsert = exerciseId[0].Id;

            var exercise = new Models.Persistence.Exercise
            {
                Id             = ExerciseId,
                DateOfExercise = date,
                WorkoutId      = WorkoutId,
                ExerciseNameId = exerciseIdForInsert
            };

            await _connection.UpdateAsync(exercise);

            WorkoutList workout = new WorkoutList()
            {
                Id = WorkoutId
            };

            await Navigation.PushAsync(new Views.Workout.ViewExercisesPage(workout));

            Navigation.RemovePage(this);
        }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        // Sets the top button to the chosen exercise name.
        sceneTitle.GetComponentInChildren <Text> ().text = exerciseName;

        // Sets the bottom button's text to "Start Exercise".
        actionButton.GetComponentInChildren <Text> ().text = "Start Exercise";

        // Sets the current stage text.
        currentStageText.text = "Waiting to start exercise...";

        // Retrieves file with same exercise details.
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        FileStream      file            = File.Open(Application.persistentDataPath + "/workoutTable.dat", FileMode.Open);
        WorkoutList     workoutHistory  = (WorkoutList)binaryFormatter.Deserialize(file);

        file.Close();

        // Sets the text fields to the stored values.
        numberOfSetsField.text = ((List <string>)workoutHistory.workoutTable[exerciseName])[1];
        startTimerField.text   = ((List <string>)workoutHistory.workoutTable[exerciseName])[2];
        restTimerField.text    = ((List <string>)workoutHistory.workoutTable[exerciseName])[3];

        // Parses the start time entered by the user to a float and sets the start timer
        startTimerVal = float.Parse(startTimerField.text);
        restTimerVal  = float.Parse(restTimerField.text);
    }
Esempio n. 8
0
        public async Task <List <RideDatum> > GetWorkoutListAsync(AuthResponse auth, ILogger logger, string saveFileDirectory = null)
        {
            var    rideDataList = new List <RideDatum>();
            string cookie       = $"peloton_session_id={auth.session_id}";
            int    pageNum      = 0;

            while (true)
            {
                string url = $"https://api.onepeloton.com/api/user/{auth.user_id}/workouts?joins=ride&limit=20&page={pageNum}";
                using (var client = new WebClient())
                {
                    client.Headers.Add(HttpRequestHeader.Cookie, cookie);
                    client.Headers["accept"]           = "application/json";
                    client.Headers["origin"]           = "https://members.onepeloton.com";
                    client.Headers["accept-language"]  = "en-US,en;q=0.9";
                    client.Headers["user-agent"]       = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36";
                    client.Headers["accept"]           = "application/json";
                    client.Headers["referer"]          = "https://members.onepeloton.com/profile/workouts";
                    client.Headers["authority"]        = "api.onepeloton.com";
                    client.Headers["x-requested-with"] = "XmlHttpRequest";
                    client.Headers["peloton-platform"] = "web";

                    if (logger != null)
                    {
                        logger.Log($"Requesting page {pageNum + 1}");
                    }
                    var response = await client.DownloadStringTaskAsync(new Uri(url));

                    Debug.WriteLine("  " + response.Substring(0, 50));
                    Debug.WriteLine($"  Length: {response.Length}");

                    if (saveFileDirectory != null)
                    {
                        string saveJsonPath  = Path.Combine(saveFileDirectory, $"workoutListPage_{pageNum}.json");
                        var    formattedJson = JToken.Parse(response).ToString(Formatting.Indented);
                        File.WriteAllText(saveJsonPath, formattedJson);
                    }

                    WorkoutList workoutList = JsonConvert.DeserializeObject <WorkoutList>(response, JSonSerializerSettings);
                    if (logger != null)
                    {
                        logger.Log($"Page retrieved, contains {workoutList.count} workouts");
                    }

                    rideDataList.AddRange(workoutList.data);

                    if (workoutList.show_next)
                    {
                        pageNum++;
                        await Throttle();
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(rideDataList);
        }
Esempio n. 9
0
        private void LoadDay(Day day)
        {
            DayAdd = day;
            OnPropertyChanged("DayAdd");

            WorkoutAdd = WorkoutList.FirstOrDefault(p => p.Id == day.WorkoutId);
            OnPropertyChanged("WorkoutAdd");
        }
Esempio n. 10
0
    // Use this for initialization
    void Start()
    {
        RepComplete = _RepComplete;

        GameObject controllerObj = GameObject.Find("Controller");

        // Connects both gloves.
        controller = controllerObj.GetComponent <Controller> ();
        controller.ReadBoth();

        // Sets the current state to "Pre".
        currentState = States.Pre;

        // Sets the top button to the chosen exercise name.
        sceneTitle.GetComponentInChildren <Text> ().text = exerciseName;

        // Sets the bottom button's text to "Start Exercise".
        actionButton.GetComponentInChildren <Text> ().text = "Start Exercise";

        // Sets the current stage text.
        currentStageText.text = "Waiting to start exercise...";

        // Retrieves file with same exercise details.
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        FileStream      file            = File.Open(Application.persistentDataPath + "/workoutTable.dat", FileMode.Open);
        WorkoutList     workoutHistory  = (WorkoutList)binaryFormatter.Deserialize(file);

        file.Close();

        Debug.Log(workoutHistory.workoutTable.Count);

        exerciseNameEnumValue = ((List <string>)workoutHistory.workoutTable[exerciseName])[0];

        if (exerciseNameEnumValue.Equals(Exercise.Bench_Press.ToString()))
        {
            Routine = Exercise.Bench_Press;
        }
        else if (exerciseNameEnumValue.Equals(Exercise.Inverted_Bench_Press.ToString()))
        {
            Routine = Exercise.Inverted_Bench_Press;
        }
        else if (exerciseNameEnumValue.Equals(Exercise.Bicep_Curl.ToString()))
        {
            Routine = Exercise.Bicep_Curl;
        }

        // Sets the text fields to the stored values.
        numberOfSetsField.text = ((List <string>)workoutHistory.workoutTable[exerciseName])[1];
        startTimerField.text   = ((List <string>)workoutHistory.workoutTable[exerciseName])[2];
        restTimerField.text    = ((List <string>)workoutHistory.workoutTable[exerciseName])[3];
        goalRepsField.text     = ((List <string>)workoutHistory.workoutTable[exerciseName])[4];

        // Parses the start time entered by the user to a float and sets the start timer
        startTimerVal = float.Parse(startTimerField.text);
        restTimerVal  = float.Parse(restTimerField.text);

//		exerciseNameTest.text = Routine.ToString ();
    }
Esempio n. 11
0
        private void LoadWorkoutExercise(WorkoutExercise workoutExercise)
        {
            WorkoutExerciseAdd = workoutExercise;
            OnPropertyChanged("WorkoutExerciseAdd");

            WorkoutAdd = WorkoutList.FirstOrDefault(p => p.Id == workoutExercise.WorkoutId);
            OnPropertyChanged("WorkoutAdd");
            ExerciseAdd = ExerciseList.FirstOrDefault(p => p.Id == workoutExercise.ExerciseId);
            OnPropertyChanged("ExerciseAdd");
        }
Esempio n. 12
0
        void Handle_Clicked(object sender, System.EventArgs e)
        {
            WorkoutList item = new WorkoutList()
            {
                Id = WorkoutId
            };

            Navigation.PushAsync(new AddExercisePage(item));
            Navigation.RemovePage(this);
        }
        public async Task <IActionResult> Create([Bind("WorkoutId,UserId,Exercise_One,Exercise_Two,Exercise_Three,Exercise_Four,Exercise_Five,Exercise_Six,Exercise_Seven,Exercise_Eight,Exercise_Nine,Exercise_Ten,Exercise_Name")] WorkoutList workoutList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(workoutList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(workoutList));
        }
    // Use this for initialization
    void Start()
    {
        Debug.Log("This is the exercise name: " + exerciseName);

        BinaryFormatter binaryFormatter = new BinaryFormatter();
        FileStream      file            = File.Open(Application.persistentDataPath + "/workoutTable.dat", FileMode.Open);
        WorkoutList     workoutHistory  = (WorkoutList)binaryFormatter.Deserialize(file);

        file.Close();

        List <string> exerciseDetails = (List <string>)workoutHistory.workoutTable [exerciseName];

        workoutNameField.text  = ((List <string>)workoutHistory.workoutTable[exerciseName])[0];
        numberOfSetsField.text = ((List <string>)workoutHistory.workoutTable[exerciseName])[1];
        startTimerField.text   = ((List <string>)workoutHistory.workoutTable[exerciseName])[2];
        restTimerField.text    = ((List <string>)workoutHistory.workoutTable[exerciseName])[3];
        goalRepsField.text     = ((List <string>)workoutHistory.workoutTable[exerciseName])[4];
    }
Esempio n. 15
0
        public async Task EditWorkout(object sender, System.EventArgs e)
        {
            var menuItem = sender as MenuItem;
            var item     = menuItem.CommandParameter as WorkoutList;

            if (item.Completed == true)
            {
                await DisplayAlert("Delete Workout?", "This workout has been set as 'completed'. Please re-open this workout to edit or delete it.", "Close");

                return;
            }

            WorkoutList workout = new WorkoutList()
            {
                Id = item.Id
            };

            await Navigation.PushAsync(new Views.Workout.EditWorkoutPage(workout));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //using GetTraineeById method to get the Trainee from the database, which we use to
                //populate the data into the form.
                TraineeViewModel trainee = tbll.GetTraineeById(Convert.ToInt32(Request.QueryString["TraineeID"]));
                FullName.Text = trainee.FirstName + " " + trainee.LastName;

                WorkoutBLL wbll = new WorkoutBLL(ConfigurationManager.ConnectionStrings["MySwoleMateConnectionString"].ToString());
                List <WorkoutViewModel> workouts = wbll.GetAllWorkouts();

                WorkoutList.DataSource     = workouts;
                WorkoutList.DataTextField  = "WorkoutName";
                WorkoutList.DataValueField = "WorkoutID";
                WorkoutList.DataBind();
                WorkoutList.Items.Insert(0, "--Select an option--");
            }
        }
Esempio n. 17
0
        private void SaveWorkout()
        {
            if (WorkoutAdd.Id == 0)
            {
                new WorkoutRepository().Save(WorkoutAdd);
                WorkoutList.Add(WorkoutAdd);
            }
            else
            {
                new WorkoutRepository().Update(WorkoutAdd);
                WorkoutList = new ObservableCollection <Workout>(new WorkoutRepository().GetAll());
                OnPropertyChanged("WorkoutList");
            }

            WorkoutAdd = new Workout()
            {
                ExpirationDate = DateTime.Now.AddMonths(3)
            };
            OnPropertyChanged("WorkoutAdd");
        }
Esempio n. 18
0
        private void CompletedWorkout(WorkoutList item)
        {
            if (item.Completed == false)
            {
                item.Completed = true;
            }
            else
            {
                item.Completed = false;
            }

            Models.Persistence.Workout workout = new Models.Persistence.Workout()
            {
                Id          = item.Id,
                WorkoutDate = item.WorkoutDate,
                Completed   = item.Completed,
                Location    = item.Location,
                UserGuid    = item.UserGuid
            };

            _connection.UpdateAsync(workout);
        }
Esempio n. 19
0
    // Use this for initialization
    void Start()
    {
        // Check if the file exists.
        if (File.Exists(Application.persistentDataPath + "/workoutTable.dat"))
        {
            // Open the file and retrieve the workout list.
            BinaryFormatter binaryFormatter = new BinaryFormatter();
            FileStream      file            = File.Open(Application.persistentDataPath + "/workoutTable.dat", FileMode.Open);
            WorkoutList     workoutHistory  = (WorkoutList)binaryFormatter.Deserialize(file);
            file.Close();

            // Iterates through all of the created workouts.
            foreach (DictionaryEntry workout in workoutHistory.workoutTable)
            {
                Debug.Log(workout.Key);

                // Creates the button.
                GameObject button = (GameObject)Instantiate(buttonPrefab);
                button.GetComponentInChildren <Text> ().text = (string)workout.Key;

                // Give the buttons an action to load a screen that displays its details.
                button.GetComponent <Button> ().onClick.AddListener(
                    () => {
                    if (pageTitle.GetComponentInChildren <Text>().text.Equals("Edit Exercises"))
                    {
                        goToViewExerciseDetailsScene(button);
                    }
                    else if (pageTitle.GetComponentInChildren <Text>().text.Equals("Select Exercise"))
                    {
                        goToExerciseScreenScene(button);
                    }
                }
                    );
                button.transform.parent = menuPanel;
            }
        }
    }
        protected override async void OnAppearing()
        {
            List <WorkoutList> ListOfWorkouts = new List <WorkoutList>();

            //Get the records
            var workouts = await _connection.Table <Models.Persistence.Workout>().ToListAsync();

            var workoutCount = workouts.Count;

            //Just grab all for now
            foreach (var w in workouts)
            {
                WorkoutList workoutFromSqlite = new WorkoutList();
                workoutFromSqlite.Id           = w.Id;
                workoutFromSqlite.Completed    = w.Completed;
                workoutFromSqlite.WorkoutDate  = w.WorkoutDate.ToLocalTime();
                workoutFromSqlite.MuscleGroups = "Back";
                //add string later for the body parts trained (properly)
                ListOfWorkouts.Add(workoutFromSqlite);
            }


            workoutList.ItemsSource = ListOfWorkouts;
        }
Esempio n. 21
0
 private void DeleteWorkout(Workout workout)
 {
     new WorkoutRepository().Delete(workout);
     WorkoutList.Remove(workout);
 }
Esempio n. 22
0
 public AddExercisePage(WorkoutList workout)
 {
     _connection = DependencyService.Get <ISQLiteDb>().GetConnection();
     WorkoutId   = workout.Id;
     InitializeComponent();
 }
Esempio n. 23
0
 public void AddWorkout()
 {
     WorkoutList.Add(new WorkoutModel {
         Name = "test"
     });
 }
    void initExerciseData()
    {
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        FileStream      file            = File.Create(Application.persistentDataPath + "/workoutTable.dat");

        WorkoutList workoutList = new WorkoutList();

        List <String> workoutDetailsList = new List <String> ();

        // Adds the Bicep_Curl to the file.
        workoutDetailsList.Add("Bicep_Curl"); // exercise name
        workoutDetailsList.Add("3");          // number of sets
        workoutDetailsList.Add("10");         // start timer
        workoutDetailsList.Add("15");         // rest timer
        workoutDetailsList.Add("5");          // goal number of reps
        workoutList.workoutTable.Add("Bicep Curl", workoutDetailsList);

        workoutDetailsList = new List <String> ();

        // Adds the Bicep_Curl to the file.
        workoutDetailsList.Add("Bicep_Curl"); // exercise name
        workoutDetailsList.Add("3");          // number of sets
        workoutDetailsList.Add("10");         // start timer
        workoutDetailsList.Add("15");         // rest timer
        workoutDetailsList.Add("5");          // goal number of reps
        workoutList.workoutTable.Add("Wrist Curl", workoutDetailsList);

        workoutDetailsList = new List <String> ();
        // Adds Bench Press to the file.
        workoutDetailsList.Add("Bench_Press"); // exercise name
        workoutDetailsList.Add("3");           // number of sets
        workoutDetailsList.Add("5");           // start timer
        workoutDetailsList.Add("10");          // rest timer
        workoutDetailsList.Add("6");           // goal number of reps
        workoutList.workoutTable.Add("Bench Press", workoutDetailsList);

        workoutDetailsList = new List <String> ();

        // Adds Bench Press to the file.
        workoutDetailsList.Add("Bench_Press"); // exercise name
        workoutDetailsList.Add("3");           // number of sets
        workoutDetailsList.Add("5");           // start timer
        workoutDetailsList.Add("10");          // rest timer
        workoutDetailsList.Add("6");           // goal number of reps
        workoutList.workoutTable.Add("Bent Over Rows", workoutDetailsList);

        workoutDetailsList = new List <String> ();

        // Adds Bench Press to the file.
        workoutDetailsList.Add("Bench_Press"); // exercise name
        workoutDetailsList.Add("3");           // number of sets
        workoutDetailsList.Add("5");           // start timer
        workoutDetailsList.Add("10");          // rest timer
        workoutDetailsList.Add("6");           // goal number of reps
        workoutList.workoutTable.Add("Squats", workoutDetailsList);

        workoutDetailsList = new List <String> ();

        // Adds Bench Press to the file.
        workoutDetailsList.Add("Inverted_Bench_Press"); // exercise name
        workoutDetailsList.Add("2");                    // number of sets
        workoutDetailsList.Add("4");                    // start timer
        workoutDetailsList.Add("8");                    // rest timer
        workoutDetailsList.Add("5");                    // goal number of reps
        workoutList.workoutTable.Add("Military Press", workoutDetailsList);

        // Saves the file.
        binaryFormatter.Serialize(file, workoutList);
    }
Esempio n. 25
0
 public void AddWorkout(WorkoutModel workoutmodel)
 {
     WorkoutList.Add(workoutmodel);
 }
    public void save()
    {
        // Loads the file with the corresponding workouts.
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        FileStream      file            = File.Open(Application.persistentDataPath + "/workoutTable.dat", FileMode.Open);
        WorkoutList     workoutHistory  = (WorkoutList)binaryFormatter.Deserialize(file);

        file.Close();

        int number;

        // Checks if the inputs are numbers and not
        if (!int.TryParse(numberOfSetsField.text, out number) || int.Parse(numberOfSetsField.text) <= 0)
        {
            validInput = false;
            numberOfSetsField.transform.FindChild("Text").GetComponent <Text> ().color = Color.red;
        }
        else if (numberOfSetsField.transform.FindChild("Text").GetComponent <Text> ().color.Equals(Color.red))
        {
            validInput = true;
            numberOfSetsField.transform.FindChild("Text").GetComponent <Text> ().color = Color.black;
        }

        if (!int.TryParse(startTimerField.text, out number) || int.Parse(startTimerField.text) <= 0)
        {
            validInput = false;
            startTimerField.transform.FindChild("Text").GetComponent <Text> ().color = Color.red;
        }
        else if (startTimerField.transform.FindChild("Text").GetComponent <Text> ().color.Equals(Color.red))
        {
            validInput = true;
            startTimerField.transform.FindChild("Text").GetComponent <Text> ().color = Color.black;
        }

        if (!int.TryParse(restTimerField.text, out number) || int.Parse(restTimerField.text) <= 0)
        {
            validInput = false;
            restTimerField.transform.FindChild("Text").GetComponent <Text> ().color = Color.red;
        }
        else if (restTimerField.transform.FindChild("Text").GetComponent <Text> ().color.Equals(Color.red))
        {
            validInput = true;
            restTimerField.transform.FindChild("Text").GetComponent <Text> ().color = Color.black;
        }

        if (!int.TryParse(goalRepsField.text, out number) || int.Parse(goalRepsField.text) <= 0)
        {
            validInput = false;
            goalRepsField.transform.FindChild("Text").GetComponent <Text> ().color = Color.red;
        }
        else if (goalRepsField.transform.FindChild("Text").GetComponent <Text> ().color.Equals(Color.red))
        {
            validInput = true;
            goalRepsField.transform.FindChild("Text").GetComponent <Text> ().color = Color.black;
        }

        // If all the inputs are valid, it will be updated on the file.
        if (validInput)
        {
            ((List <string>)workoutHistory.workoutTable [exerciseName]) [0] = workoutNameField.text;
            ((List <string>)workoutHistory.workoutTable [exerciseName]) [1] = numberOfSetsField.text;
            ((List <string>)workoutHistory.workoutTable [exerciseName]) [2] = startTimerField.text;
            ((List <string>)workoutHistory.workoutTable [exerciseName]) [3] = restTimerField.text;
            ((List <string>)workoutHistory.workoutTable [exerciseName]) [4] = goalRepsField.text;

            file = File.Create(Application.persistentDataPath + "/workoutTable.dat");
            binaryFormatter.Serialize(file, workoutHistory);
            file.Close();

            debugText.text = "Inserted into the workout table file.";
            debugText.GetComponent <Text>().color = Color.green;
        }
        else
        {
            debugText.text  = "Please ensure that number of sets, start timer, rest timer, and goal reps are positive numbers.";
            debugText.color = Color.red;
        }
    }
Esempio n. 27
0
        private void Button_Workout(object sender, RoutedEventArgs e)
        {
            var _workout = new WorkoutList();

            _workout.Show();
        }
Esempio n. 28
0
 private void Awake()
 {
     instance = this;
 }
 public EditWorkoutPage(WorkoutList workout)
 {
     InitializeComponent();
     _connection = DependencyService.Get <ISQLiteDb>().GetConnection();
     WorkoutId   = workout.Id;
 }
Esempio n. 30
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            List <WorkoutList> ListOfWorkouts = new List <WorkoutList>();

            //Get the records
            var workouts = await Models.Persistence.Workout.GetAllWorkoutRecordsInDescendingOrder(_connection);

            var workoutCount = workouts.Count;

            //Just grab all for now
            foreach (var w in workouts)
            {
                WorkoutList workoutFromSqlite = new WorkoutList();
                workoutFromSqlite.Id = w.Id;
                //workoutFromSqlite.Completed = w.Completed;

                workoutFromSqlite.WorkoutDate = w.WorkoutDate;                 //.ToLocalTime();
                workoutFromSqlite.Location    = w.Location;
                workoutFromSqlite.Completed   = w.Completed;
                workoutFromSqlite.UserGuid    = w.UserGuid;

                if (w.Completed == true)
                {
                    //workoutFromSqlite.CompletedString = "Completed";
                    workoutFromSqlite.CompletedString = "\u2714";
                    //workoutFromSqlite.CompletedColor = "Green";
                }
                else
                {
                    //workoutFromSqlite.CompletedString = "Not Completed";
                    workoutFromSqlite.CompletedString = "X";
                    //workoutFromSqlite.CompletedColor = "Red";
                }

                //
                List <string> fullListOfStrings = await ExerciseName.GetListOfExerciseStrings(_connection, w);

                string musclegroups = "";
                if (musclegroups == "" && fullListOfStrings.Count() == 0)
                {
                    musclegroups = "None";
                }
                else
                {
                    foreach (var str in fullListOfStrings)
                    {
                        musclegroups += str + "/";
                    }
                }

                int    muscleGroupLength   = musclegroups.Length - 1;
                char   muscleGroupLastChar = musclegroups[muscleGroupLength];
                string muscleGroupFinal    = "";
                if (muscleGroupLastChar == '/')
                {
                    //musclegroups.Remove(muscleGroupLength, 1);
                    muscleGroupFinal = musclegroups.Remove(musclegroups.Length - 1);
                }
                workoutFromSqlite.MuscleGroups = muscleGroupFinal;

                ListOfWorkouts.Add(workoutFromSqlite);
            }

            workoutList.ItemsSource = ListOfWorkouts;
        }