예제 #1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="targetBasicDataEnum"></param>
        public DataChartViewModel(BasicDataEnum targetBasicDataEnum)
        {
            InitCommands();

            _analysisService     = AnalysisServiceFactory.Create(targetBasicDataEnum);
            _targetBasicDataEnum = targetBasicDataEnum;

            // 一度全データを取得
            var list = BasicDataService.GetBasicDataList();

            // 指定された列挙値によって取得する値を決定する
            switch (_targetBasicDataEnum)
            {
            case BasicDataEnum.BodyWeight:
                _entries = list.Select(value => CreateNewEntry(value.BodyWeight, value.RegistedDate))
                           .ToList();
                break;

            case BasicDataEnum.BodyFatPercentage:
                _entries = list.Select(value => CreateNewEntry(value.BodyFatPercentage, value.RegistedDate))
                           .ToList();
                break;

            case BasicDataEnum.Name:
            case BasicDataEnum.Sex:
            case BasicDataEnum.Age:
                break;

            case BasicDataEnum.Height:
                _entries = list.Select(value => CreateNewEntry(value.Height, value.RegistedDate))
                           .ToList();
                break;

            case BasicDataEnum.MaxBloodPressure:
                _entries = list.Select(value => CreateNewEntry(value.MaxBloodPressure, value.RegistedDate))
                           .ToList();
                break;

            case BasicDataEnum.MinBloodPressure:
                _entries = list.Select(value => CreateNewEntry(value.MinBloodPressure, value.RegistedDate))
                           .ToList();
                break;

            case BasicDataEnum.BasalMetabolism:
                _entries = list.Select(value => CreateNewEntry(value.BasalMetabolism, value.RegistedDate)).ToList();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            Chart = new LineChart {
                Entries = _entries
            };
            DataList = _entries.Select(data => data.Label + StringConst.Blank + data.Value + _targetBasicDataEnum.DisplayUnit());

            var width = IncreaseChartWidth * list.Count;

            ChartWidth = width < MinChartWidth ? MinChartWidth : width;
            Analysis   = _analysisService.Analy();
        }
예제 #2
0
 /// <summary>
 /// 基本データ表示用文字列返却
 /// </summary>
 /// <param name="basicData"></param>
 /// <returns></returns>
 public static string DisplayString(this BasicDataEnum basicData)
 {
     string[] names =
     {
         LanguageUtils.Get(LanguageKeys.Name),
         LanguageUtils.Get(LanguageKeys.Gender),
         LanguageUtils.Get(LanguageKeys.Age),
         LanguageUtils.Get(LanguageKeys.Height),
         LanguageUtils.Get(LanguageKeys.BodyWeight),
         LanguageUtils.Get(LanguageKeys.BodyFatPercentage),
         LanguageUtils.Get(LanguageKeys.MaxBloodPressure),
         LanguageUtils.Get(LanguageKeys.MinBloodPressure),
         LanguageUtils.Get(LanguageKeys.BasicMetabolism),
         LanguageUtils.Get(LanguageKeys.Location)
     };
     return(names[(int)basicData]);
 }
        public static IAnalysisService Create(BasicDataEnum basicDataEnum)
        {
            switch (basicDataEnum)
            {
            case BasicDataEnum.Name:
                return(null);

            case BasicDataEnum.Sex:
                return(null);

            case BasicDataEnum.Age:
                return(null);

            case BasicDataEnum.Height:
                return(null);

            case BasicDataEnum.BodyWeight:
                return(ServiceLocator.Current.GetInstance <BodyWeightAnalysisServiceImpl>());

            case BasicDataEnum.BodyFatPercentage:
                return(ServiceLocator.Current.GetInstance <BodyFatPercentageAnalysisServiceImpl>());

            case BasicDataEnum.MaxBloodPressure:
                return(ServiceLocator.Current.GetInstance <MaxBloodPressureAnalysisServiceImpl>());

            case BasicDataEnum.MinBloodPressure:
                return(ServiceLocator.Current.GetInstance <MinBloodPressureAnalysisServiceImpl>());

            case BasicDataEnum.BasalMetabolism:
                return(ServiceLocator.Current.GetInstance <BasalMetabolismAnalysisServiceImpl>());

            case BasicDataEnum.Location:
                return(null);

            default:
                throw new ArgumentOutOfRangeException(nameof(basicDataEnum), basicDataEnum, null);
            }
        }
 public DataChartView(BasicDataEnum target)
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     BindingContext = new DataChartViewModel(target);
 }
예제 #5
0
 /// <summary>
 ///     基本データ列挙に対応する単位記号を返却
 /// </summary>
 /// <param name="basicData"></param>
 /// <returns></returns>
 public static string DisplayUnit(this BasicDataEnum basicData)
 {
     string[] names = { "", "", "才", "cm", "Kg", "%", "", "", "", "" };
     return(names[(int)basicData]);
 }