/// <summary> /// 从网站下载文档 /// </summary> private void DownWord() { string file = UtilTools.initFileName(); string baseurl = ConfigurationManager.AppSettings["baseurl"].ToString(); string url = baseurl + HttpUtility.UrlEncode(file); string dir = Environment.CurrentDirectory + "\\files\\"; try { UtilTools.DownloadWord(url, dir); } catch (Exception ex) { } }
/// <summary> /// 初始化天气数据 /// </summary> private void initWeather() { try { //根据日期匹配文档并解析 List <string> ls = UtilTools.SpireDocProcess(); if (ls.Count > 0) { #region 天气预报数据 string forecast = ls[0]; string[] casts = forecast.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); wf.label1.Text = casts[0]; wf.label6.Text = casts[1]; wf.label11.Text = casts[2]; wf.label2.Text = casts[3]; wf.label5.Text = casts[4]; wf.label12.Text = casts[5]; wf.label3.Text = casts[6]; wf.label8.Text = casts[7]; wf.label13.Text = casts[8]; wf.label4.Text = casts[9]; wf.label9.Text = casts[10]; wf.label14.Text = casts[11]; wf.label5.Text = casts[12]; wf.label10.Text = casts[13]; wf.label15.Text = casts[14]; #endregion #region 天气趋势数据 string head = " "; wo.label1.Text = head + ls[1]; wo.label2.Text = head + ls[2]; wo.label3.Text = head + ls[3]; #endregion } } catch (Exception ex) { }; }