Exemplo n.º 1
0
 /// <summary>
 /// 后台载入天气完成后显示到UI
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bgwWeather_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     setTss(wt);
     if (wn == null || wt == null)
     {
         tssCity.Text = "网络连接失败";
         cityInfo = TssCity.FAILED;
     }
     else
     {
         setLable(wn);
         setLable(wt);
     }
     return;
 }
Exemplo n.º 2
0
 /// <summary>
 /// 联网获取天气
 /// </summary>
 private void loadWeather()
 {
     //显示天气
     string cityId = string.Empty;
         ipv4 = IpPostion.GetIp();
         if (ipv4 == null)
         {
             tssCity.Text = "网络连接失败";
             cityInfo = TssCity.FAILED;
             return;
         }
         //this.tablabelIPAddress.Text += ipv4;
         //get city id by ipv4
         cityId = IpPostion.getCityId(ipv4);
         if (cityId == null)
         {
             tssCity.Text = "网络连接失败";
             cityInfo = TssCity.FAILED;
             return;
         }
     wn = weatherBus.loadWeatherNow(cityId);
     wt = weatherBus.loadWeatherToday(cityId);
 }