Esempio n. 1
0
        void btnOK_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(txtProjectPath.Text))
            {
                UserInfoHandler.ShowInfo("Please indicate a valid 'Project Path' for storing the new project."); return;
            }

            if (txtProjectName.Text == string.Empty)
            {
                UserInfoHandler.ShowInfo("Please indicate a 'Project Name'."); return;
            }

            if (chkProjectOnDisk.Checked && !CountryAdministrator.ContainsEuromodFileStructure(txtBasePath.Text))
            {
                UserInfoHandler.ShowInfo($"Please indicate a folder containting the {DefGeneral.BRAND_TITLE} file structure as 'Project on Disk' (or check 'No Base Project')."); return;
            }

            if (chkProjectOnVC.Checked && cmbBaseProjects.SelectedIndex < 0)
            {
                UserInfoHandler.ShowInfo("Please select a Base Project from the list 'Project on VC' (or check 'No Base Project')."); return;
            }

            if (chkProjectOnVC.Checked && cmbSelectVersion.SelectedIndex < 0)
            {
                UserInfoHandler.ShowError("Please select a Version. If no version is available, this project cannot be selected as Base Project."); return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
Esempio n. 2
0
        void btnDefineContent_Click(object sender, EventArgs e)
        {
            if (chkProjectOnDisk.Checked)
            {
                if (!CountryAdministrator.ContainsEuromodFileStructure(txtBasePath.Text))
                {
                    UserInfoHandler.ShowInfo($"Before you can define the content you have to indicate a folder containing the {DefGeneral.BRAND_TITLE} file structure as 'Base Project' (field 'Project on Disk').");
                    return;
                }
                string baseProjectPath = EMPath.AddSlash(txtBasePath.Text).ToLower();
                if (_projectContent != null && _projectContent.baseProjectPath != baseProjectPath)
                {
                    _projectContent = null; //project content was defined before, but for another base-project
                }
                if (_projectContent == null)
                {
                    if (!AssessDiskBaseProjectContent(baseProjectPath, out _projectContent))
                    {
                        return;
                    }
                }
            }
            else //chkProjectOnVC.Checked = true
            {
                if (cmbBaseProjects.SelectedIndex < 0)
                {
                    UserInfoHandler.ShowInfo("Before you can define the content you have to define a 'Base Project' (select from list 'Project on VC').");
                    return;
                }
                if (cmbSelectVersion.SelectedIndex < 0)
                {
                    UserInfoHandler.ShowInfo("Before you can define the content you have to select a Version for the 'Base Project' (select from list 'Project on VC').");
                    return;
                }

                string currentSelectedVersionIndex = cmbSelectVersion.SelectedItem.ToString();

                ProjectNode project = (cmbBaseProjects.Tag as List <ProjectNode>).ElementAt(cmbBaseProjects.SelectedIndex);

                if ((_projectContent != null && _projectContent.baseProjectId != project.Id) || (_projectContent != null && _projectContent.baseProjectId == project.Id && _projectContent.selectedRelease != cmbSelectVersion.SelectedItem.ToString()))
                {
                    _projectContent = null;                     //project content was defined before, but for another base-project
                }
                _selectedVersion = currentSelectedVersionIndex; //The selected version is updated

                if (_projectContent == null)
                {
                    if (!AssessVCBaseProjectContent(out _projectContent))
                    {
                        return;
                    }
                }
            }

            VCProjectContent projectContent = new VCProjectContent(_projectContent);

            if (projectContent.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            projectContent.GetChoices(out _projectContent.selections, out _projectContent.selectedYears);
        }