diff --git a/Start.Designer.cs b/Start.Designer.cs index ab13f8da..70bd9885 100644 --- a/Start.Designer.cs +++ b/Start.Designer.cs @@ -298,6 +298,7 @@ private void InitializeComponent() this.btnGetLatestRelease.Size = new System.Drawing.Size(38, 29); this.btnGetLatestRelease.TabIndex = 22; this.btnGetLatestRelease.Text = ">"; + this.btnGetLatestRelease.Visible = false; this.btnGetLatestRelease.Click += new System.EventHandler(this.btnGetLatestRelease_Click); // // btnViewAllReleases @@ -320,7 +321,7 @@ private void InitializeComponent() this.tabControl.Location = new System.Drawing.Point(3, 14); this.tabControl.Multiline = true; this.tabControl.Name = "tabControl"; - this.tabControl.SelectedIndex = 1; + this.tabControl.SelectedIndex = 0; this.tabControl.Size = new System.Drawing.Size(607, 294); this.tabControl.TabIndex = 26; // diff --git a/Start.cs b/Start.cs index 9ef97a19..10a4cbe4 100644 --- a/Start.cs +++ b/Start.cs @@ -28,6 +28,7 @@ using System.Security.AccessControl; using System.Net.Sockets; using System.Diagnostics; +using System.Threading; using MetroFramework.Controls; using Microsoft.Web.Administration; using Ionic.Zip; @@ -107,6 +108,11 @@ private void cboLatestReleases_SelectedIndexChanged(object sender, EventArgs e) } private void btnGetLatestRelease_Click(object sender, EventArgs e) + { + GetOnlineVersion(); + } + + private void GetOnlineVersion() { ComboItem item = cboLatestReleases.SelectedItem as ComboItem; //Process.Start(item.Name); @@ -116,7 +122,7 @@ private void btnGetLatestRelease_Click(object sender, EventArgs e) client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); var fileName = item.Name.Split('/').Last(); var downloadDirectory = Directory.GetCurrentDirectory() + @"\Downloads\"; - if (!Directory.Exists(downloadDirectory)) + if (!Directory.Exists(downloadDirectory)) { Directory.CreateDirectory(downloadDirectory); } @@ -143,6 +149,7 @@ private void btnGetLatestRelease_Click(object sender, EventArgs e) txtLocalInstallPackage.Text = Directory.GetCurrentDirectory() + "\\Downloads\\" + Path.GetFileName(item.Name); Properties.Settings.Default.LocalInstallPackageRecent = downloadDirectory; Properties.Settings.Default.Save(); + ValidateInstallPackage(); } } @@ -157,10 +164,11 @@ private void client_DownloadProgressChanged(object sender, DownloadProgressChang void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { ComboItem item = cboLatestReleases.SelectedItem as ComboItem; - MessageBox.Show("Download Completed", "Install Package Download", MessageBoxButtons.OK, MessageBoxIcon.Information); + //MessageBox.Show("Download Completed", "Install Package Download", MessageBoxButtons.OK, MessageBoxIcon.Information); txtLocalInstallPackage.Text = Directory.GetCurrentDirectory() + @"\Downloads\" + Path.GetFileName(item.Name); Properties.Settings.Default.LocalInstallPackageRecent = Directory.GetCurrentDirectory() + @"\Downloads\"; Properties.Settings.Default.Save(); + ValidateInstallPackage(); } private void btnViewAllReleases_Click(object sender, EventArgs e) @@ -194,6 +202,28 @@ private void openFileDiag() } private void btnInstallPackageNext_Click(object sender, EventArgs e) + { + if (txtLocalInstallPackage.Text == "") + { + GetOnlineVersion(); + } + else + { + DialogResult result = MessageBox.Show("Local Install Package already defined. Use it?", + "Use Local Install Package", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (result == DialogResult.No) + { + GetOnlineVersion(); + } + else + { + progressBarDownload.Visible = false; + ValidateInstallPackage(); + } + } + } + + private void ValidateInstallPackage() { if (Package.Validate(txtLocalInstallPackage.Text)) {