private void ReloadData() { //初始化MissionList missionList = FunClass.GetMissionList(IP + UrlOfGetMissionList); if (missionList == null) { MessageBox.Show("网络异常or任务列表数据异常or任务为空"); return; } //加载第一个mission的stationList stationList = FunClass.GetStationData(IP + UrlOfChartRead, missionList[0]); if (stationList == null) { MessageBox.Show("网络异常or站点列表数据异常or站点为空"); return; } //赋予当前站点 NowStation = stationList[0]; //初始化datagridview,加载站点信息 RefreshDataGridView(); //下拉框选择任务初始化 comboBox1.DataSource = missionList; comboBox1.ValueMember = "missionID"; comboBox1.DisplayMember = "missionName"; pictureForm.ChangePicture(FunClass.GetPicture(IP + UrlOfMeteoPicture, NowStation.photoHead, 1, NowMission.forecastFilesHead), NowStation); }
//当有数据被选中时的操作 private void DataSelected() {//预报值范围从col3~7 int row = 0; int col = 0; try { row = dataGridView0.CurrentCell.RowIndex + 1; col = dataGridView0.CurrentCell.ColumnIndex + 1; NowStation = stationList[row - 1]; } catch { NowStation = stationList[0]; } //当所选行不是预报值时 if (col - 2 <= 0 | col - 2 > 7) { //不做图片操作 pictureForm.ChangePicture(MeteoClientApp.Properties.Resources.Nothing, null); //pictureForm.ChangePicture(null,null); } else { if (col - 2 > 0 & col - 2 <= NowStation.visibilityPrescription) { //变更图片 pictureForm.ChangePicture(FunClass.GetPicture(IP + UrlOfMeteoPicture, NowStation.photoHead, col - 2, NowMission.forecastFilesHead), NowStation); //pictureForm.ChangePicture(FunClass.GetPicture(IP + UrlOfMeteoPicture, NowStation.stationID.ToString("00")+"_DAY", col - 2, NowMission.forecastFilesHead), NowStation); } else { //超出预报时效 pictureForm.ChangePicture(MeteoClientApp.Properties.Resources.Nothing, null); } } //当所选数据在预报时效内时,显示相应图片 }
/// <summary> /// 任务下拉框进行选择时的操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { selectedID = comboBox1.SelectedIndex; NowMission = missionList[selectedID]; //加载相应stationlist stationList = FunClass.GetStationData(IP + UrlOfChartRead, NowMission); if (stationList == null) { MessageBox.Show("网络异常or站点列表数据异常or站点为空"); ReloadData(); return; } //赋予当前站点 NowStation = stationList[0]; RefreshDataGridView(); pictureForm.ChangePicture(FunClass.GetPicture(IP + UrlOfMeteoPicture, NowStation.photoHead, 1, NowMission.forecastFilesHead), NowStation); }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (NowMission != null & NowMission != null) { try { if (!bool.Parse(FunClass.PostMeteoData(IP + UrlOfMeteoDataInput, NowStation, NowMission))) { MessageBox.Show("数据更新失败"); } } catch { MessageBox.Show("数据更新失败"); } } }
private void button2_Click(object sender, EventArgs e) { var tip = MessageBox.Show("确定重新加载客观预报数据?", "重载客观数据", MessageBoxButtons.YesNo); if (tip.Equals(DialogResult.Yes)) { stationList = FunClass.ReloadStationNFData(IP + UrlOfWaveRefill, NowMission); if (stationList == null) { MessageBox.Show("客观数据更新失败,请查看错误日志。"); return; } else { RefreshDataGridView(); } } }
private void button1_Click(object sender, EventArgs e) { FunClass.PostMeteoData(IP + UrlOfMeteoDataInput, NowStation, NowMission); }
private void button1_Click_1(object sender, EventArgs e) { string msg = FunClass.MeteoProducGeneration(IP + UrlOfMeteoProducGeneration, NowMission); MessageBox.Show(msg); }