private async Task CommandRegistAction() { if (_bodyImageService.CheckExitTargetDayData(DateTime.Now)) { var result = await Application.Current.MainPage.DisplayAlert(LanguageUtils.Get(LanguageKeys.Confirm), LanguageUtils.Get(LanguageKeys.TodayDataUpdateConfirm), LanguageUtils.Get(LanguageKeys.OK), LanguageUtils.Get(LanguageKeys.Cancel)); if (result) { _bodyImageService.UpdateBodyImage(_id, _base64String); } } else { _bodyImageService.RegistBodyImage(_base64String); } if (_takePhotoFromCamera) { //TODO 確認のダイアログを表示する //TODO ViewModelCommonUtilに移動する? DependencyService.Get <IImageService>().DeleteImageFile(_filePath); } // ホーム画面をリロードする ViewModelCommonUtil.SendMessage(ViewModelConst.MessagingHomeReload); ViewModelCommonUtil.DataBackPage(); }
/// <summary> /// キャンセルアクション /// </summary> public void CommandCancelAction() { // ホーム画面をリロードする ViewModelCommonUtil.SendMessage(ViewModelConst.MessagingHomeReload); ViewModelCommonUtil.DataBackPage(); }
/*----------------------------------------------------------------------------------------------------------------------------------------*/ // // Command Actions // /*----------------------------------------------------------------------------------------------------------------------------------------*/ #region Command Actions /// <summary> /// 基本データ保存アクション /// </summary> /// <returns></returns> private async Task CommandSaveAction() { try { if (!ValidationInputData(Name, Gender, Height, BodyWeight, BodyFatPercentage, MaxBloodPressure, MinBloodPressure, BasalMetabolism)) { ScrollRequest = ScrollRequest.SendScrollRequest(ScrollRequestType.RequestTypeToTop); return; } IsLoading = true; if (_basicDataService.CheckExitTargetDayData(DateTime.Now)) { var result = await Application.Current.MainPage.DisplayAlert(LanguageUtils.Get(LanguageKeys.Confirm), LanguageUtils.Get(LanguageKeys.TodayDataUpdateConfirm), LanguageUtils.Get(LanguageKeys.OK), LanguageUtils.Get(LanguageKeys.Cancel)); if (result) { _basicDataService.UpdateBasicData(_id, Name, 1, Gender, height: Height, birthday: Birthday, bodyWeight: BodyWeight, bodyFatPercentage: BodyFatPercentage, maxBloodPressure: MaxBloodPressure, minBloodPressure: MinBloodPressure, basalMetabolism: BasalMetabolism); } else { IsLoading = false; return; } } else { _basicDataService.RegistBasicData(Name, 1, Gender, height: Height, birthday: Birthday, bodyWeight: BodyWeight, bodyFatPercentage: BodyFatPercentage, maxBloodPressure: MaxBloodPressure, minBloodPressure: MinBloodPressure, basalMetabolism: BasalMetabolism); } IsLoading = false; await Application.Current.MainPage.DisplayAlert(LanguageUtils.Get(LanguageKeys.Complete), LanguageUtils.Get(LanguageKeys.SaveComplete), LanguageUtils.Get(LanguageKeys.OK)); if (_isUpdate) { // ホーム画面をリロードする ViewModelCommonUtil.SendMessage(ViewModelConst.MessagingHomeReload); ViewModelCommonUtil.DataBackPage(); } else { ViewModelCommonUtil.BackHome(); } } catch (Exception e) { Debug.WriteLine(e); } }