Example #1
0
 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];
     //获取客观数据
     NowNWP = FunClass.LoadStationNFData(IP + UrlOfWaveNWPRead, missionList[0]);
     //初始化datagridview,加载站点信息
     RefreshDataGridView();
     //下拉框选择任务初始化
     comboBox1.DataSource    = missionList;
     comboBox1.ValueMember   = "missionID";
     comboBox1.DisplayMember = "missionName";
     pictureForm.ChangePicture(FunClass.GetPicture(IP + UrlOfWavePicture, NowStation.stationID.ToString("00") + "DAY", 1, NowMission.forecastFilesHead), NowStation);
 }
Example #2
0
        //当有数据被选中时的操作
        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(ClientApp.Properties.Resources.Nothing, null);
                //pictureForm.ChangePicture(null,null);
            }
            else
            {
                if (col - 2 > 0 & col - 2 <= NowStation.forecastPrescription)
                {
                    //变更图片
                    //pictureForm.ChangePicture(FunClass.GetPicture(IP + UrlOfWavePicture, NowStation.photoHead, col - 2, NowMission.forecastFilesHead),NowStation);
                    pictureForm.ChangePicture(FunClass.GetPicture(IP + UrlOfWavePicture, NowStation.stationID.ToString("00") + "DAY", col - 2, NowMission.forecastFilesHead), NowStation);
                }
                else
                {
                    //超出预报时效
                    pictureForm.ChangePicture(ClientApp.Properties.Resources.Nothing, null);
                }
            }
            //当所选数据在预报时效内时,显示相应图片
        }
Example #3
0
 /// <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 + UrlOfWavePicture, NowStation.stationID.ToString("00") + "DAY", 1, NowMission.forecastFilesHead), NowStation);
 }
Example #4
0
 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("数据更新失败");
         }
     }
 }
Example #5
0
        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();
                }
            }
        }
Example #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            string msg = FunClass.WaveProducGeneration(IP + UrlOfWaveProdConv, NowMission);

            MessageBox.Show(msg);
        }
Example #7
0
        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;
                }
                }
            }
        }
Example #8
0
 private void button1_Click(object sender, EventArgs e)
 {
     FunClass.PostWaveData(IP + UrlOfWaveDataInput, NowStation, NowMission);
 }