Exemplo n.º 1
0
 private void dgvMstsc_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1)
     {
         var fileName = dgvMstsc.Rows[e.RowIndex].Cells["RDPFileName"].Value.ToString();
         MstscHelper.ConnectionServer(fileName);
     }
 }
Exemplo n.º 2
0
        private void dgvMstsc_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    var id       = dgvMstsc.Rows[e.RowIndex].Cells["Id"].Value.ToString();
                    var fileName = dgvMstsc.Rows[e.RowIndex].Cells["RDPFileName"].Value.ToString();
                    switch (dgvMstsc.Columns[e.ColumnIndex].Name)
                    {
                    case "btnConnection":
                        MstscHelper.ConnectionServer(fileName);
                        break;

                    case "btnUpdate":
                        new frmAddOrEdit()
                        {
                            Id = id
                        }.ShowDialog();
                        Bind();
                        break;

                    case "btnDel":
                        if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            MstscData.Delete(id);
                            MstscHelper.DeleteFileByName(fileName);
                            Bind();
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }