Exemple #1
0
        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);
                    }
                }
            };
        }
Exemple #2
0
        public static string SelectProject(ProjectCollector projects)
        {
            var dialog       = new SelectProjectDialog(projects);
            var dialogResult = dialog.ShowDialog();
            var selected     = dialog.Selected;

            dialog.Dispose();
            if (dialogResult == DialogResult.OK)
            {
                return(selected);
            }
            else
            {
                return(null);
            }
        }