private void SingleKillProcess(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0 || e.ColumnIndex != dataGridView_Info.Columns["Exit Program"].Index) { return; } int nIndex = e.RowIndex; string strID = dataGridView_Info.Rows[nIndex].Cells["ID"].Value.ToString(); int nID = IDDatas.getDataTable()[strID].nPID; if (nID != -1) { ProcessControl.KillProcess(nID); IDDatas.getDataTable()[strID].nPID = -1; ChangeTextRow(nIndex, false); } //This is the code which will show the button click row data. Thank you. } catch (Exception ex) { logs.Format(ex.ToString()); } }
private void button_checkConnection_Click(object sender, EventArgs e) { try { int nIndex = 0; foreach (var data in IDDatas.getDataTable()) { if (connectDialog_check(nIndex++) == false) { int nID = IDDatas.getDataTable()[data.Key].nPID; if (nID != -1) { ProcessControl.KillProcess(nID); IDDatas.getDataTable()[data.Key].nPID = -1; Log_move.Format(data.Key.ToString() + "연결해제로 프로세스 종료함."); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void ThreadNewSequence(int nIndex, Boolean bSingle = false) { lock (lockObject) { string strID = GetDataGridSelectID(nIndex); Thread_Refresh.Suspend(); logs.Format(strID + " 로그인 시작"); int nID = -1; bool bRet = true; try { eSeq_Login eSL = eSeq_Login.LoginExecute; string strError = "Error!! : "; while (eSL != eSeq_Login.LoginComplete) { switch (eSL) { case eSeq_Login.LoginExecute: bRet = ExecuteProgram(ref nID); break; case eSeq_Login.LoginConnect: bRet = ConnectProgram(nID); break; case eSeq_Login.LoginSelectServer: bRet = SelectSeverProgram(nID); break; case eSeq_Login.LoginAgree: bRet = AgreeProgram(nID); break; case eSeq_Login.LoginInputInfo: bRet = InputInfoProgram(nIndex, nID); break; case eSeq_Login.LoginError: throw new Exception(strError); } if (bRet == false) { strError += eSL.ToString(); eSL = eSeq_Login.LoginError; ProcessControl.KillProcess(nID); } else { eSL++; } } if (eSL == eSeq_Login.LoginComplete) { IDDatas.getDataTable()[strID].nPID = nID; DataTableToDicData(); FC.SaveData(IDDatas); ProcessControl.MiniMizedProcess(nID); } } catch (Exception e) { ProcessControl.KillProcess(nID); logs.Format(e.ToString()); } finally { logs.Format(strID + ": 로그인 " + ((bRet) ? "성공" : "실패")); } Thread_Refresh.Resume(); } }