private void killApplicationByPID_Click(object sender, EventArgs e)
 {
     try
     {
         DataGridViewRow           row = this.dataApplication.SelectedRows[0];
         FormApplicationInfoDetail formApplicationInfoDetail = new FormApplicationInfoDetail();
         String       pid          = Convert.ToString(row.Cells[1].Value);
         DialogResult dialogResult = MessageBox.Show("Bạn có chắc muốn tắt ứng dụng với PID " + pid + " ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dialogResult == DialogResult.Yes)
         {
             String data = this.sshControll.read("kill -9 " + pid);
             this.txtConsoleLog.Text = data;
             loadPsAux("");
         }
     }
     catch (Exception exp)
     {
         MessageBox.Show("Lỗi xử lý: " + exp.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void dataApplication_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                DataGridViewRow           row = this.dataApplication.SelectedRows[0];
                FormApplicationInfoDetail formApplicationInfoDetail = new FormApplicationInfoDetail();
                String   pid             = Convert.ToString(row.Cells[1].Value);
                String   listnerPortData = this.sshControll.read("netstat -anp | grep " + pid);
                String[] psAuxArrayData  = listnerPortData.Split('\n');
                String   listenerApp     = "";

                foreach (String line in psAuxArrayData)
                {
                    if (line.IndexOf("LISTEN") > 0)
                    {
                        listenerApp = line.Trim().Replace(" ", ";");
                        break;
                    }
                }
                String port = "";

                if (!listenerApp.Equals(""))
                {
                    String[]      arrayDataPort = listenerApp.Split(';');
                    List <String> dataTemp      = new List <string>();

                    foreach (String line in arrayDataPort)
                    {
                        String l = line.Trim();

                        if ("".Equals(l))
                        {
                            continue;
                        }
                        dataTemp.Add(l);
                    }
                    if (dataTemp.Count > 4)
                    {
                        String s = dataTemp[3].Replace(":", " ").Trim();
                        try
                        {
                            int p = Convert.ToInt32(s);
                            port = s;
                        }
                        catch (Exception exp)
                        {
                            Console.WriteLine(exp.Message);
                            try
                            {
                                port = s.Substring(s.IndexOf(" ")).Trim();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                            }
                        }
                    }
                }
                formApplicationInfoDetail.txtPortRunning.Text  = port;
                formApplicationInfoDetail.txtUserValue.Text    = Convert.ToString(row.Cells[0].Value);;
                formApplicationInfoDetail.txtPIDValue.Text     = pid;
                formApplicationInfoDetail.txtCPUValue.Text     = Convert.ToString(row.Cells[2].Value);
                formApplicationInfoDetail.txtMEMValue.Text     = Convert.ToString(row.Cells[3].Value);
                formApplicationInfoDetail.txtVSZValue.Text     = Convert.ToString(row.Cells[4].Value);
                formApplicationInfoDetail.txtRSSValue.Text     = Convert.ToString(row.Cells[5].Value);
                formApplicationInfoDetail.txtTTYValue.Text     = Convert.ToString(row.Cells[6].Value);
                formApplicationInfoDetail.txtSTATValue.Text    = Convert.ToString(row.Cells[7].Value);
                formApplicationInfoDetail.txtSTARTValue.Text   = Convert.ToString(row.Cells[8].Value);
                formApplicationInfoDetail.txtTIMEValue.Text    = Convert.ToString(row.Cells[9].Value);
                formApplicationInfoDetail.txtCOMMANDValue.Text = Convert.ToString(row.Cells[10].Value);
                formApplicationInfoDetail.ShowDialog();
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }