Exemple #1
0
        static void DoMain()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            InstallerForm form = new InstallerForm();

            form.Text = InstallConfiguration.FormatString("{SolutionTitle}");
            form.SetProductLabel(GetApplicationTitle());

            form.StoreNextTitle(Resources.CommonUIStrings.controlSummaryWelcome);
            form.ContentControls.Add(CreateWelcomeControl());
            form.StoreNextTitle(Resources.CommonUIStrings.controlTitleSystemCheck);
            form.ContentControls.Add(CreateSystemCheckControl());
            if (!IsRunAsAdmin())
            {
                Elevate();
                Application.Exit();
            }
            else
            {
                if (SystemCheckControl.CanContactFarm())
                {
                    Application.Run(form);
                }
                else
                {
                    MessageBox.Show("Cannot contact farm", "Farm Failure");
                }
            }
        }
Exemple #2
0
        private void AddLinks(InstallOptions options)
        {
            // Show a documentation Url if one is configured
            if (!String.IsNullOrEmpty(InstallConfiguration.DocumentationUrl))
            {
                string linkText  = InstallConfiguration.FormatString(CommonUIStrings.finishedLinkText);
                int    linkStart = linkText.Length - 5;
                AddLink(linkText, linkStart, 4, InstallConfiguration.DocumentationUrl);
            }

            // Add the for each target
            if (InstallConfiguration.FeatureScope == SPFeatureScope.Site &&
                !String.IsNullOrEmpty(InstallConfiguration.SiteCollectionRelativeConfigLink))
            {
                // Add site collection links
                AddSiteCollectionLinks(options.SiteCollectionTargets, FormatRelativeLink(InstallConfiguration.SiteCollectionRelativeConfigLink));
            }
            else if (InstallConfiguration.FeatureScope == SPFeatureScope.Farm &&
                     !String.IsNullOrEmpty(InstallConfiguration.SSPRelativeConfigLink))
            {
                // Add Shared Service Provider links
                // Note that thes are really Shared Resource Provider links - we just wish we knew how to only show links for a SSP and not SRPs
                AddSspLinks(options.WebApplicationTargets, FormatRelativeLink(InstallConfiguration.SSPRelativeConfigLink));
            }
        }
Exemple #3
0
        private static InstallerControl CreateWelcomeControl()
        {
            WelcomeControl control = new WelcomeControl();

            control.Title    = InstallConfiguration.FormatString(Resources.CommonUIStrings.controlTitleWelcome);
            control.SubTitle = InstallConfiguration.FormatString(Resources.CommonUIStrings.controlSubTitleWelcome);
            return(control);
        }
Exemple #4
0
 private void AddSspLinks(IList <SPWebApplication> webApplicationTargets, string relativeLink)
 {
     foreach (SPWebApplication webApp in webApplicationTargets)
     {
         Hashtable properties = webApp.Properties;
         if (properties.ContainsKey("Microsoft.Office.Server.SharedResourceProvider"))
         {
             string linkText = InstallConfiguration.FormatString(CommonUIStrings.finishedLinkTextSsp, webApp.Sites[0].Url);
             AddLink(linkText, 6, 4, webApp.Sites[0].Url + relativeLink);
         }
     }
 }
Exemple #5
0
        private static InstallerControl CreateSystemCheckControl()
        {
            SystemCheckControl control = new SystemCheckControl();

            control.Title    = Resources.CommonUIStrings.controlTitleSystemCheck;
            control.SubTitle = InstallConfiguration.FormatString(Resources.CommonUIStrings.controlSubTitleSystemCheck);

            control.RequireMOSS          = InstallConfiguration.RequireMoss;
            control.MinSharePointVersion = InstallConfiguration.MinSharePointVersion;
            control.MaxSharePointVersion = InstallConfiguration.MaxSharePointVersion;
            control.RequireSearchSKU     = false;

            return(control);
        }
Exemple #6
0
        void CompletionControl_Load(object sender, EventArgs e)
        {
            // Conditionally show the FinishedControl
            if (InstallConfiguration.ShowFinishedControl && Form.Operation == InstallOperation.Install)
            {
                FinishedControl finishedControl = new FinishedControl();
                finishedControl.Title    = CommonUIStrings.finishedTitle;
                finishedControl.SubTitle = InstallConfiguration.FormatString(CommonUIStrings.finishedSubTitle);
                Form.StoreNextTitle(Resources.CommonUIStrings.controlSummaryFinished);
                Form.ContentControls.Add(finishedControl);

                Form.NextButton.Enabled = true;
            }
        }
Exemple #7
0
        private void FinalizeChecks()
        {
            if (errors == 0)
            {
                ConfigureControls();
                Form.NextButton.Enabled = true;
                messageLabel.Text       = CommonUIStrings.messageLabelTextSuccess;
            }
            else
            {
                messageLabel.Text = InstallConfiguration.FormatString(CommonUIStrings.messageLabelTextError);
            }

            Form.PrevButton.Enabled = true;
        }
Exemple #8
0
        public UpgradeControl(bool bUpgrade)
        {
            InitializeComponent();
            if (!bUpgrade)
            {
                this.upgradeRadioButton.Checked = false;
            }


            messageLabel.Text = InstallConfiguration.FormatString(messageLabel.Text);

            string upgradeDescription = InstallConfiguration.UpgradeDescription;

            if (upgradeDescription != null)
            {
                upgradeDescriptionLabel.Text = upgradeDescription;
            }
        }
Exemple #9
0
            protected override SystemCheckResult DoExecute()
            {
                Guid solutionId = Guid.Empty;

                try
                {
                    solutionId = InstallConfiguration.SolutionId;
                }
                catch (ArgumentNullException)
                {
                    throw new InstallException(CommonUIStrings.installExceptionConfigurationNoId);
                }
                catch (FormatException)
                {
                    throw new InstallException(CommonUIStrings.installExceptionConfigurationInvalidId);
                }

                try
                {
                    solution = SPFarm.Local.Solutions[solutionId];
                    if (solution != null)
                    {
                        this.OkText = InstallConfiguration.FormatString(CommonUIStrings.solutionCheckOkTextInstalled);
                        InstallConfiguration.SolutionInstalled = true;
                    }
                    else
                    {
                        this.OkText = InstallConfiguration.FormatString(CommonUIStrings.solutionCheckOkTextNotInstalled);
                        InstallConfiguration.SolutionInstalled = false;
                    }
                }

                catch (NullReferenceException)
                {
                    throw new InstallException(CommonUIStrings.installExceptionDatabase);
                }

                catch (Exception ex)
                {
                    throw new InstallException(ex.Message, ex);
                }

                return(SystemCheckResult.Success);
            }
Exemple #10
0
        private void ConfigureControls()
        {
            SolutionCheck check    = (SolutionCheck)checks["SolutionCheck"];
            SPSolution    solution = check.Solution;

            Version newVersion = InstallConfiguration.SolutionVersion;

            if (solution == null)
            {
                AddInstallControls();
            }
            else
            {
                Version installedVersion = InstallConfiguration.InstalledVersion;

                if (newVersion != installedVersion)
                {
                    string upgradePrompt = string.Format(
                        "Upgrade from version '{0}' to version '{1}'",
                        installedVersion, newVersion);
                    Form.StoreNextTitle(Resources.CommonUIStrings.controlTitleUpgradeRemove);
                    Form.ContentControls.Add(Program.CreateUpgradeControl(upgradePrompt));
                }
                else
                {
                    Form.StoreNextTitle(Resources.CommonUIStrings.controlTitleRepairRemove);
                    Form.ContentControls.Add(Program.CreateRepairControl());
                }

                if (InstallConfiguration.HasFeatureScope(Microsoft.SharePoint.SPFeatureScope.WebApplication) ||
                    InstallConfiguration.HasFeatureScope(Microsoft.SharePoint.SPFeatureScope.Site) ||
                    InstallConfiguration.HasFeatureScope(Microsoft.SharePoint.SPFeatureScope.Web)
                    )
                {
                    Form.StoreNextTitle(Resources.CommonUIStrings.controlSummaryActivations);
                    Form.ContentControls.Add(Program.CreateActivationsControl());
                }

                Form.StoreNextTitle(Resources.CommonUIStrings.controlSummaryInstalling);
                Form.ContentControls.Add(Program.CreateProcessControl());
            }
        }
Exemple #11
0
 private void AddSiteCollectionLinks(IList <SiteLoc> siteCollectionTargets, string relativeLink)
 {
     foreach (SiteLoc siteLoc in siteCollectionTargets)
     {
         SPSite siteCollection = null;
         try
         {
             siteCollection = new SPSite(siteLoc.SiteId);
             string linkText = InstallConfiguration.FormatString(CommonUIStrings.finishedLinkTextSiteCollection, siteCollection.Url);
             AddLink(linkText, 6, 4, siteCollection.Url + relativeLink);
         }
         finally
         {
             // guarantee SPSite is released ASAP even in face of exception
             if (siteCollection != null)
             {
                 siteCollection.Dispose();
             }
         }
     }
 }
Exemple #12
0
        public WelcomeControl()
        {
            InitializeComponent();

            messageLabel.Text = InstallConfiguration.FormatString(messageLabel.Text);
        }
Exemple #13
0
 protected override SystemCheckResult DoExecute()
 {
     try
     {
         string checkResult = "?";
         if (InstallConfiguration.FeatureIdList == null)
         {
             // TODO: Perry, 2010-10-06, l10n this
             checkResult = "No features specified";
             this.OkText = checkResult;
             return(SystemCheckResult.Success);
         }
         int newFeatures = 0, installedFeatures = 0, otherFeatures = 0, nosolFeatures = 0;
         foreach (Guid?guid in InstallConfiguration.FeatureIdList)
         {
             if (guid == null)
             {
                 continue;           // Perry, 2010-10-06: I don't know why we allow null GUIDs in this list anyway
             }
             try
             {
                 SPFeatureDefinition fdef = SPFarm.Local.FeatureDefinitions[guid.Value];
                 if (fdef == null)
                 {
                     ++newFeatures;
                 }
                 else if (fdef.SolutionId == InstallConfiguration.SolutionId)
                 {
                     ++installedFeatures;
                 }
                 else if (fdef.SolutionId == Guid.Empty)
                 {
                     ++nosolFeatures;
                 }
                 else
                 {
                     ++otherFeatures;
                 }
             }
             catch (Exception exc)
             {
                 throw new InstallException("Exception checking for feature: " + guid.Value.ToString() + ": " + exc.Message);
             }
         }
         // TODO: Perry, 2010-10-06, l10n this
         if (newFeatures > 0 && installedFeatures == 0 && otherFeatures == 0 && nosolFeatures == 0)
         {
             checkResult = InstallConfiguration.FormatString(CommonUIStrings.featuresNewText
                                                             , newFeatures
                                                             );
         }
         else if (newFeatures == 0 && installedFeatures > 0 && otherFeatures == 0 && nosolFeatures == 0)
         {
             checkResult = InstallConfiguration.FormatString(CommonUIStrings.featuresInstalledText
                                                             , installedFeatures
                                                             );
         }
         else
         {
             checkResult = InstallConfiguration.FormatString(CommonUIStrings.featuresMixedText
                                                             , InstallConfiguration.FeatureIdList.Count, newFeatures, installedFeatures, otherFeatures, nosolFeatures
                                                             );
         }
         this.OkText    = checkResult;
         this.ErrorText = checkResult;
         if (InstallConfiguration.SolutionInstalled)
         {
             if (newFeatures > 0 || otherFeatures > 0 || nosolFeatures > 0)
             {
                 return(SystemCheckResult.Error);
             }
         }
         else
         {
             if (installedFeatures > 0 || otherFeatures > 0 || nosolFeatures > 0)
             {
                 return(SystemCheckResult.Error);
             }
         }
         return(SystemCheckResult.Success);
     }
     catch (NullReferenceException)
     {
         throw new InstallException(CommonUIStrings.installExceptionDatabase);
     }
     catch (Exception ex)
     {
         throw new InstallException(ex.Message, ex);
     }
 }
Exemple #14
0
        private void InitializeChecks()
        {
            this.tableLayoutPanel.SuspendLayout();

            //
            // WSS Installed Check
            //
            WSSInstalledCheck wssCheck = new WSSInstalledCheck();

            wssCheck.QuestionText = CommonUIStrings.wssCheckQuestionText;
            wssCheck.OkText       = CommonUIStrings.wssCheckOkText;
            wssCheck.ErrorText    = CommonUIStrings.wssCheckErrorText;
            AddCheck(wssCheck);

            //
            // WSS Version Check
            //
            if (MinSharePointVersion != "" || MaxSharePointVersion != "")
            {
                SharePointVersionCheck versionCheck = new SharePointVersionCheck(MinSharePointVersion, MaxSharePointVersion);
                versionCheck.QuestionText = string.Format(CommonUIStrings.versionCheckQuestionText, MinSharePointVersion, MaxSharePointVersion);
                string versionEquation = string.Format("{0} <= {1} <= {2}", MinSharePointVersion, SPFarm.Local.BuildVersion.ToString(), MaxSharePointVersion);
                if (MinSharePointVersion == "")
                {
                    versionEquation = string.Format("{0} <= {1}", SPFarm.Local.BuildVersion.ToString(), MaxSharePointVersion);
                }
                else if (MaxSharePointVersion == "")
                {
                    versionEquation = string.Format("{0} <= {1}", MinSharePointVersion, SPFarm.Local.BuildVersion.ToString());
                }
                versionCheck.OkText    = string.Format(CommonUIStrings.versionCheckOkText, versionEquation);
                versionCheck.ErrorText = string.Format(CommonUIStrings.versionCheckErrorText, versionEquation);
                AddCheck(versionCheck);
            }

            //
            // MOSS Installed Check
            //
            if (requireMOSS)
            {
                MOSSInstalledCheck mossCheck = new MOSSInstalledCheck();
                mossCheck.QuestionText = CommonUIStrings.mossCheckQuestionText;
                mossCheck.OkText       = CommonUIStrings.mossCheckOkText;
                mossCheck.ErrorText    = CommonUIStrings.mossCheckErrorText;
                AddCheck(mossCheck);
            }

            //
            // Admin Rights Check
            //
            AdminRightsCheck adminRightsCheck = new AdminRightsCheck();

            adminRightsCheck.QuestionText = CommonUIStrings.adminRightsCheckQuestionText;
            adminRightsCheck.OkText       = CommonUIStrings.adminRightsCheckOkText;
            adminRightsCheck.ErrorText    = CommonUIStrings.adminRightsCheckErrorText;
            AddCheck(adminRightsCheck);

            //
            // Admin Service Check
            //
            AdminServiceCheck adminServiceCheck = new AdminServiceCheck();

            adminServiceCheck.QuestionText = CommonUIStrings.adminServiceCheckQuestionText;
            adminServiceCheck.OkText       = CommonUIStrings.adminServiceCheckOkText;
            adminServiceCheck.ErrorText    = CommonUIStrings.adminServiceCheckErrorText;
            AddCheck(adminServiceCheck);

            //
            // Timer Service Check
            //
            TimerServiceCheck timerServiceCheck = new TimerServiceCheck();

            timerServiceCheck.QuestionText = CommonUIStrings.timerServiceCheckQuestionText;
            timerServiceCheck.OkText       = CommonUIStrings.timerServiceCheckOkText;
            timerServiceCheck.ErrorText    = CommonUIStrings.timerServiceCheckErrorText;
            AddCheck(timerServiceCheck);

            //
            // Solution File Check
            //
            SolutionFileCheck solutionFileCheck = new SolutionFileCheck();

            solutionFileCheck.QuestionText = CommonUIStrings.solutionFileCheckQuestionText;
            solutionFileCheck.OkText       = CommonUIStrings.solutionFileCheckOkText;
            AddCheck(solutionFileCheck);

            //
            // Solution Check
            //
            SolutionCheck solutionCheck = new SolutionCheck();

            solutionCheck.QuestionText = InstallConfiguration.FormatString(CommonUIStrings.solutionCheckQuestionText);
            solutionCheck.OkText       = InstallConfiguration.FormatString(CommonUIStrings.solutionFileCheckOkText);
            solutionCheck.ErrorText    = InstallConfiguration.FormatString(CommonUIStrings.solutionCheckErrorText);
            AddCheck(solutionCheck);

            //
            // Features Check
            //
            {
                FeaturesCheck check = new FeaturesCheck();
                check.QuestionText = InstallConfiguration.FormatString(CommonUIStrings.featuresCheckQuestionText);
                check.OkText       = "Finished checking features"; // TODO - shouldn't be used
                check.ErrorText    = "?";                          // not used
                AddCheck(check);
            }

            //
            // Add empty row that will eat up the rest of the
            // row space in the layout table.
            //
            this.tableLayoutPanel.RowCount++;
            this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));

            this.tableLayoutPanel.ResumeLayout(false);
            this.tableLayoutPanel.PerformLayout();
        }