private void Connect_OnStartupComplete(ref Array custom) { Buttons = new CommandBarButtons(Application); Buttons.ExportRequested += delegate { var project = SelectProjectDialog.SelectProject(new ProjectCollector(Application)); if (null != project) { using (var repository = new VbaProjectRepository(Application)) { repository.Export(project); } } }; Buttons.ImportRequested += delegate { using (var repository = new VbaProjectRepository(Application)) { var project = SelectProjectDialog.SelectProject(new ProjectCollector(repository)); if (null != project) { repository.Import(project); } } }; }
public ProjectCollector(VbaProjectRepository repository) { Result = new List <string>(); var projects = repository.ProjectsAvailable(); foreach (var item in projects) { Result.Add(item); } }