public void LoadData() { // 取喜好項目、氣象報告 if (LoadDataStarted != null) { LoadDataStarted(); } BaseAPI apiWarning = new BaseAPI(); apiWarning.APILoadCompleted += OnWarningAPILoadCompleted; apiWarning.GetStringResponse(Constants.WEATHER_WARNING_URL); BaseAPI apiOverView = new BaseAPI(); apiOverView.APILoadCompleted += OnOverViewAPILoadCompleted; apiOverView.GetStringResponse(Constants.WEATHER_OVERVIEW_URL); BaseAPI apiForecast = new BaseAPI(); apiForecast.APILoadCompleted += OnForecastAPILoadCompleted; apiForecast.GetStringResponse(Constants.WEATHER_FORECAST_URL); IsDataLoaded = true; }
/// <summary> /// 執行排程工作的代理程式 /// </summary> /// <param name="task"> /// 叫用的工作 /// </param> /// <remarks> /// 這個方法的呼叫時機為叫用週期性或耗用大量資料的工作時 /// </remarks> protected override void OnInvoke(ScheduledTask task) { Boolean bFindTile = TileService.Instance.FindAreaLiveTile(); if (bFindTile) { BaseAPI apiForecast = new BaseAPI(); apiForecast.APILoadCompleted += OnForecastAPILoadCompleted; apiForecast.GetStringResponse(Constants.WEATHER_FORECAST_URL); Debug.WriteLine(">>>>> ScheduledAgent OnInvoke"); } }
public void ReflashByURL() { if (ContentURL == null || "".Equals(ContentURL)) { HandleNullData(true); } else { if (LoadDataStarted != null) { LoadDataStarted(); } BaseAPI api = new BaseAPI(); api.APILoadCompleted += OnAPILoadCompleted; api.GetStringResponse(HttpUtility.UrlDecode(ContentURL)); } }