/// <summary> /// 初始化信息 /// </summary> public async void InitRecommendationAsync() { userFavorInformationList = new List <FoodWeightChange>(); foodInformationList = await _loadJsonService.ReadJsonAsync(); _foodFavorService.InitAsync(foodInformationList); await _logService.InitAsync(); userFavorInformationList = await _userFavorService.ReadJsonAsync(); InitWeight(foodInformationList, userFavorInformationList); WeatherRoot data = await _weatherService.GetWeatherAsync(); weatherStatus = new TempWeather(); weatherStatus.Temperature = double.Parse(data.main.temp).ToTemperature(); weatherStatus.Humidity = double.Parse(data.main.humidity).ToHumidity(); }
public async void InitAsync(List <FoodInformation> foodInformations) { FoodWeightChangesList = await _userFavorService.ReadJsonAsync(); if (FoodWeightChangesList.Count == 0) { FoodWeightChangesList = new List <FoodWeightChange>(); for (int i = 0; i < foodInformations.Count; i++) { FoodWeightChange foodchange = new FoodWeightChange(); foodchange.FoodName = foodInformations[i].Name; foodchange.weightChangeList = new List <int>() { 0, 0, 0, 0, 0, 0 }; FoodWeightChangesList.Add(foodchange); } } }