private void SelectFilePackages() { // TODO what is this? // temporarily change MULTI_ALT to BASE_ALT if a reference scenario ought to be defined - is changed back (and further treated) after user choice // bool refDef = template.TemplateType == EMS_TEMPLATE_TYPE.MULTI_ALT && template.FilePackageDefinition.SpecifyReference; // if (refDef) template.TemplateType = EMS_TEMPLATE_TYPE.BASE_ALT; if (templateInfo.templateType == HardDefinitions.TemplateType.Default || (templateInfo.templateType == HardDefinitions.TemplateType.Multi)) { // (simple) selection-dialog, which allows for selecting (one or more) files SelectFilesForm form = new SelectFilesForm(templateInfo); DialogResult = form.ShowDialog() == DialogResult.OK ? DialogResult.OK : DialogResult.Cancel; filePackages = form.filePackages; } else if (templateInfo.templateType == HardDefinitions.TemplateType.BaselineReform) { // dialog allowing to select one base and several alternatives SelectBaseAltsForm form = new SelectBaseAltsForm(templateInfo); DialogResult = form.ShowDialog() == DialogResult.OK ? DialogResult.OK : DialogResult.Cancel; filePackages = form.filePackages; } /* * if (refDef) // MULTI_ALT with a reference scenario: add the "base", i.e. the reference scenario, as the first alternative * { // this is what the library needs to make EMS_Template.REFERENCE_ALT work * foreach (EMS_FilePackageContent filePackage in filePackages) * { * filePackage.PathsAlt.Insert(0, filePackage.PathBase); * filePackage.PathBase = string.Empty; * template.TemplateType = EMS_TEMPLATE_TYPE.MULTI_ALT; * } * } */ }
private void FillFileList(bool alt) { ListBox box = alt ? listAlt : listBase; string filePattern = "*.txt"; //TODO alt ? template.FilePackageDefinition.AltFileNamePattern : template.FilePackageDefinition.BaseFileNamePattern; string path = alt ? textAltPath.Text : textBasePath.Text; box.Items.Clear(); if (Directory.Exists(path)) { foreach (string filePath in Directory.GetFiles(path, filePattern)) { if (SelectFilesForm.isValidInput(filePath, templateInfo)) { box.Items.Add((new FileInfo(filePath)).Name); } } } }