private async void btnRdsStop_Click(object sender, EventArgs e) { var service = new SystemManagement(); var lstInstanceSelected = new List <SA_RdsInstance>(); var strInstanceSelected = string.Empty; foreach (DataGridViewRow item in gvRDS.Rows) { if (item.Cells["ActionSelected"].Value == null) { continue; } bool selected; if (bool.TryParse(item.Cells["ActionSelected"].Value.ToString(), out selected) && selected && item.Cells["Status"].Value.ToString() == "available") { lstInstanceSelected.Add(lstRdsInstances.Find( o => o.DBInstanceIdentifier == (string)item.Cells["DBInstanceIdentifier"].Value)); strInstanceSelected += (string)item.Cells["DBInstanceIdentifier"].Value + ","; } } if (lstInstanceSelected.Count > 0) { strInstanceSelected = strInstanceSelected.Substring(0, strInstanceSelected.Length - 1); var confirmResult = MessageBox.Show( string.Format("RDS instances: {0} are selected. Pleae click YES button to stop them!", strInstanceSelected), "Confirm Stop RDS Instances", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { try { NotifyToMainStatus($"RDS instances {strInstanceSelected} begin to stopped.", System.Drawing.Color.Green); await service.StopRdsInstances(lstInstanceSelected); await PopulateRDSList(); } catch (Exception ex) { HandleException(ex); return; } WriteNotification($"RDS instances {strInstanceSelected} are stopped."); } } }