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

  260 Reggie Burnett	2011-01-24
      now reads a .catalog file in the programdata folder to determine if a default catalog should be set.  If it finds one, it uses the base name of the file to set the active catalog

    modified:
      WexInstaller/Core/ProductManager.cs
      WexInstaller/InstallWizard/Features.cs
=== modified file 'WexInstaller/Core/ProductManager.cs'
=== modified file 'WexInstaller/Core/ProductManager.cs'
--- a/WexInstaller/Core/ProductManager.cs	2011-01-24 15:28:26 +0000
+++ b/WexInstaller/Core/ProductManager.cs	2011-01-24 16:44:49 +0000
@@ -81,8 +81,21 @@
                         throw new InvalidOperationException(); 
                 }
 
-            //TODO: replace this with catalog selection from command line
+            // Default to first catalog and then see if we have a catalog file
+            // that gives us a different default
             ActiveCatalog = manifest.ProductCatalogs[0];
+            string[] files = Directory.GetFiles(InstallerConfiguration.HomeDir, "*.catalog");
+            if (files != null && files.Length == 1)
+            {
+                string fileName = Path.GetFileName(files[0]);
+                fileName = fileName.Substring(0, fileName.Length - ".catalog".Length);
+                foreach (ProductCatalog cat in manifest.ProductCatalogs)
+                    if (cat.Id == fileName)
+                    {
+                        ActiveCatalog = cat;
+                        break;
+                    }
+            }
         }
 
         private static void LoadManifestWithCheckForTemp()

=== modified file 'WexInstaller/InstallWizard/Features.cs'
--- a/WexInstaller/InstallWizard/Features.cs	2011-01-17 17:05:19 +0000
+++ b/WexInstaller/InstallWizard/Features.cs	2011-01-24 16:44:49 +0000
@@ -25,13 +25,23 @@
         {
             // load our catalog dropdown
             catalogList.Items.Clear();
+
             foreach (ProductCatalog catalog in ProductManager.Catalogs)
-            {
                 catalogList.Items.Add(new CatalogState(catalog));
-            }
+
             catalogList.Items.Add(new CatalogState(Resources.AllMySQLProducts, true));
             catalogList.Items.Add(new CatalogState(Resources.InstalledMySQLProducts, false));
-            catalogList.SelectedIndex = 0;
+
+            int index = 0;
+            foreach (ProductCatalog catalog in ProductManager.Catalogs)
+            {
+                if (ProductManager.ActiveCatalog == catalog)
+                {
+                    catalogList.SelectedIndex = index;
+                    break;
+                }
+                index++;
+            }
 
             NextButton.Text = Properties.Resources.NextButtonDefaultText;
             base.Activate();


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110124164449-m35w0i3o10v0e0vq.bundle
Thread
bzr commit into wex-installer-1.0 branch (reggie.burnett:260) Reggie Burnett24 Jan