Esempio n. 1
0
        private async void Button_Clicked(object sender, EventArgs e) //Button for testing weekly comparisons
        {
            var starttime = DateTime.Now;

            starttime = starttime.Subtract(TimeSpan.FromDays(7));
            var endtime = DateTime.Now;

            endtime = endtime.Subtract(TimeSpan.FromDays(7));

            //Log end time
            SelectedLoadout.StartTime  = starttime;
            SelectedLoadout.EndTime    = endtime;
            SelectedLoadout.DateString = $"{starttime.ToString("dd/MM/yyyy")}";

            //Set summary string of exercise time range.
            SelectedLoadout.StartToEnd = $"{SelectedLoadout.StartTime.ToShortTimeString()} - {SelectedLoadout.EndTime.ToShortTimeString()}";

            //Set weight strings for bindings
            SelectedLoadout = await SetWeightStrings(SelectedLoadout);

            WeeklyComparisons wComparison = new WeeklyComparisons(SelectedLoadout);
            var comparedLoadout           = await wComparison.CompareLastWeeksSession();

            if (comparedLoadout != null)
            {
                SelectedLoadout = comparedLoadout;
            }
            await MasterModel.DAL.SaveNewExerciseSessionLogAsync(SelectedLoadout);

            await Navigation.PopAsync();
        }
Esempio n. 2
0
        private async void LogSession_Clicked(object sender, EventArgs e)
        {
            //Log end time
            SelectedLoadout.EndTime = DateTime.Now;

            //Set summary string of exercise time range.
            SelectedLoadout.StartToEnd = $"{SelectedLoadout.StartTime.ToShortTimeString()} - {SelectedLoadout.EndTime.ToShortTimeString()}";

            //Set weight strings for bindings
            SelectedLoadout = await SetWeightStrings(SelectedLoadout);

            WeeklyComparisons wComparison = new WeeklyComparisons(SelectedLoadout);
            var comparedLoadout           = await wComparison.CompareLastWeeksSession();

            SelectedLoadout = comparedLoadout;
            await MasterModel.DAL.SaveNewExerciseSessionLogAsync(SelectedLoadout);

            await Navigation.PopAsync();
        }