List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:February 1 2011 6:46pm
Subject:bzr commit into wex-installer-1.0 branch (reggie.burnett:280)
View as plain text  
#At file:///C:/Users/Reggie/work/wex/installer-updated/ based on revid:reggie.burnett@stripped

  280 Reggie Burnett	2011-02-01
      implemented changes to how we handle default catalog

    modified:
      WexInstaller/Controls/InstallWizardControl.cs
      WexInstaller/Controls/WelcomeControl.cs
      WexInstaller/Core/ProductManager.cs
      WexInstaller/InstallWizard/Features.cs
=== modified file 'WexInstaller/Controls/InstallWizardControl.cs'
=== modified file 'WexInstaller/Controls/InstallWizardControl.cs'
--- a/WexInstaller/Controls/InstallWizardControl.cs	2011-01-31 05:03:43 +0000
+++ b/WexInstaller/Controls/InstallWizardControl.cs	2011-02-01 18:46:41 +0000
@@ -49,7 +49,7 @@
             ShowTab(requirementsTab, false, 4);
 
             // disable setup type tab if we are updating instead of installing
-            if (ProductManager.ProductsInstalled)
+            if (ProductManager.IsNewSetup())
             {
                 ShowType(false);
             }

=== modified file 'WexInstaller/Controls/WelcomeControl.cs'
--- a/WexInstaller/Controls/WelcomeControl.cs	2010-11-30 14:52:06 +0000
+++ b/WexInstaller/Controls/WelcomeControl.cs	2011-02-01 18:46:41 +0000
@@ -15,7 +15,7 @@
         public WelcomeControl()
         {
             InitializeComponent();
-            if (ProductManager.ProductsInstalled || ProductManager.ProductsUpgrade)
+            if (!ProductManager.IsNewSetup())
             {
                 // Maintenance buttons.
                 modifyActionIcon.Visible = true;

=== modified file 'WexInstaller/Core/ProductManager.cs'
--- a/WexInstaller/Core/ProductManager.cs	2011-01-28 20:11:34 +0000
+++ b/WexInstaller/Core/ProductManager.cs	2011-02-01 18:46:41 +0000
@@ -31,6 +31,8 @@
         }
 
         public static ProductManifest Manifest { get; set; }
+        private static bool CatalogProductsInstalled { get; set; }
+        private static bool CatalogProductsUpgrade { get; set; }
         public static bool ProductsInstalled { get; private set; }
         public static bool ProductsUpgrade { get; private set; }
         public static ProductCatalog ActiveCatalog { get; set; }
@@ -78,13 +80,15 @@
                     p.ReferencedProduct = GetProductById(p.ProductId);
                     if (p.ReferencedProduct == null)
                         //TODO: handle this better
-                        throw new InvalidOperationException(); 
+                        throw new InvalidOperationException();
+                    ProductsInstalled = p.ReferencedProduct.Installed;
+                    ProductsUpgrade = p.ReferencedProduct.IsUpgrade;
                 }
 
             // Default to first catalog and then see if we have a catalog file
             // that gives us a different default
             string defaultCatalog = GetDefaultCatalogIfAny();
-            ActiveCatalog = manifest.ProductCatalogs[0];
+            ActiveCatalog = null;
             if (defaultCatalog != null)
             {
                 foreach (ProductCatalog cat in manifest.ProductCatalogs)
@@ -94,13 +98,31 @@
                         break;
                     }
             }
+            if (ActiveCatalog != null)
+            {
+                // setup the Installed and IsUpgrade global variables based
+                // on what from the active catalog is installed.
+                foreach (CatalogProduct cp in ActiveCatalog.Products)
+                {
+                    CatalogProductsInstalled |= cp.ReferencedProduct.Installed;
+                    CatalogProductsUpgrade |= cp.ReferencedProduct.IsUpgrade;
+                }
+            }
+        }
 
-            // setup the Installed and IsUpgrade global variables based
-            // on what from the active catalog is installed.
-            foreach (CatalogProduct cp in ActiveCatalog.Products)
-            {
-                ProductsInstalled |= cp.ReferencedProduct.Installed;
-                ProductsUpgrade |= cp.ReferencedProduct.IsUpgrade;
+        public static bool IsNewSetup()
+        {
+            if (ActiveCatalog == null)
+            {
+                if (ProductsInstalled) return false;
+                if (ProductsUpgrade) return false;
+                return true;
+            }
+            else
+            {
+                if (CatalogProductsInstalled) return false;
+                if (CatalogProductsUpgrade) return false;
+                return true;
             }
         }
 

=== modified file 'WexInstaller/InstallWizard/Features.cs'
--- a/WexInstaller/InstallWizard/Features.cs	2011-01-24 16:44:49 +0000
+++ b/WexInstaller/InstallWizard/Features.cs	2011-02-01 18:46:41 +0000
@@ -33,15 +33,20 @@
             catalogList.Items.Add(new CatalogState(Resources.InstalledMySQLProducts, false));
 
             int index = 0;
-            foreach (ProductCatalog catalog in ProductManager.Catalogs)
+            if (ProductManager.ActiveCatalog != null)
             {
-                if (ProductManager.ActiveCatalog == catalog)
+                foreach (ProductCatalog catalog in ProductManager.Catalogs)
                 {
-                    catalogList.SelectedIndex = index;
-                    break;
+                    if (ProductManager.ActiveCatalog == catalog)
+                    {
+                        catalogList.SelectedIndex = index;
+                        break;
+                    }
+                    index++;
                 }
-                index++;
             }
+            else
+                catalogList.SelectedIndex = 0;
 
             NextButton.Text = Properties.Resources.NextButtonDefaultText;
             base.Activate();


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110201184641-simm3cnve9fighzd.bundle
Thread
bzr commit into wex-installer-1.0 branch (reggie.burnett:280) Reggie Burnett1 Feb