コード例 #1
0
 /// <summary>
 /// 双击事件:双击附件时打开附件内容;双击指标项时显示指标细节
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgv_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.ColumnIndex >= 0)
     {
         if (dgv.Columns[e.ColumnIndex].Name == "attachmentCount")
         {
             if (dgv.Rows[e.RowIndex].Cells["attachment"].Value != null)
             {
                 if (dgv.Rows[e.RowIndex].Cells["attachment"].Value.ToString() != string.Empty || dgv.Rows[e.RowIndex].Cells["supplement"].Value.ToString() != string.Empty)
                 {
                     #region 过时代码
                     ////只有单个附件,直接打开
                     //if (dgv.Rows[e.RowIndex].Cells["attachmentCount"].Value.ToString().Replace("(补)", "") == "1个")
                     //{
                     //    string remoteFilePath = dgv.Rows[e.RowIndex].Cells["attachment"].Value.ToString();
                     //    string localFilePath = Application.StartupPath + @"\temp" + remoteFilePath.Replace("/", @"\");
                     //    string localFileFolder = Path.GetDirectoryName(localFilePath);//获取待下载文件的下载后目录,如不存在目录则先创建
                     //    if (!Directory.Exists(localFileFolder))
                     //    {
                     //        Directory.CreateDirectory(localFileFolder);
                     //    }
                     //    FtpProcessForm fpf = new FtpProcessForm(localFilePath, remoteFilePath, false);
                     //    var downloadState = fpf.ShowDialog();
                     //    if (downloadState == DialogResult.OK)
                     //    {
                     //        System.Diagnostics.Process.Start("explorer.exe", localFilePath);//打开下载的文件
                     //    }
                     //    else
                     //    {
                     //        MessageBoxEx.Show("下载附件失败");
                     //    }
                     //}
                     //else//多个附件,打开附件列表窗体
                     //{
                     //    string remoteFilePath = dgv.Rows[e.RowIndex].Cells["attachment"].Value.ToString();
                     //    FtpListForm flf = new FtpListForm(remoteFilePath);
                     //    flf.ShowDialog();
                     //}
                     #endregion
                     //附件和补漏报合并显示,所以附件无论单个还是多个,都要打开附件列表
                     string      remoteFilePath       = dgv.Rows[e.RowIndex].Cells["attachment"].Value.ToString();
                     string      supplementJsonString = dgv.Rows[e.RowIndex].Cells["supplement"].Value.ToString();
                     FtpListForm flf = new FtpListForm(remoteFilePath, supplementJsonString);
                     flf.ShowDialog();
                 }
             }
         }
         if (dgv.Columns[e.ColumnIndex].Name == "indicatorInstr" || dgv.Columns[e.ColumnIndex].Name == "indicatorDesc" || dgv.Columns[e.ColumnIndex].Name == "indicatorName")
         {
             IndicatorEdit ie = new AviationSafetyExperiment.IndicatorEdit(_readOnly: true);
             var           indicatorIdValue = dgv.Rows[e.RowIndex].Cells["indicatorId"].Value.ToString();
             int           indicatorId;
             if (int.TryParse(indicatorIdValue, out indicatorId))
             {
                 ie.indicator = IndicatorCache.getCache().FirstOrDefault(i => i.id == indicatorId);
                 ie.Show(this);
             }
         }
     }
 }
コード例 #2
0
        private void btn_addIndicator_Click(object sender, EventArgs e)
        {
            IndicatorEdit ie = new AviationSafetyExperiment.IndicatorEdit();

            ie.ShowDialog(this);
            getIndicator();
            filtrateIndicator();
        }
コード例 #3
0
 private void btn_editIndicator_Click(object sender, EventArgs e)
 {
     if (dgv_indicator.SelectedRows.Count == 0)
     {
         MessageBoxEx.Show("请先选择一个指标");
     }
     else
     {
         IndicatorEdit ie = new AviationSafetyExperiment.IndicatorEdit();
         ie.indicator = indicatorList.FirstOrDefault(i => i.id == (int)dgv_indicator.SelectedRows[0].Cells[0].Value);
         ie.ShowDialog(this);
         getIndicator();
         filtrateIndicator();
     }
 }