#At file:///C:/Users/Reggie/work/wex/installer-updated/ based on revid:reggie.burnett@stripped
262 Reggie Burnett 2011-01-24
Added code to wex installer update to wait for wex installer to exit
modified:
WexInstallerUpdater/MainForm.Designer.cs
WexInstallerUpdater/MainForm.cs
WexInstallerUpdater/MainForm.resx
=== modified file 'WexInstallerUpdater/MainForm.Designer.cs'
=== modified file 'WexInstallerUpdater/MainForm.Designer.cs'
--- a/WexInstallerUpdater/MainForm.Designer.cs 2011-01-24 16:20:32 +0000
+++ b/WexInstallerUpdater/MainForm.Designer.cs 2011-01-24 18:24:06 +0000
@@ -28,9 +28,11 @@
/// </summary>
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.label1 = new System.Windows.Forms.Label();
this.downloadProgress = new System.Windows.Forms.ProgressBar();
this.cancelButton = new System.Windows.Forms.Button();
+ this.killProcessTimer = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// label1
@@ -59,6 +61,11 @@
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
+ // killProcessTimer
+ //
+ this.killProcessTimer.Interval = 250;
+ this.killProcessTimer.Tick += new System.EventHandler(this.killProcessTimer_Tick);
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -81,6 +88,7 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ProgressBar downloadProgress;
private System.Windows.Forms.Button cancelButton;
+ private System.Windows.Forms.Timer killProcessTimer;
}
}
=== modified file 'WexInstallerUpdater/MainForm.cs'
--- a/WexInstallerUpdater/MainForm.cs 2011-01-24 16:20:32 +0000
+++ b/WexInstallerUpdater/MainForm.cs 2011-01-24 18:24:06 +0000
@@ -9,6 +9,7 @@
using System.Net;
using System.IO;
using System.Diagnostics;
+using System.Threading;
namespace WexInstallerUpdater
{
@@ -16,6 +17,8 @@
{
private string tempFile;
private WebClient client;
+ private int counter;
+ private bool processingTimer;
public MainForm()
{
@@ -41,7 +44,7 @@
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = tempFile;
Process.Start(psi);
- Application.Exit();
+ Close();
}
void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
@@ -49,10 +52,11 @@
if (e.Cancelled)
{
MessageBox.Show("The update has been cancelled");
- Application.Exit();
+ Close();
+ return;
}
- else
- Install();
+ client = null;
+ killProcessTimer.Enabled = true;
}
void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
@@ -63,7 +67,52 @@
private void cancelButton_Click(object sender, EventArgs e)
{
+ if (client == null)
+ {
+ killProcessTimer.Enabled = false;
+ Close();
+ return;
+ }
client.CancelAsync();
}
+
+ private void killProcessTimer_Tick(object sender, EventArgs e)
+ {
+ if (processingTimer) return;
+ processingTimer = true;
+
+ Process[] processes = Process.GetProcessesByName("WexInstaller");
+ if (processes == null || processes.Length == 0)
+ {
+ killProcessTimer.Enabled = false;
+ Install();
+ return;
+ }
+
+ if (counter == 40)
+ {
+ DialogResult result = MessageBox.Show(
+ "Do you wish to continue waiting for MySQL Universal Installer to exit?",
+ "Contiue waiting",
+ MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+ if (result == DialogResult.No)
+ {
+ Close();
+ processingTimer = false;
+ return;
+ }
+ counter = 0;
+ }
+ else
+ {
+ if (counter == 0)
+ label1.Text = "Waiting for the MySQL Universal Installer to exit";
+ else if ((counter % 4) == 0)
+ label1.Text += ".";
+ counter++;
+ }
+
+ processingTimer = false;
+ }
}
}
=== modified file 'WexInstallerUpdater/MainForm.resx'
--- a/WexInstallerUpdater/MainForm.resx 2011-01-24 16:20:32 +0000
+++ b/WexInstallerUpdater/MainForm.resx 2011-01-24 18:24:06 +0000
@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="killProcessTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
</root>
\ No newline at end of file
Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110124182406-7vgpmi1gy6yp0hps.bundle
| Thread |
|---|
| • bzr commit into wex-installer-1.0 branch (reggie.burnett:262) | Reggie Burnett | 24 Jan |