Beispiel #1
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            _path        = pathTBox.Text;
            _projectName = txtProjectName.Text;

            string strCaption = StringParserService.Parse("${res:SimplusD.name}");

            ///检查输入值
            if (string.IsNullOrEmpty(txtProjectName.Text.Trim()))
            {
                MessageBox.Show("项目名不能为空。", strCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtProjectName.Focus();
                return;
            }
            if (string.IsNullOrEmpty(pathTBox.Text.Trim()))
            {
                MessageBox.Show("路径不能为空。");
                pathTBox.Focus();
                return;
            }
            if (pathTBox.Text.IndexOf(":") == -1)
            {
                MessageBox.Show("项目路径格式不正确:" + pathTBox.Text, strCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                pathTBox.Focus();
                pathTBox.Select();
                return;
            }
            string strRootPath = Directory.GetDirectoryRoot(pathTBox.Text);

            if (!Directory.Exists(strRootPath))
            {
                MessageBox.Show("所指定的位置在无效或只读的磁盘上,或者包含为系统保留的设备名", strCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                if (Directory.Exists(pathTBox.Text))
                {
                    Directory.CreateDirectory(pathTBox.Text.Trim());
                }
            }
            catch (NotSupportedException)
            {
                MessageBox.Show("项目路径格式不正确:" + pathTBox.Text, strCaption);
                pathTBox.Focus();
                pathTBox.Select();
                return;
            }
            catch (Exception ex)
            {
                Service.Exception.ShowException(ex);
                pathTBox.Focus();
                pathTBox.Select();
                return;
            }
            if (File.Exists(
                    Path.Combine(Path.Combine(pathTBox.Text.Trim(), txtProjectName.Text.Trim()), txtProjectName.Text.Trim() + ".sdsite")))
            {
                MessageBox.Show("项目已存在。", strCaption);
                txtProjectName.Focus();
                txtProjectName.Select();
                return;
            }

            if (this.selectListView.SelectedItems.Count > 0)
            {
                ((SiteType)this.selectListView.SelectedItems[0].Tag).GetSiteCreator().
                CreateSite(pathTBox.Text, txtProjectName.Text);
                _projectFile      = Path.Combine(pathTBox.Text, txtProjectName.Text + @"\" + txtProjectName.Text + ".sdsite");
                this.DialogResult = DialogResult.OK;
                _isShowGuide      = this.isStartupSiteWiz.Checked;
                this.Close();

                ///记录下“网站路径”
                Service.RecentFiles.AddFilePath("recentCreateProjectFolder", pathTBox.Text);

                ///保存当前的图标显示状态
                SoftwareOption.Site.ShowSmallIcon = smallIconToolStripButton.Checked;
                SoftwareOption.Site.UseSiteGuide  = isStartupSiteWiz.Checked;
                SoftwareOption.Save();
            }
        }
Beispiel #2
0
 public void Save()
 {
     SoftwareOption.Save();
     //_OptionXmlDocument.Save(PathService.Config_GlobalSetting);
 }