List:Commits« Previous MessageNext Message »
From:Mike Lischke Date:February 25 2011 3:04pm
Subject:bzr commit into wex-installer-1.0 branch (mike.lischke:341)
View as plain text  
#At file:///D:/Work/MySQL/installer/ based on revid:mike.lischke@stripped

  341 Mike Lischke	2011-02-25
      - Cancel pending download when we return from detail update page to welcome page.
      - Detailed update page: fixed wrong description label size, achored its right size to make it resize properly if necessary.
      - Detailed update page: made product update list wider to avoid unnecessary horizontal scrollbar (there is still plenty of room). Anchored its right size, like for the description label.
      - Center main window explicitely on start if no (valid) configuration data could be read.
      - Installer configuration: added step to check for a product manifest in the solution if we are debugging, to allow running the installer without ever having anything setup.
      - Added check for not set ProductCachePath and InstallationRoot values (e.g. due to invalid configuration) to avoid crashs.
      - Added flag which indicates if we successfully loaded a configuration or running on default values. Some default values are now set if no configuration file could be loaded or certain values are missing (for now show license and a default update URL).
      - UpdateURL: added c-tor to take a string to simply manual setup.
      - ProductManager: added check for proper update URL index, to avoid crash when no URL is defined (this is rather defensive, because a default URL is now defined if necessary).

    modified:
      WexInstaller.Core/InstallerConfiguration.cs
      WexInstaller.Core/ProductManager.cs
      WexInstaller/InstallWizard/DetailedUpdateCheck.Designer.cs
      WexInstaller/InstallWizard/DetailedUpdateCheck.cs
      WexInstaller/MainForm.cs
      WexInstaller/WexInstaller.csproj
=== modified file 'WexInstaller.Core/InstallerConfiguration.cs'
=== modified file 'WexInstaller.Core/InstallerConfiguration.cs'
--- a/WexInstaller.Core/InstallerConfiguration.cs	2011-02-08 21:28:42 +0000
+++ b/WexInstaller.Core/InstallerConfiguration.cs	2011-02-25 15:04:43 +0000
@@ -16,6 +16,9 @@
         private static InstallerConfigurationData Instance = new InstallerConfigurationData();
         private static WebClient Wc = new WebClient();
 
+        // Indicates if this configuration was loaded from file or is just a default config.
+        private static bool isDefault = true;
+
         #region Properties
 
         public static bool DisplayLicenseAgreement
@@ -100,7 +103,19 @@
             get { return String.Format("{0}\\new_products.xml", HomeDir);}
         }
 
-#endregion
+        public static bool IsDefault
+        {
+            get { return isDefault;  }
+        }
+
+#if DEBUG
+        public static string DevManifest
+        {
+            get { return @"..\..\..\setup\products.xml"; }
+        }
+#endif
+        
+        #endregion
 
         public static void Save()
         {
@@ -124,15 +139,37 @@
                 XmlSerializer s = new XmlSerializer(typeof(InstallerConfigurationData));
                 TextReader r = new StreamReader(ConfigFile);
                 Instance = (InstallerConfigurationData)s.Deserialize(r);
-                if (!Instance.ProductCachePath.EndsWith(Path.DirectorySeparatorChar.ToString()))
+                isDefault = false;
+
+                // Keep in mind the installation can be unfinished when we restart, so
+                // some info is not yet set.
+                if (Instance.ProductCachePath != null &&
+                    !Instance.ProductCachePath.EndsWith(Path.DirectorySeparatorChar.ToString()))
                     Instance.ProductCachePath += Path.DirectorySeparatorChar;
-                if (!Instance.InstallationRoot.EndsWith(Path.DirectorySeparatorChar.ToString()))
+                if (Instance.InstallationRoot != null &&
+                    !Instance.InstallationRoot.EndsWith(Path.DirectorySeparatorChar.ToString()))
                     Instance.InstallationRoot += Path.DirectorySeparatorChar;
             }
             else
             {
-                // Create a new Instance and set some defaults maybe?
-            }
+                Instance.LicenseAgreement = 1;
+            }
+
+            // Consider incomplete/corrupt/non-existing config file.
+            // Set useful defaults for important values.
+            if (Instance.UpdateURLs.Count == 0)
+            {
+                UpdateURL url = new UpdateURL("http://wb.mysql.com/installer/products.xml");
+                Instance.UpdateURLs.Add(url);
+            }
+
+            Instance.UpdateTimeoutMilliseconds = 10000;
+
+            // TODO: check which of the following entries needs some better default value.
+            // Instance.UpdateCheckFrequency
+            // Instance.ProductCachePath
+            // Instance.InstallationRoot
+            // Instance.ProductCode
         }
 
         public static bool IsWow64()
@@ -160,6 +197,15 @@
 
     public class UpdateURL
     {
+        public UpdateURL()
+        {
+            URL = "";
+        }
+
+        public UpdateURL(string url)
+        {
+            URL = url;
+        }
         public string URL { get; set; }
     }
 

=== modified file 'WexInstaller.Core/ProductManager.cs'
--- a/WexInstaller.Core/ProductManager.cs	2011-02-09 17:35:42 +0000
+++ b/WexInstaller.Core/ProductManager.cs	2011-02-25 15:04:43 +0000
@@ -147,10 +147,30 @@
             return args[1];   // this should be the default catalog name
         }
 
+        /// <summary>
+        /// Attempts to load a product manifest file. Strategy is:
+        /// - Look for a development version of the file if we running under a debugger. If it exists
+        ///   use it as temporary manifest.
+        /// - See if there is a temporary manifest (either from the first step or a regular one). If one
+        ///   exists and it is younger than the regular manifest then make this the regular one.
+        /// - If a regular manifest exists load it.
+        /// </summary>
         private static void LoadManifestWithCheckForTemp()
         {
-            // first we need to see if there is any temp manifest file to check
-            ProductManifest tempManifest = ObjectifyManifest(InstallerConfiguration.TempProductsManifest);
+            // Use development version of the manifest if we are in debug mode.
+            ProductManifest tempManifest;
+            string tempSourcePath;
+
+#if DEBUG
+            tempManifest = ObjectifyManifest(InstallerConfiguration.DevManifest);
+            tempSourcePath = InstallerConfiguration.DevManifest;
+#endif
+            // First we need to see if there is any temp manifest file to check.
+            if (tempManifest == null)
+            {
+                tempManifest = ObjectifyManifest(InstallerConfiguration.TempProductsManifest);
+                tempSourcePath = InstallerConfiguration.TempProductsManifest;
+            }
             ProductManifest currentManifest = ObjectifyManifest(InstallerConfiguration.ProductsManifest);
 
             if (tempManifest == null)
@@ -161,7 +181,7 @@
                 {
                     manifest = tempManifest;
                     currentManifest = null;
-                    File.Copy(InstallerConfiguration.TempProductsManifest, InstallerConfiguration.ProductsManifest, true);
+                    File.Copy(tempSourcePath, InstallerConfiguration.ProductsManifest, true);
                 }
                 else
                 {
@@ -266,6 +286,12 @@
         {
             Logger.LogTrace("ProductManager.DownloadManifest()");
 
+            if (UpdateURLIndex > InstallerConfiguration.UpdateURLs.Count)
+            {
+                Logger.LogWarning("Invalid update URL index. No download URL defined?");
+                return false;
+            }
+
             if (File.Exists(InstallerConfiguration.TempManifest))
             {
                 File.Delete(InstallerConfiguration.TempManifest);

=== modified file 'WexInstaller/InstallWizard/DetailedUpdateCheck.Designer.cs'
--- a/WexInstaller/InstallWizard/DetailedUpdateCheck.Designer.cs	2011-02-07 21:39:05 +0000
+++ b/WexInstaller/InstallWizard/DetailedUpdateCheck.Designer.cs	2011-02-25 15:04:43 +0000
@@ -51,10 +51,12 @@
             // 
             // actionLabel
             // 
+            this.actionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
             this.actionLabel.Font = new System.Drawing.Font("Tahoma", 10F);
             this.actionLabel.Location = new System.Drawing.Point(12, 80);
             this.actionLabel.Name = "actionLabel";
-            this.actionLabel.Size = new System.Drawing.Size(387, 49);
+            this.actionLabel.Size = new System.Drawing.Size(483, 57);
             this.actionLabel.TabIndex = 2;
             this.actionLabel.Text = "Before the installation is performed, the Installer will check if there are newer" +
                 " versions of the products you are about to install / already installed are avail" +
@@ -66,9 +68,9 @@
             this.skipUpdates.Font = new System.Drawing.Font("Tahoma", 8.25F);
             this.skipUpdates.Location = new System.Drawing.Point(15, 423);
             this.skipUpdates.Name = "skipUpdates";
-            this.skipUpdates.Size = new System.Drawing.Size(181, 17);
+            this.skipUpdates.Size = new System.Drawing.Size(250, 17);
             this.skipUpdates.TabIndex = 3;
-            this.skipUpdates.Text = "&Skip the check for new manifest ";
+            this.skipUpdates.Text = "&Skip the check for updates (not recommended)";
             this.skipUpdates.UseVisualStyleBackColor = true;
             this.skipUpdates.CheckedChanged += new System.EventHandler(this.skipUpdates_CheckedChanged);
             // 
@@ -98,7 +100,7 @@
             this.connectionSuccessIcon.Image = global::WexInstaller.Properties.Resources.ActionDone;
             this.connectionSuccessIcon.Location = new System.Drawing.Point(80, 154);
             this.connectionSuccessIcon.Name = "connectionSuccessIcon";
-            this.connectionSuccessIcon.Size = new System.Drawing.Size(14, 14);
+            this.connectionSuccessIcon.Size = new System.Drawing.Size(16, 16);
             this.connectionSuccessIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
             this.connectionSuccessIcon.TabIndex = 9;
             this.connectionSuccessIcon.TabStop = false;
@@ -109,7 +111,7 @@
             this.fetchSuccessIcon.Image = global::WexInstaller.Properties.Resources.ActionDone;
             this.fetchSuccessIcon.Location = new System.Drawing.Point(80, 180);
             this.fetchSuccessIcon.Name = "fetchSuccessIcon";
-            this.fetchSuccessIcon.Size = new System.Drawing.Size(14, 14);
+            this.fetchSuccessIcon.Size = new System.Drawing.Size(16, 16);
             this.fetchSuccessIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
             this.fetchSuccessIcon.TabIndex = 10;
             this.fetchSuccessIcon.TabStop = false;
@@ -117,10 +119,10 @@
             // 
             // connectionEmptyIcon
             // 
-            this.connectionEmptyIcon.Image = Resources.ActionOpen;
+            this.connectionEmptyIcon.Image = global::WexInstaller.Properties.Resources.ActionOpen;
             this.connectionEmptyIcon.Location = new System.Drawing.Point(80, 154);
             this.connectionEmptyIcon.Name = "connectionEmptyIcon";
-            this.connectionEmptyIcon.Size = new System.Drawing.Size(12, 14);
+            this.connectionEmptyIcon.Size = new System.Drawing.Size(16, 16);
             this.connectionEmptyIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
             this.connectionEmptyIcon.TabIndex = 12;
             this.connectionEmptyIcon.TabStop = false;
@@ -130,7 +132,7 @@
             this.fetchEmptyIcon.Image = global::WexInstaller.Properties.Resources.ActionOpen;
             this.fetchEmptyIcon.Location = new System.Drawing.Point(80, 180);
             this.fetchEmptyIcon.Name = "fetchEmptyIcon";
-            this.fetchEmptyIcon.Size = new System.Drawing.Size(12, 14);
+            this.fetchEmptyIcon.Size = new System.Drawing.Size(16, 16);
             this.fetchEmptyIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
             this.fetchEmptyIcon.TabIndex = 14;
             this.fetchEmptyIcon.TabStop = false;
@@ -140,7 +142,7 @@
             this.currentActionIcon.Image = global::WexInstaller.Properties.Resources.ActionCurrent;
             this.currentActionIcon.Location = new System.Drawing.Point(80, 153);
             this.currentActionIcon.Name = "currentActionIcon";
-            this.currentActionIcon.Size = new System.Drawing.Size(12, 14);
+            this.currentActionIcon.Size = new System.Drawing.Size(16, 16);
             this.currentActionIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
             this.currentActionIcon.TabIndex = 15;
             this.currentActionIcon.TabStop = false;
@@ -148,6 +150,8 @@
             // 
             // productList
             // 
+            this.productList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
             this.productList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
             this.productList.CheckBoxes = true;
             this.productList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
@@ -156,7 +160,7 @@
             this.productList.FullRowSelect = true;
             this.productList.Location = new System.Drawing.Point(80, 214);
             this.productList.Name = "productList";
-            this.productList.Size = new System.Drawing.Size(319, 153);
+            this.productList.Size = new System.Drawing.Size(415, 153);
             this.productList.TabIndex = 16;
             this.productList.UseCompatibleStateImageBehavior = false;
             this.productList.View = System.Windows.Forms.View.Details;
@@ -171,7 +175,7 @@
             this.currentActionFailedIcon.Image = global::WexInstaller.Properties.Resources.ActionError;
             this.currentActionFailedIcon.Location = new System.Drawing.Point(80, 154);
             this.currentActionFailedIcon.Name = "currentActionFailedIcon";
-            this.currentActionFailedIcon.Size = new System.Drawing.Size(12, 14);
+            this.currentActionFailedIcon.Size = new System.Drawing.Size(16, 16);
             this.currentActionFailedIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
             this.currentActionFailedIcon.TabIndex = 17;
             this.currentActionFailedIcon.TabStop = false;

=== modified file 'WexInstaller/InstallWizard/DetailedUpdateCheck.cs'
--- a/WexInstaller/InstallWizard/DetailedUpdateCheck.cs	2011-02-07 21:39:59 +0000
+++ b/WexInstaller/InstallWizard/DetailedUpdateCheck.cs	2011-02-25 15:04:43 +0000
@@ -94,6 +94,7 @@
 
         public override bool Back()
         {
+            ProductManager.CancelDownload();
             if (!executed)
             {
                 NextButton.Text = Properties.Resources.NextButtonDefaultText;

=== modified file 'WexInstaller/MainForm.cs'
--- a/WexInstaller/MainForm.cs	2011-02-14 17:52:06 +0000
+++ b/WexInstaller/MainForm.cs	2011-02-25 15:04:43 +0000
@@ -16,7 +16,16 @@
         public MainForm()
         {
             InitializeComponent();
-            this.SetDesktopLocation(InstallerConfiguration.Location.X, InstallerConfiguration.Location.Y);
+            if (InstallerConfiguration.IsDefault)
+            {
+                // Set the form to a good default position. We have to compute that manually though
+                // as the StartPosition property has no effect here.
+                Screen currentScreen = Screen.PrimaryScreen;
+                Rectangle workingArea = currentScreen.WorkingArea;
+                Location = new Point((workingArea.Width - Width) / 2, (workingArea.Height - Height) / 2);
+            }
+            else
+                this.SetDesktopLocation(InstallerConfiguration.Location.X, InstallerConfiguration.Location.Y);
         }
 
         public void DoInstall()

=== modified file 'WexInstaller/WexInstaller.csproj'
--- a/WexInstaller/WexInstaller.csproj	2011-02-10 19:36:56 +0000
+++ b/WexInstaller/WexInstaller.csproj	2011-02-25 15:04:43 +0000
@@ -225,57 +225,75 @@
     </Compile>
     <EmbeddedResource Include="Controls\AboutPage.resx">
       <DependentUpon>AboutPage.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Controls\DriveSpaceControl.resx">
       <DependentUpon>DriveSpaceControl.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Controls\FeatureBox.resx">
       <DependentUpon>FeatureBox.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Controls\RemoveControl.resx">
       <DependentUpon>RemoveControl.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Controls\ResourcesLink.resx">
       <DependentUpon>ResourcesLink.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Controls\ResourcesPage.resx">
       <DependentUpon>ResourcesPage.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Controls\InstallWizardControl.resx">
       <DependentUpon>InstallWizardControl.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Controls\InstallWizardSideBarControl.resx">
       <DependentUpon>InstallWizardSideBarControl.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="InstallWizard\CheckRequirements.resx">
       <DependentUpon>CheckRequirements.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="InstallWizard\DetailedUpdateCheck.resx">
       <DependentUpon>DetailedUpdateCheck.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="InstallWizard\Features.resx">
       <DependentUpon>Features.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="InstallWizard\InstallationComplete.resx">
       <DependentUpon>InstallationComplete.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="InstallWizard\InstallProgressPanel.resx">
       <DependentUpon>InstallProgressPanel.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="InstallWizard\InstallType.resx">
       <DependentUpon>InstallType.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="InstallWizard\LicenseAgreement.resx">
       <DependentUpon>LicenseAgreement.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="InstallWizard\UpdateCheck.resx">
       <DependentUpon>UpdateCheck.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="MainForm.resx">
       <DependentUpon>MainForm.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="InstallWizard\AllConfigOverview.resx">
       <DependentUpon>AllConfigOverview.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
@@ -289,12 +307,15 @@
     </Compile>
     <EmbeddedResource Include="Controls\RemoveAllPage.resx">
       <DependentUpon>RemoveAllPage.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Controls\SideBarControl.resx">
       <DependentUpon>SideBarControl.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Controls\WelcomeControl.resx">
       <DependentUpon>WelcomeControl.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="RemovePanels\RemoveComplete.resx">
       <DependentUpon>RemoveComplete.cs</DependentUpon>


Attachment: [text/bzr-bundle] bzr/mike.lischke@oracle.com-20110225150443-1ym4s7c3ginc44ce.bundle
Thread
bzr commit into wex-installer-1.0 branch (mike.lischke:341) Mike Lischke25 Feb