Exemplo n.º 1
0
        protected override void OnExectute(DoWorkEventArgs e)
        {
            var path = VBAGitAddinApp.GetVBProjectRepoPath(VBProject);

            if (path == null)
            {
                throw new Exception("You must save project before create git repository.");
            }

            _repositroty = Provider.Init(path, false);

            int progress = 0;
            int count    = VBProject.VBComponents.Count;

            foreach (VBComponent component in VBProject.VBComponents)
            {
                ReportProgress(100 * ++progress / count, VBAGitUI.ProgressInfo_ExportingFiles);

                if (CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }

                component.ExportAsSourceFile(path);
            }
        }
Exemplo n.º 2
0
        private void Setup()
        {
            _app = new VBAGitAddinApp(_vbe);

            _menu = new VBAGitAddinMenu(_app);
            _menu.Initialize();

            _ctxMenu = new ContextMenu(_app);
            _ctxMenu.Initialize();

            _sink = new VBProjectsEventsSink();
            var connectionPointContainer = (IConnectionPointContainer)_vbe.VBProjects;
            var interfaceId = typeof(_dispVBProjectsEvents).GUID;

            connectionPointContainer.FindConnectionPoint(ref interfaceId, out _projectsEventsConnectionPoint);
            _projectsEventsConnectionPoint.Advise(_sink, out _projectsEventsCookie);
            _sink.ProjectActivated += _sink_ProjectActivated;
            _sink.ProjectRemoved   += _sink_ProjectRemoved;
            _sink.ProjectAdded     += _sink_ProjectAdded;
        }