public void Execute(object parameter) { var bimFormats = new FileGroup("BIM formats", "*.ifc;*.ifcxml;*.xbim;*.ifczip"); var cobieSpreadsheet = new FileGroup("COBie spreadsheets", "*.xls;*.xlsx"); var cobieSchemas = AllowCompressedSchemas ? new FileGroup("COBie schemas", "*.json;*.xml;*.zip") : new FileGroup("COBie schemas", "*.json;*.xml"); var enabled = new List <FileGroup>(); if (IncludeCobie) { enabled.Add(cobieSpreadsheet); if (IncludeCobieSchemas) { enabled.Add(cobieSchemas); } } if (IncludeBIM) { enabled.Add(bimFormats); } // joined group var all = FileGroup.Union("All valid models", enabled); enabled.Insert(0, all); var dlg = new OpenFileDialog { Filter = FileGroup.GetFilter(enabled) }; if (_linkedFile.Exists) { dlg.InitialDirectory = Path.GetDirectoryName(_linkedFile.FileName); } var result = dlg.ShowDialog(); if (result != DialogResult.OK) { return; } _linkedFile.FileName = dlg.FileName; // todo: this should rather send an update for a property in the associated linkedFile _vm.FilesUpdate(); }
public void Execute(object parameter) { var filters = new List <FileGroup>(); if (COBieSpreadSheet) { filters.Add(new FileGroup("COBie Excel OpenFormat", "*.xlsx")); filters.Add(new FileGroup("COBie Excel Binary", "*.xls")); } if (COBieSchemas) { filters.Add(new FileGroup("COBie Schema in Json format", "*.json")); filters.Add(new FileGroup("COBie Schema in Xml format", "*.xml")); } if (TextFormat) { filters.Add(new FileGroup("Text files", "*.txt")); } FileSelector.Filter = FileGroup.GetFilter(filters); if (_linkedFile.Exists) { FileSelector.InitialDirectory = Path.GetDirectoryName(_linkedFile.FileName); } var result = FileSelector.ShowDialog(); if (result != DialogResult.OK) { return; } _linkedFile.FileName = FileSelector.FileName; _vm.FilesUpdate(); }