Exemplo n.º 1
0
        private void AddListViewItem(ConfigurationCheck check)
        {
            lvCheck.BeginUpdate();
            ListViewItem item = new ListViewItem(string.Empty);

            item.SubItems.AddRange(new string[] { check.Action, string.Empty, string.Empty });
            item.Tag = check;
            lvCheck.Items.Add(item);
            lvCheck.EndUpdate();
            Update();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Displays process progress.
        /// </summary>
        public void Start()
        {
            bool pass = true;

            try
            {
                lvCheck.Items.Clear();
                this.imgError.Visible  = false;
                this.imgOk.Visible     = false;
                this.lblResult.Visible = false;

                foreach (ConfigurationCheck check in Checks)
                {
                    AddListViewItem(check);
                }
                this.Update();
                CheckStatuses status  = CheckStatuses.Success;
                string        details = string.Empty;
                //
                foreach (ListViewItem item in lvCheck.Items)
                {
                    ConfigurationCheck check = (ConfigurationCheck)item.Tag;
                    item.ImageIndex       = 0;
                    item.SubItems[2].Text = "Running";
                    this.Update();

                    #region Previous Prereq Verification
                    switch (check.CheckType)
                    {
                    case CheckTypes.OperationSystem:
                        status = CheckOS(check.SetupVariables, out details);
                        break;

                    case CheckTypes.IISVersion:
                        status = CheckIISVersion(check.SetupVariables, out details);
                        break;

                    case CheckTypes.ASPNET:
                        status = CheckASPNET(check.SetupVariables, out details);
                        break;

                    case CheckTypes.SCPServer:
                        status = CheckSCPServer(check.SetupVariables, out details);
                        break;

                    case CheckTypes.SCPEnterpriseServer:
                        status = CheckSCPEnterpriseServer(check.SetupVariables, out details);
                        break;

                    case CheckTypes.SCPPortal:
                        status = CheckSCPPortal(check.SetupVariables, out details);
                        break;

                    case CheckTypes.SCPWebDavPortal:
                        status = CheckSCPWebDavPortal(check.SetupVariables, out details);
                        break;

                    default:
                        status = CheckStatuses.Warning;
                        break;
                    }

                    #endregion

                    switch (status)
                    {
                    case CheckStatuses.Success:
                        item.ImageIndex       = 1;
                        item.SubItems[2].Text = "Success";
                        break;

                    case CheckStatuses.Warning:
                        item.ImageIndex       = 2;
                        item.SubItems[2].Text = "Warning";
                        break;

                    case CheckStatuses.Error:
                        item.ImageIndex       = 3;
                        item.SubItems[2].Text = "Error";
                        pass = false;
                        break;
                    }
                    item.SubItems[3].Text = details;
                    this.Update();
                }
                //
                //actionManager.PrerequisiteComplete += new EventHandler<ActionProgressEventArgs<bool>>((object sender, ActionProgressEventArgs<bool> e) =>
                //{
                //
                //});
                //
                //actionManager.VerifyDistributivePrerequisites();

                ShowResult(pass);
                if (pass)
                {
                    //unattended setup
                    if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
                    {
                        Wizard.GoNext();
                    }
                }
            }
            catch (Exception ex)
            {
                if (Utils.IsThreadAbortException(ex))
                {
                    return;
                }

                ShowError();
                return;
            }
        }
Exemplo n.º 3
0
        internal static object InstallBase(object obj, string minimalInstallerVersion)
        {
            Hashtable args = Utils.GetSetupParameters(obj);
            //check CS version
            var shellMode      = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
            var version        = new Version(Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion));
            var setupVariables = new SetupVariables
            {
                SetupAction         = SetupActions.Install,
                ConfigurationFile   = "web.config",
                WebSiteIP           = Global.WebDavPortal.DefaultIP, //empty - to detect IP
                WebSitePort         = Global.WebDavPortal.DefaultPort,
                WebSiteDomain       = String.Empty,
                NewWebSite          = true,
                NewVirtualDirectory = false,
                ConnectionString    = Global.WebDavPortal.AspNetConnectionStringFormat,
                DatabaseServer      = Global.WebDavPortal.DefaultDbServer,
                Database            = Global.WebDavPortal.DefaultDatabase,
                CreateDatabase      = false,
                UserAccount         = Global.WebDavPortal.ServiceAccount
            };

            //
            InitInstall(args, setupVariables);
            //Unattended setup
            LoadSetupVariablesFromSetupXml(setupVariables.SetupXml, setupVariables);
            //
            var wam = new WebDavPortalActionManager(setupVariables);

            //
            wam.PrepareDistributiveDefaults();
            //
            if (shellMode.Equals(Global.SilentInstallerShell, StringComparison.OrdinalIgnoreCase))
            {
                if (version < new Version(minimalInstallerVersion))
                {
                    Utils.ShowConsoleErrorMessage(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion);
                    //
                    return(false);
                }

                try
                {
                    var success = true;
                    //
                    setupVariables.EnterpriseServerURL = Utils.GetStringSetupParameter(args, Global.Parameters.EnterpriseServerUrl);
                    //
                    wam.ActionError += new EventHandler <ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
                    {
                        Utils.ShowConsoleErrorMessage(e.ErrorMessage);
                        //
                        Log.WriteError(e.ErrorMessage);
                        //
                        success = false;
                    });
                    //
                    wam.Start();
                    //
                    return(success);
                }
                catch (Exception ex)
                {
                    Log.WriteError("Failed to install the component", ex);
                    //
                    return(false);
                }
            }
            else
            {
                if (version < new Version(minimalInstallerVersion))
                {
                    //
                    MessageBox.Show(String.Format(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion), "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //
                    return(DialogResult.Cancel);
                }
                //
                InstallerForm form   = new InstallerForm();
                Wizard        wizard = form.Wizard;
                wizard.SetupVariables = setupVariables;
                wizard.ActionManager  = wam;
                //Unattended setup
                LoadSetupVariablesFromSetupXml(wizard.SetupVariables.SetupXml, wizard.SetupVariables);

                //create wizard pages
                var introPage             = new IntroductionPage();
                var licPage               = new LicenseAgreementPage();
                var page1                 = new ConfigurationCheckPage();
                ConfigurationCheck check1 = new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement")
                {
                    SetupVariables = setupVariables
                };
                ConfigurationCheck check2 = new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement")
                {
                    SetupVariables = setupVariables
                };
                ConfigurationCheck check3 = new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement")
                {
                    SetupVariables = setupVariables
                };
                page1.Checks.AddRange(new ConfigurationCheck[] { check1, check2, check3 });
                var page2 = new InstallFolderPage();
                var page3 = new WebPage();
                var page4 = new UserAccountPage();
                //var page5 = new UrlPage();
                var page5 = new ExpressInstallPage2();

                var page6 = new FinishPage();
                wizard.Controls.AddRange(new Control[] { introPage, licPage, page1, page2, page3, page4, page5, page6 });
                wizard.LinkPages();
                wizard.SelectedPage = introPage;
                //show wizard
                IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
                return(form.ShowModal(owner));
            }
        }