/// <summary>Viewを表示した後呼び出されます。</summary>
        /// <param name="navigationContext">Navigation Requestの情報を表すNavigationContext。</param>
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            if (this.physical != null)
            {
                return;
            }
            this.physical = this.getPhysicalData(navigationContext);

            var mode = ReactivePropertyMode.Default | ReactivePropertyMode.IgnoreInitialValidationError;

            // 測定日
            this.MeasurementDate = this.physical
                                   .ToReactivePropertyAsSynchronized(x => x.MeasurementDate, mode, true)
                                   .SetValidateNotifyError(v => this.getMeasurementDateError(v))
                                   .AddTo(this.disposables);
            // 身長
            this.Height = this.physical
                          .ToReactivePropertyAsSynchronized(x => x.Height, ignoreValidationErrorValue: true)
                          .SetValidateAttribute(() => this.Height)
                          .AddTo(this.disposables);
            // 体重
            this.Weight = this.physical
                          .ToReactivePropertyAsSynchronized(x => x.Weight, ignoreValidationErrorValue: true)
                          .SetValidateAttribute(() => this.Weight)
                          .AddTo(this.disposables);
            // BMI
            this.Bmi = this.physical.ObserveProperty(x => x.Bmi)
                       .ToReadOnlyReactivePropertySlim()
                       .AddTo(this.disposables);

            // View へ反映
            this.RaisePropertyChanged(null);
        }
        /// <summary>Viewを表示した後呼び出されます。</summary>
        /// <param name="navigationContext">Navigation Requestの情報を表すNavigationContext。</param>
        void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
        {
            if (this.physical != null)
            {
                return;
            }

            this.physical = this.getPhysicalData(navigationContext);

            //var physicalInfo = this.getPhysicalData(navigationContext);

            //this.physical.MeasurementDate = physicalInfo.MeasurementDate;
            //this.physical.Height = physicalInfo.Height;
            //this.physical.Weight = physicalInfo.Weight;


            this.MeasurementDate = this.physical
                                   .ToReactivePropertyAsSynchronized(x => x.MeasurementDate)
                                   .AddTo(this.disposables);
            this.Height = this.physical
                          .ToReactivePropertyAsSynchronized(x => x.Height)
                          .AddTo(this.disposables);
            this.Weight = this.physical
                          .ToReactivePropertyAsSynchronized(x => x.Weight)
                          .AddTo(this.disposables);
            this.Bmi = this.physical.ObserveProperty(x => x.Bmi)
                       .ToReadOnlyReactivePropertySlim()
                       .AddTo(this.disposables);

            this.RaisePropertyChanged(null);
        }
Beispiel #3
0
        /// <summary>Viewを表示した後呼び出されます。</summary>
        /// <param name="navigationContext">Navigation Requestの情報を表すNavigationContext。</param>
        void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
        {
            if (this.physical != null)
            {
                return;
            }
            this.physical = navigationContext.Parameters["TargetData"] as PhysicalInformation;

            this.MeasurementDate = this.physical.MeasurementDate;
            this.Height          = this.physical.Height;
            this.Weight          = this.physical.Weight;

            //this.MeasurementDate = this.physical
            //	.ToReactivePropertyAsSynchronized(x => x.MeasurementDate)
            //	.AddTo(this.disposables);
            //this.Height = this.physical
            //	.ToReactivePropertyAsSynchronized(x => x.Height)
            //	.AddTo(this.disposables);
            //this.Weight = this.physical
            //	.ToReactivePropertyAsSynchronized(x => x.Weight)
            //	.AddTo(this.disposables);
            //this.Bmi = this.physical.ObserveProperty(x => x.Bmi)
            //	.ToReadOnlyReactivePropertySlim()
            //	.AddTo(this.disposables);

            //this.RaisePropertyChanged(nameof(this.MeasurementDate));
            //this.RaisePropertyChanged(nameof(this.Height));
            //this.RaisePropertyChanged(nameof(this.Weight));
            //this.RaisePropertyChanged(nameof(this.Bmi));
        }
 private PhysicalInformation SetCreateUpdatePhysicalInformation(PhysicalInformation physicalInfo, PhysicalInformationArg physicalInfoArg, string personId, string userLoginId)
 {
     if (physicalInfo == null)
     {
         physicalInfo             = _mapper.Map <PhysicalInformation>(physicalInfoArg);
         physicalInfo.PersonId    = personId;
         physicalInfo.UserLoginId = userLoginId;
         physicalInfo.BmI         = UtilityMethods.CalculateBmI(physicalInfo.Height, physicalInfo.Weight);
         PhysicalInformation().Add(physicalInfo);
     }
     else
     {
         physicalInfo.Bust         = physicalInfoArg.Bust;
         physicalInfo.Complexion   = physicalInfoArg.Complexion;
         physicalInfo.DressSize    = physicalInfoArg.DressSize;
         physicalInfo.ShoeSize     = physicalInfoArg.ShoeSize;
         physicalInfo.EyeColor     = physicalInfoArg.EyeColor;
         physicalInfo.HairColor    = physicalInfoArg.HairColor;
         physicalInfo.Height       = physicalInfoArg.Height;
         physicalInfo.HeightEnumId = physicalInfoArg.HeightEnumId;
         physicalInfo.Hip          = physicalInfoArg.Hip;
         physicalInfo.Waist        = physicalInfoArg.Waist;
         physicalInfo.Weight       = physicalInfoArg.Weight;
         physicalInfo.BmI          = UtilityMethods.CalculateBmI(physicalInfo.Height, physicalInfo.Weight);
         physicalInfo.WeightEnumId = physicalInfoArg.WeightEnumId;
         physicalInfo.UserLoginId  = userLoginId;
         PhysicalInformation().UpdateEntity(physicalInfo);
     }
     return(physicalInfo);
 }