コード例 #1
0
        private void btnSiteInfoNext_Click(object sender, EventArgs e)
        {
            bool proceed;

            if (string.IsNullOrWhiteSpace(this.txtInstallBaseFolder.Text) || string.IsNullOrWhiteSpace(this.txtInstallSubFolder.Text) || string.IsNullOrWhiteSpace(this.txtSiteNamePrefix.Text))
            {
                DialogController.ShowMessage(
                    "Site Info",
                    "Please make sure you have entered a Site Name and Install Folder",
                    SystemIcons.Warning,
                    DialogController.DialogButtons.OK);

                return;
            }

            if (!Directory.Exists(this.InstallFolder))
            {
                var doNotWarnAgain = Properties.Settings.Default.LocationDoNotWarnAgain;

                if (!doNotWarnAgain)
                {
                    var result = DialogController.ShowMessage(
                        "Site Info",
                        "The entered location does not exist. Do you wish to create it?",
                        SystemIcons.Warning,
                        DialogController.DialogButtons.YesNoIgnore,
                        Properties.Settings.Default.LocationDoNotWarnAgain);

                    if (result == DialogResult.Yes)
                    {
                        Directory.CreateDirectory(this.InstallFolder);
                        proceed = true;
                    }
                    else
                    {
                        proceed = false;
                    }

                    Properties.Settings.Default.LocationDoNotWarnAgain = DialogController.DoNotWarnAgain;
                    Properties.Settings.Default.Save();
                }
                else
                {
                    Directory.CreateDirectory(this.InstallFolder);
                    proceed = true;
                }
            }
            else
            {
                proceed = true;
            }

            if (proceed)
            {
                if (!FileSystemController.DirectoryEmpty(this.InstallFolder))
                {
                    var result = DialogController.ShowMessage(
                        "Confirm Installation",
                        "All files and folders at this location will be deleted prior to installation of\nthe new DNN instance. Do you wish to proceed?",
                        SystemIcons.Information,
                        DialogController.DialogButtons.YesNo);

                    if (result == DialogResult.No)
                    {
                        proceed = false;
                    }
                    else
                    {
                        proceed = true;
                    }
                }
                else
                {
                    proceed = true;
                }
            }

            if (proceed)
            {
                this.tabInstallPackage.Enabled = false;
                this.tabSiteInfo.Enabled       = false;
                this.tabControl.TabPages.Insert(2, this.tabDatabaseInfo);
                this.tabDatabaseInfo.Enabled  = true;
                this.tabProgress.Enabled      = false;
                this.tabControl.SelectedIndex = 2;
                this.SaveUserSettings();
            }
        }