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

  375 Mike Lischke	2011-03-21
      - Product: apply changes also if only sub-features of a product are affected.
      - InstallProgress: do not allow installation execution if nothing is to be installed.
      - InstallProgress: remove try-again links before installation starts.

    modified:
      WexInstaller.Core/Product.cs
      WexInstaller/InstallWizard/InstallProgressPanel.cs
=== modified file 'WexInstaller.Core/Product.cs'
=== modified file 'WexInstaller.Core/Product.cs'
--- a/WexInstaller.Core/Product.cs	2011-03-21 10:34:56 +0000
+++ b/WexInstaller.Core/Product.cs	2011-03-21 12:59:48 +0000
@@ -229,7 +229,7 @@
     {
       bool hasChanges;
       hasChanges = Installed != ProposedInstalled;
-      foreach (ProductFeature feature in GetPackage().Features)
+      foreach (ProductFeature feature in GetPackage().AllFeatures)
         hasChanges |= feature.HasChanges();
       return hasChanges;
     }
@@ -261,7 +261,7 @@
     }
 
     /// <summary>
-    /// Returns all features for a product, including their subfeatures.
+    /// Returns all features for a product, including their sub-features.
     /// </summary>
     public List<ProductFeature> GetAllProductFeatures()
     {
@@ -492,16 +492,58 @@
       return;
     }
 
+    private enum ChangeType { Unknown, Installation, Update, Removal }
+
+    /// <summary>
+    /// Applies all the changes the user has selected.
+    /// Note: only one type of change can be processed at a time (update, installation, removal).
+    /// </summary>
     public void MakeChanges()
     {
-      if (Installed && ProposedInstalled)
-        Update();
-      else
-        if (!Installed && ProposedInstalled)
+      ChangeType type = ChangeType.Unknown;
+
+      // First check the product as a whole for the change type.
+      if (Installed || ProposedInstalled)
+      {
+        if (Installed)
+          if (ProposedInstalled)
+            type = ChangeType.Update;
+          else
+            type = ChangeType.Removal;
+        else
+          type = ChangeType.Installation;
+      }
+
+      // If there was no change for the product as such go through the features to find changes.
+      if (type == ChangeType.Unknown)
+      {
+        foreach (ProductFeature feature in GetAllProductFeatures())
+          if (feature.Installed || feature.ProposedInstalled)
+          {
+            // We only look for the first change in the feature list, whatever it is and
+            // determine our next action from that.
+            if (feature.Installed)
+              if (feature.ProposedInstalled)
+                type = ChangeType.Update;
+              else
+                type = ChangeType.Removal;
+            else
+              type = ChangeType.Installation;
+          }
+      }
+
+      switch (type)
+      {
+        case ChangeType.Installation:
           Install();
-        else
-          if (Installed && !ProposedInstalled)
-            Remove();
+          break;
+        case ChangeType.Removal:
+          Remove();
+          break;
+        case ChangeType.Update:
+          Update();
+          break;
+      }
     }
 
     public long GetInstallationSizeEstimate()

=== modified file 'WexInstaller/InstallWizard/InstallProgressPanel.cs'
--- a/WexInstaller/InstallWizard/InstallProgressPanel.cs	2011-03-10 18:30:35 +0000
+++ b/WexInstaller/InstallWizard/InstallProgressPanel.cs	2011-03-21 12:59:48 +0000
@@ -59,7 +59,6 @@
       if (!finished)
       {
         started = false;
-        nextOk = true;
         progressLevels.Clear();
         NextButton.Text = Properties.Resources.NextButtonExecuteText;
       }
@@ -72,7 +71,8 @@
       {
         foreach (Product p in pc.Products)
         {
-          if (p.IsUpgrade || (p.ProposedInstalled && p.HasChanges()))
+          //if (p.IsUpgrade || (p.ProposedInstalled && p.HasChanges()))
+          if (p.IsUpgrade || p.HasChanges())
           {
             if (!p.FoundLocal)
               leftToDownload++;
@@ -95,6 +95,8 @@
       }
       leftToInstall = productList.Items.Count;
 
+      nextOk = leftToInstall > 0;
+
       base.Activate();
     }
 
@@ -319,7 +321,20 @@
               Resources.ContinueAfterDownloadErrorText, Resources.ConfirmContinueTitle,
               MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
             if (answer == DialogResult.Yes)
+            {
+              // Disable all try-again links before starting the installation.
+              foreach (ListViewItem item in productList.Items)
+              {
+                Product product = item.Tag as Product;
+                if ((product.CurrentState == ProductState.DownloadError) ||
+                  (product.CurrentState == ProductState.DownloadCancelled) ||
+                  (product.CurrentState == ProductState.DownloadNoMirror))
+                {
+                  item.SubItems[3].Text = "--";
+                }
+              }
               BeginInvoke(new MethodInvoker(InstallNextPackage));
+            }
           }
         }
       }


Attachment: [text/bzr-bundle] bzr/mike.lischke@oracle.com-20110321125948-6esqtcn0qmndp4hy.bundle
Thread
bzr commit into wex-installer-1.0 branch (mike.lischke:375) Mike Lischke21 Mar