private void InstallApache24Async_DoWork(object sender, DoWorkEventArgs e) { try { if (InternalCheckIsWow64() == true) { if (!Directory.Exists(rootPath + @"Apache24")) { DownloadSelected("Apache24", apachex64Url, apachex64Path, InstallApache24Async); } } else { if (!Directory.Exists(rootPath + @"Apache24")) { DownloadSelected("Apache24", apachex86Url, apachex86Path, InstallApache24Async); } } } catch (Exception ex) { if (InstallApache24Async.IsBusy) { InstallApache24Async.CancelAsync(); } InstallationFailed(ex); } }
private void phjInstall_FormClosing(object sender, FormClosingEventArgs e) { try { if (allowClose == false) { e.Cancel = true; DialogResult quitYesno = MessageBox.Show("Installation in progress. \n\n Quit installation?", "Warning!", MessageBoxButtons.YesNo); if (quitYesno == DialogResult.Yes) { e.Cancel = false; allowClose = true; if (InstallApache24Async.IsBusy) { InstallApache24Async.CancelAsync(); } if (InstallPHJAsync.IsBusy) { InstallPHJAsync.CancelAsync(); } if (ExtractorApache24Async.IsBusy) { ExtractorApache24Async.CancelAsync(); } if (ExtractorPHJAsync.IsBusy) { ExtractorPHJAsync.CancelAsync(); } this.Close(); } else if (quitYesno == DialogResult.No) { e.Cancel = true; } } else { e.Cancel = false; } } catch (Exception ex) { /*e.Cancel = true; * MessageBox.Show(ex.Message);*/ } }
private void InstallPHJAsync_DoWork(object sender, DoWorkEventArgs e) { try { if (InstallApache24Async.IsBusy) { InstallApache24Async.CancelAsync(); } if ((File.Exists(apachex64Path) || File.Exists(apachex86Path)) && !File.Exists(phjPath)) { DownloadSelected("phj-master", phjUrl, phjPath, InstallPHJAsync); } } catch (Exception ex) { if (InstallPHJAsync.IsBusy) { InstallPHJAsync.CancelAsync(); } InstallationFailed(ex); } }
private void StartInstall_Click(object sender, EventArgs e) { if (installSucc == false) { if (!InstallApache24Async.IsBusy) { InstallApache24Async.RunWorkerAsync(); } } else { if (IsServiceAlive()) { instDetails.Text = "Service started"; startInstall.Enabled = true; startInstall.BackColor = Color.Red; startInstall.Text = "Stop Service"; allowClose = true; linkLocalhost.Visible = true; if (IsProcessOpen("httpd") == true) { foreach (var apacheServ in Process.GetProcessesByName("httpd")) { apacheServ.Kill(); } } if (IsProcessOpen("mysqld") == true) { foreach (var mysqlServ in Process.GetProcessesByName("mysqld")) { mysqlServ.Kill(); } } instDetails.Text = "Service stopped"; startInstall.Enabled = true; startInstall.BackColor = Color.DodgerBlue; startInstall.Text = "Start Service"; allowClose = true; linkLocalhost.Visible = false; } else { instDetails.Text = "Service not started"; startInstall.Enabled = true; startInstall.BackColor = Color.DodgerBlue; startInstall.Text = "Start Service"; allowClose = true; serviceStarted = false; linkLocalhost.Visible = false; } if (InstallApache24Async.IsBusy) { InstallApache24Async.CancelAsync(); } if (serviceStarted == false) { Process.Start(rootPath + @"Apache24\bin\httpd.exe"); Process.Start(rootPath + @"Apache24\mysql\bin\mysqld.exe"); serviceStarted = true; instDetails.Text = "Service started"; startInstall.Enabled = true; startInstall.BackColor = Color.Red; startInstall.Text = "Stop Service"; allowClose = true; linkLocalhost.Visible = true; } } }