public void OnForecastAPILoadCompleted(String result) { Debug.WriteLine(">>>>> ScheduledAgent OnInvoke :: OnForecastAPILoadCompleted :: " + result.Length); if (String.IsNullOrEmpty(result)) { // 取資料錯誤,不更新了 NotifyComplete(); } else { TileService.Instance.mAreaWeatherList.Clear(); Dictionary <String, List <RichListItem> > allForecast = ForecastParser.ParseAllForecast(result); if (allForecast != null && allForecast.Count > 0) { TileService.Instance.mAreaWeatherList = allForecast; Deployment.Current.Dispatcher.BeginInvoke(() => { TileService.Instance.RefreshAllTile(); } ); } NotifyComplete(); //ScheduledActionService.LaunchForTest(Constants.TWWEATHER_BACKGROUND_SCHEDULER, TimeSpan.FromMilliseconds(15000)); } }
public void OnForecastAPILoadCompleted(String result) { Boolean bIsRemember = AppService.Instance.GetIsRemember(); Boolean bResultOK = true; Boolean bLocalData = false; if ((result == null || "".Equals(result)) && bIsRemember) { String strLocalData = AppService.Instance.GetBackUpAllForecast(); if (strLocalData == null || "".Equals(strLocalData)) { bResultOK = false; if (LoadDataError != null) { LoadDataError(); } } else { bLocalData = true; result = strLocalData; } } else if (result == null || "".Equals(result)) { bResultOK = false; if (LoadDataError != null) { LoadDataError(); } } if (bResultOK) { Dictionary <String, List <RichListItem> > allForecast = ForecastParser.ParseAllForecast(result); AppService.Instance.mAreaWeatherList = allForecast; TileService.Instance.mAreaWeatherList = allForecast; if (allForecast != null && allForecast.Count > 0 && !bLocalData) { AppService.Instance.SaveBackUpAllForecast(result); } UpdateMyWeatherPage(); } if (LoadDataCompleted != null) { LoadDataCompleted(); } }