コード例 #1
0
        private async Task CreateNewTrainingWeekActionAsync()
        {
            try
            {
                var userInfo = UserData.Instance.UserInfo;
                if (userInfo == null)
                {
                    userInfo = new UserInfo();
                }

                DateTime dateTime     = DateTime.Now;
                var      trainingWeek = new TrainingWeek()
                {
                    UserId     = userInfo.UserId,
                    Year       = dateTime.Year,
                    WeekOfYear = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday),
                    UserHeight = userInfo.Height,
                    UserWeight = userInfo.Weight,
                    Unit       = userInfo.Unit
                };

                if (await EditTrainingWeekViewModel.ShowAsync(trainingWeek, TEditMode.Create, this))
                {
                    //Refresh data
                    RetreiveLocalData();
                    SynchronizeData();
                }
            }
            catch (Exception except)
            {
                await _userDialog.AlertAsync(except.Message, Translation.Get(TRS.ERROR), Translation.Get(TRS.OK));
            }
        }
コード例 #2
0
 private async Task EditTrainingWeekActionAsync()
 {
     try
     {
         await EditTrainingWeekViewModel.ShowAsync(TrainingWeek, TEditMode.Edit, this);
     }
     catch
     {
     }
 }