private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (NowMission != null & NowMission != null) { try { if (!bool.Parse(FunClass.PostWaveData(IP + UrlOfWaveDataInput, NowStation, NowMission))) { MessageBox.Show("数据更新失败"); } } catch { MessageBox.Show("数据更新失败"); } } }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (NowMission != null & NowMission != null) { try { if (!bool.Parse(FunClass.PostWaveData(IP + UrlOfWaveDataInput, NowStation, NowMission))) { MessageBox.Show("数据更新失败"); return; } } catch { MessageBox.Show("数据更新失败"); return; } } if (NowNWP != null & e.RowIndex >= 0) { string dataStr = dataGridView0[e.ColumnIndex, e.RowIndex].Value.ToString(); switch (e.ColumnIndex) { case 2: { if (!dataStr.Equals(NowNWP[e.RowIndex].forecastValue1.ToString())) { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.LimeGreen; } else { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.Black; } return; } case 3: { if (!dataStr.Equals(NowNWP[e.RowIndex].forecastValue2.ToString())) { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.LimeGreen; } else { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.Black; } return; } case 4: { if (!dataStr.Equals(NowNWP[e.RowIndex].forecastValue3.ToString())) { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.LimeGreen; } else { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.Black; } return; } case 5: { if (!dataStr.Equals(NowNWP[e.RowIndex].forecastValue4.ToString())) { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.LimeGreen; } else { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.Black; } return; } case 6: { if (!dataStr.Equals(NowNWP[e.RowIndex].forecastValue5.ToString())) { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.LimeGreen; } else { dataGridView0[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.Black; } return; } } } }
private void button1_Click(object sender, EventArgs e) { FunClass.PostWaveData(IP + UrlOfWaveDataInput, NowStation, NowMission); }