private void button4_Click(object sender, EventArgs e) { richTextBox4.Visible = true; richTextBox4.Clear(); chart1.Visible = false; var log = new Weatherdb(); var contents = log.Read(); richTextBox4.Text = contents; }
private void button1_Click(object sender, EventArgs e) { string[] r_1 = w.getWeatherbyCityName(cmb_city.Text.Trim()); for (int i = 0; i < r.Length; i++) { r[i] = r_1[i]; } // Console.WriteLine(r[6]); initform(r[6]); //var ls = new jiekou.jiekou(); //string str = ls.getHtml("http://wthrcdn.etouch.cn/weather_mini?city=%E7%A6%8F%E5%B7%9E"); //string str= ls.GetFunction("http://wthrcdn.etouch.cn/weather_mini?city=%E7%A6%8F%E5%B7%9E", ""); //Console.WriteLine(str + "**********************************"); if (cmb_city.Text.Trim() != "") { richTextBox1.Text = String.Empty; richTextBox2.Text = String.Empty; richTextBox3.Text = String.Empty; richTextBox4.Text = String.Empty; for (int i = 0; i < 12; i++) { if (r[i].EndsWith(".gif") || r[i].EndsWith(".jpg")) { /* for(int j = 0; j <= 31; j++) * { * if (r[i].Equals(j + ".gif")) * { * * richTextBox1.Text +=Image.FromFile(".../.../weather/"+ j+".gif") + "\r\n"; * } * }*/ } else { richTextBox1.Text += r[i] + "\r\n"; } } for (int i = 12; i < 17; i++) { if (r[i].EndsWith(".gif") || r[i].EndsWith(".jpg")) { } else { richTextBox2.Text += r[i] + "\r\n"; } } for (int i = 17; i < 22; i++) { if (r[i].EndsWith(".gif") || r[i].EndsWith(".jpg")) { } else { richTextBox3.Text += r[i] + "\r\n"; } } var contents = string.Format("{0}=>{1}:今天气温{2}{3}", DateTime.Now, cmb_city.Text.Trim(), r[5], /* r[12], * r[17],*/ Environment.NewLine ); var log = new Weatherdb(); log.Write(contents); } else { richTextBox1.Clear(); richTextBox2.Clear(); richTextBox3.Clear(); richTextBox4.Clear(); } }