コード例 #1
0
        /// <summary>
        /// Ons the load.
        /// </summary>
        /// <param name="e">E.</param>
        protected override void OnLoad(EventArgs e)
        {
            InstallationState status = InstallationManager.GetInstallationStatus(VersionInfo.CurrentAssemblyVersion);
            var repository = new DatabaseObjectProvider();
            switch (status)
            {
                case InstallationState.NeedsInstallation:
                case InstallationState.NeedsUpgrade:
                    EnsureInstallStep("Default.aspx", "Step02_ConfigureHost.aspx");
                    break;

                default:
                    HostInfo info = HostInfo.LoadHostInfoFromDatabase(repository, true /* suppressException */);
                    int blogCount = repository.GetBlogCount();

                    if (info == null)
                    {
                        EnsureInstallStep("Step02_ConfigureHost.aspx");
                    }
                    if (info != null && blogCount == 0)
                    {
                        EnsureInstallStep("Step03_CreateBlog.aspx");
                    }
                    if (info != null && blogCount > 0)
                    {
                        EnsureInstallStep("InstallationComplete.aspx");
                    }
                    break;
            }

            base.OnLoad(e);
        }