private void TimerLoad_Tick(object sender, EventArgs e) { if (Exist[0] == false) { ShowWeather("西安"); TimerLoad.Enabled = false; LoadingIndex.Hide(); Exist[0] = true; } }
private void ShowWeather(string City) { try { string[] r = Weather.Get(City); LblLoc.Text = "地理位置" + r[0] + " " + r[1]; LblWeaSim.Text = "今日天气概况:" + r[5] + " " + r[6]; LblWind.Text = "风向:" + r[7]; LblNextDay.Text = "明天天气概况" + r[12] + " " + r[13]; LblWeaComp.Text = r[10]; LblLife.Text = r[11]; LblCity.Text = r[22]; LblThreeDay.Text = "后天天气概况" + r[17] + " " + r[18]; pictureBox1.Image = Tool.GetResBitmap(string.Format("EasyLife.Weather.a_{0}.jpg", r[8][0])); pictureBox2.Image = Tool.GetResBitmap(string.Format("EasyLife.Weather.a_{0}.jpg", r[9][0])); pictureBox3.Image = Tool.GetResBitmap(string.Format("EasyLife.Weather.a_{0}.jpg", r[15][0])); pictureBox4.Image = Tool.GetResBitmap(string.Format("EasyLife.Weather.a_{0}.jpg", r[16][0])); pictureBox5.Image = Tool.GetResBitmap(string.Format("EasyLife.Weather.a_{0}.jpg", r[20][0])); pictureBox6.Image = Tool.GetResBitmap(string.Format("EasyLife.Weather.a_{0}.jpg", r[21][0])); pictureBox1.Left = LblWeaSim.Left + LblWeaSim.Width + 5; pictureBox1.Top = pictureBox2.Top = LblWeaSim.Top - 8; pictureBox2.Left = pictureBox1.Left + pictureBox1.Width + 5; pictureBox3.Left = LblNextDay.Left + LblNextDay.Width + 5; pictureBox3.Top = pictureBox4.Top = LblNextDay.Top - 8; pictureBox4.Left = pictureBox3.Left + pictureBox3.Width + 5; pictureBox5.Left = LblThreeDay.Left + LblThreeDay.Width + 5; pictureBox5.Top = pictureBox6.Top = LblThreeDay.Top - 8; pictureBox6.Left = pictureBox5.Left + pictureBox5.Width + 5; LoadingIndex.Hide(); } catch (Exception e) { BLL.Log.Write(e.Message, "Exception"); MessageBoxEx.Show(e.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void MainForm_Load(object sender, EventArgs e) { this.BackColor = Color.FromArgb(63, 176, 215); LoadingIndex.Show(); TimerLoad.Enabled = true; TimerLoad.Interval = 4000; TimerClock.Enabled = true; TimerClock.Interval = 1000; LblVersion.Text = LblVersion.Text + Assembly.GetExecutingAssembly().GetName().Version.ToString(); CmoBoxPrior.SelectedIndex = 1; FindPwd.Left = (this.Width - FindPwd.Width) / 2;//还原位置 FindPwd.Visible = false; Tool.StationNameXml(); LblShowEmail.Text = "邮箱:" + u.Email; LblShowTel.Text = "电话:" + u.Tel; LblUserNameShow.Text = "用户名:" + u.UserName; LblShowDep.Text = "所在单位:" + u.School; LoadingEmail.Hide(); LoadingNews.Hide(); LoadingTicket.Hide(); }