/// <summary> /// Bouton Shutdown /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnResetSelected_Click(object sender, EventArgs e) { EntityFactory ef = new EntityFactory(); //TODO Mettre une confirmation JS //if (MessageBox.Show("Confirmer le SHUTDOWN sur ces applications?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) //{ List<string> applicationsName = new List<string>(); //== Crée la liste des applications à arrêter for (int i = 0; i < gvComApp.Rows.Count; i++) { CheckBox chbTemp = (CheckBox)gvComApp.Rows[i].FindControl("chkSelect"); if (chbTemp.Checked) { applicationsName.Add(gvComApp.Rows[i].Cells[1].Text); } } //=== Arret des applications sélectionnées bool shutdowmCompleted = ef.ShutDownCOMApplication(applicationsName); //=== Si réussi on affiche un msg d'erreur if (shutdowmCompleted) { StringBuilder cs = new StringBuilder(); cs.Append("alert('Les applications ont été arrêté.');"); ClientScript.RegisterStartupScript(GetType(),"msgConfirmation", cs.ToString(), true); } RefreshLstComApp(); }
/// <summary> /// ShutDown des Com /// </summary> /// <param name="applicationsName">Si Null on Kill tous les COM</param> private bool ShutDownCOMApplication(IList applicationsName) { bool shutdowmCompleted = false; //TODO === Affiche un msg durant l'éxecution EntityFactory ef = new EntityFactory(); try { //=== Shutdown de tous if (applicationsName == null) { shutdowmCompleted = ef.ShutDownAllCOMApplication(); } else { shutdowmCompleted = ef.ShutDownCOMApplication(applicationsName); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return shutdowmCompleted; }