コード例 #1
0
        // GET: api/Weather
        public IEnumerable <Models.WeatherInfo> Get()
        {
            var WeatherInfList = new List <Models.WeatherInfo>();

            for (int i = 0; i < 10; i++)
            {
                var WeatherInfo = new Models.WeatherInfo
                {
                    Location1 = $"Location {i}",
                    Degree1   = i * 23 / 17,
                    DateTime  = DateTime.Now.ToUniversalTime()
                };
                WeatherInfList.Add(WeatherInfo);
            }
            return(WeatherInfList);
        }
コード例 #2
0
 public void Refresh()
 {
     if (this.IsLoading) return;
     this.IsLoading = true;
     var client = new WebService.WeatherWebServiceSoapClient();
     var func = new Func<string, string[]>(client.getWeatherbyCityName);
     func.BeginInvoke(this.CurrentArea.Name, ar =>
     {
         var data = func.EndInvoke(ar);
         this.WeatherInfo = new Models.WeatherInfo(data);
         this.RefreshTime = DateTime.Now;
         this.IsLoading = false;
     }, null);
 }